소스 검색

Fixed swapped R and B in DX11 and OpenGL video capture

Added missing swizzle for RGBA to BGRA (copied from saveScreenShot).
Stephen Hill 10 년 전
부모
커밋
c386fca176
2개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      src/renderer_d3d11.cpp
  2. 5 0
      src/renderer_gl.cpp

+ 7 - 0
src/renderer_d3d11.cpp

@@ -3081,6 +3081,13 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 				D3D11_MAPPED_SUBRESOURCE mapped;
 				DX_CHECK(m_deviceCtx->Map(m_captureTexture, 0, D3D11_MAP_READ, 0, &mapped) );
 
+				imageSwizzleBgra8(getBufferWidth()
+					, getBufferHeight()
+					, mapped.RowPitch
+					, mapped.pData
+					, mapped.pData
+					);
+
 				g_callback->captureFrame(mapped.pData, getBufferHeight()*mapped.RowPitch);
 
 				m_deviceCtx->Unmap(m_captureTexture, 0);

+ 5 - 0
src/renderer_gl.cpp

@@ -2899,6 +2899,11 @@ namespace bgfx { namespace gl
 					, m_capture
 					) );
 
+				if (GL_RGBA == m_readPixelsFmt)
+				{
+					imageSwizzleBgra8(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture, m_capture);
+				}
+
 				g_callback->captureFrame(m_capture, m_captureSize);
 			}
 		}