check if drawable is valid

This commit is contained in:
Samuliak 2024-07-03 18:15:30 +02:00
parent b6c72e72e4
commit dfe38a757c

View file

@ -34,6 +34,9 @@ void RendererMTL::reset() {
void RendererMTL::display() { void RendererMTL::display() {
CA::MetalDrawable* drawable = metalLayer->nextDrawable(); CA::MetalDrawable* drawable = metalLayer->nextDrawable();
if (!drawable) {
return;
}
MTL::RenderPassDescriptor* renderPassDescriptor = MTL::RenderPassDescriptor::alloc()->init(); MTL::RenderPassDescriptor* renderPassDescriptor = MTL::RenderPassDescriptor::alloc()->init();
MTL::RenderPassColorAttachmentDescriptor* colorAttachment = renderPassDescriptor->colorAttachments()->object(0); MTL::RenderPassColorAttachmentDescriptor* colorAttachment = renderPassDescriptor->colorAttachments()->object(0);