瀏覽代碼

Fix toggling MSAA on Metal. (#3137)

* Fix toggling MSAA on Metal.

m_backBufferColorMsaa was set when sampleCount > 1, but was never reset when
sampleCount became 1 again.

Many other bits of code in the Metal renderer decide what to do by checking
m_backBufferColorMsaa, so these would all do the wrong thing if you toggled
MSAA on and them back off.

* Cleanup
Robin Allen 2 年之前
父節點
當前提交
a50db8f8fd
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      src/renderer_mtl.mm

+ 6 - 5
src/renderer_mtl.mm

@@ -3400,13 +3400,14 @@ BX_STATIC_ASSERT(BX_COUNTOF(s_accessNames) == Access::Count, "Invalid s_accessNa
 			m_backBufferStencil = s_renderMtl->m_device.newTextureWithDescriptor(desc);
 			m_backBufferStencil = s_renderMtl->m_device.newTextureWithDescriptor(desc);
 		}
 		}
 
 
-		if (sampleCount > 1)
+		if (NULL != m_backBufferColorMsaa)
 		{
 		{
-			if (NULL != m_backBufferColorMsaa)
-			{
-				release(m_backBufferColorMsaa);
-			}
+			release(m_backBufferColorMsaa);
+			m_backBufferColorMsaa = NULL;
+		}
 
 
+		if (sampleCount > 1)
+		{
 			desc.pixelFormat = m_metalLayer.pixelFormat;
 			desc.pixelFormat = m_metalLayer.pixelFormat;
 			m_backBufferColorMsaa = s_renderMtl->m_device.newTextureWithDescriptor(desc);
 			m_backBufferColorMsaa = s_renderMtl->m_device.newTextureWithDescriptor(desc);
 		}
 		}