From 506da0443cd89c4f05363034554eedcef51c55c3 Mon Sep 17 00:00:00 2001 From: Robin Allen Date: Sat, 22 Jul 2023 02:03:30 +0100 Subject: [PATCH] Metal: Fix framebuffer hash ignoring sampleCount (#3140) --- src/renderer_mtl.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer_mtl.mm b/src/renderer_mtl.mm index f4088c08d..55b9ea013 100644 --- a/src/renderer_mtl.mm +++ b/src/renderer_mtl.mm @@ -3526,7 +3526,10 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa ); } - murmur.add(1); // SampleCount + const TextureMtl &firstTexture = s_renderMtl->m_textures[_attachment[0].handle.idx]; + const uint32_t msaaQuality = bx::uint32_satsub( (firstTexture.m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1); + const int32_t sampleCount = s_msaa[msaaQuality]; + murmur.add(sampleCount); m_pixelFormatHash = murmur.end(); }