Browse Source

Resolve active render target in D3D9 before switch

On D3D9 platforms that work on active render target instead of
a specified surface, the resovle of the previous RT must happen
before the new RT becomes active.
Matthew Endsley 11 năm trước cách đây
mục cha
commit
dc9e29601d
1 tập tin đã thay đổi với 8 bổ sung8 xóa
  1. 8 8
      src/renderer_d3d9.cpp

+ 8 - 8
src/renderer_d3d9.cpp

@@ -939,6 +939,14 @@ namespace bgfx
 
 
 		void setFrameBuffer(FrameBufferHandle _fbh, bool _msaa = true)
 		void setFrameBuffer(FrameBufferHandle _fbh, bool _msaa = true)
 		{
 		{
+			if (isValid(m_fbh)
+				&&  m_fbh.idx != _fbh.idx
+				&&  m_rtMsaa)
+			{
+				FrameBufferD3D9& frameBuffer = m_frameBuffers[m_fbh.idx];
+				frameBuffer.resolve();
+			}
+
 			if (!isValid(_fbh) )
 			if (!isValid(_fbh) )
 			{
 			{
 				DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) );
 				DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) );
@@ -970,14 +978,6 @@ namespace bgfx
 				DX_CHECK(m_device->SetDepthStencilSurface(NULL != depthStencil ? depthStencil : m_backBufferDepthStencil) );
 				DX_CHECK(m_device->SetDepthStencilSurface(NULL != depthStencil ? depthStencil : m_backBufferDepthStencil) );
 			}
 			}
 
 
-			if (isValid(m_fbh)
-				&&  m_fbh.idx != _fbh.idx
-				&&  m_rtMsaa)
-			{
-				FrameBufferD3D9& frameBuffer = m_frameBuffers[m_fbh.idx];
-				frameBuffer.resolve();
-			}
-
 			m_fbh = _fbh;
 			m_fbh = _fbh;
 			m_rtMsaa = _msaa;
 			m_rtMsaa = _msaa;
 		}
 		}