From a16db4fb72ecaa3e87c76d7fd8956f8df8322d7d Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sat, 28 Sep 2024 18:23:09 -0300 Subject: [PATCH] metal: fix a crash when the window has no depth or stencil. --- src/modules/graphics/metal/Graphics.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/graphics/metal/Graphics.mm b/src/modules/graphics/metal/Graphics.mm index 451c319c0..1e3fa2a89 100644 --- a/src/modules/graphics/metal/Graphics.mm +++ b/src/modules/graphics/metal/Graphics.mm @@ -696,7 +696,10 @@ id Graphics::useRenderEncoder() auto &key = lastRenderPipelineKey; key.colorRenderTargetFormats = isGammaCorrect() ? PIXELFORMAT_BGRA8_sRGB : PIXELFORMAT_BGRA8_UNORM; - key.depthStencilFormat = backbufferDepthStencil->getPixelFormat(); + if (backbufferDepthStencil.get()) + key.depthStencilFormat = backbufferDepthStencil->getPixelFormat(); + else + key.depthStencilFormat = PIXELFORMAT_UNKNOWN; key.msaa = backbufferMSAA ? (uint8) backbufferMSAA->getMSAA() : 1; }