Răsfoiți Sursa

D3D11: Fixed depth texture update.

Branimir Karadžić 8 ani în urmă
părinte
comite
633d15cde3
1 a modificat fișierele cu 3 adăugiri și 2 ștergeri
  1. 3 2
      src/renderer_d3d11.cpp

+ 3 - 2
src/renderer_d3d11.cpp

@@ -5159,7 +5159,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 		box.left   = _rect.m_x;
 		box.left   = _rect.m_x;
 		box.top    = _rect.m_y;
 		box.top    = _rect.m_y;
 		box.right  = box.left + _rect.m_width;
 		box.right  = box.left + _rect.m_width;
-		box.bottom = box.top + _rect.m_height;
+		box.bottom = box.top  + _rect.m_height;
 
 
 		uint32_t layer = 0;
 		uint32_t layer = 0;
 
 
@@ -5176,6 +5176,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 		}
 		}
 
 
 		const uint32_t subres = _mip + ( (layer + _side) * m_numMips);
 		const uint32_t subres = _mip + ( (layer + _side) * m_numMips);
+		const bool     depth  = bimg::isDepth(bimg::TextureFormat::Enum(m_textureFormat) );
 		const uint32_t bpp    = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) );
 		const uint32_t bpp    = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) );
 		const uint32_t rectpitch  = _rect.m_width*bpp/8;
 		const uint32_t rectpitch  = _rect.m_width*bpp/8;
 		const uint32_t srcpitch   = UINT16_MAX == _pitch ? rectpitch : _pitch;
 		const uint32_t srcpitch   = UINT16_MAX == _pitch ? rectpitch : _pitch;
@@ -5196,7 +5197,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 		deviceCtx->UpdateSubresource(
 		deviceCtx->UpdateSubresource(
 			  m_ptr
 			  m_ptr
 			, subres
 			, subres
-			, &box
+			, depth ? NULL : &box
 			, data
 			, data
 			, srcpitch
 			, srcpitch
 			, TextureD3D11::Texture3D == m_type ? slicepitch : 0
 			, TextureD3D11::Texture3D == m_type ? slicepitch : 0