Forráskód Böngészése

Fixed imageSwizzleBgra8.

Branimir Karadžić 8 éve
szülő
commit
c0819a5a64
4 módosított fájl, 18 hozzáadás és 17 törlés
  1. 4 7
      src/renderer_d3d11.cpp
  2. 3 7
      src/renderer_d3d12.cpp
  3. 9 2
      src/renderer_gl.cpp
  4. 2 1
      src/renderer_mtl.mm

+ 4 - 7
src/renderer_d3d11.cpp

@@ -2075,10 +2075,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 				DX_CHECK(m_deviceCtx->Map(texture, 0, D3D11_MAP_READ, 0, &mapped) );
 				bimg::imageSwizzleBgra8(
 					  mapped.pData
+					, mapped.RowPitch
 					, backBufferDesc.Width
 					, backBufferDesc.Height
-					, mapped.RowPitch
 					, mapped.pData
+					, mapped.RowPitch
 					);
 				g_callback->screenShot(_filePath
 					, backBufferDesc.Width
@@ -3398,10 +3399,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 
 				bimg::imageSwizzleBgra8(
 					  mapped.pData
+					, mapped.RowPitch
 					, getBufferWidth()
 					, getBufferHeight()
-					, mapped.RowPitch
 					, mapped.pData
+					, mapped.RowPitch
 					);
 
 				g_callback->captureFrame(mapped.pData, getBufferHeight()*mapped.RowPitch);
@@ -4558,11 +4560,6 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 							srd[kk].SysMemPitch = mip.m_width*mip.m_bpp/8;
 						}
 
- 						if (swizzle)
- 						{
-// 							imageSwizzleBgra8(temp, width, height, mip.m_width*4, data);
- 						}
-
 						srd[kk].SysMemSlicePitch = mip.m_height*srd[kk].SysMemPitch;
 						++kk;
 					}

+ 3 - 7
src/renderer_d3d12.cpp

@@ -1655,15 +1655,16 @@ namespace bgfx { namespace d3d12
 			readback->Map(0, NULL, (void**)&data);
 			bimg::imageSwizzleBgra8(
 				  data
+				, layout.Footprint.RowPitch
 				, width
 				, height
-				, (uint32_t)pitch
 				, data
+				, layout.Footprint.RowPitch
 				);
 			g_callback->screenShot(_filePath
 				, width
 				, height
-				, (uint32_t)pitch
+				, layout.Footprint.RowPitch
 				, data
 				, (uint32_t)total
 				, false
@@ -4190,11 +4191,6 @@ data.NumQualityLevels = 0;
 							totalSize += slice;
 						}
 
- 						if (swizzle)
- 						{
-// 							imageSwizzleBgra8(temp, width, height, mip.m_width*4, data);
- 						}
-
 						srd[kk].SlicePitch = mip.m_height*srd[kk].RowPitch;
 						++kk;
 					}

+ 9 - 2
src/renderer_gl.cpp

@@ -2945,7 +2945,7 @@ namespace bgfx { namespace gl
 
 			if (GL_RGBA == m_readPixelsFmt)
 			{
-				bimg::imageSwizzleBgra8(data, width, height, width*4, data);
+				bimg::imageSwizzleBgra8(data, width*4, width, height, data, width*4);
 			}
 
 			g_callback->screenShot(_filePath
@@ -3531,7 +3531,14 @@ namespace bgfx { namespace gl
 
 				if (GL_RGBA == m_readPixelsFmt)
 				{
-					bimg::imageSwizzleBgra8(m_capture, m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, m_capture);
+					bimg::imageSwizzleBgra8(
+						  m_capture
+						, m_resolution.m_width*4
+						, m_resolution.m_width
+						, m_resolution.m_height
+						, m_capture
+						, m_resolution.m_width*4
+						);
 				}
 
 				g_callback->captureFrame(m_capture, m_captureSize);

+ 2 - 1
src/renderer_mtl.mm

@@ -1286,10 +1286,11 @@ namespace bgfx { namespace mtl
 				{
 					bimg::imageSwizzleBgra8(
 						  m_capture
+						, m_resolution.m_width*4
 						, m_resolution.m_width
 						, m_resolution.m_height
-						, m_resolution.m_width*4
 						, m_capture
+						, m_resolution.m_width*4
 						);
 				}