Explorar el Código

Modified CreateShaderResourceView() calls to use descriptiors from prior SRVs to handle cases where SRV format cannot be directly deduced from texture format. This happens when using D3D11's typeless texture formats, which can be introduced into a BGFX app using overrideInternal.

Justin Murray hace 6 años
padre
commit
248c7a88df
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      src/renderer_d3d11.cpp

+ 7 - 2
src/renderer_d3d11.cpp

@@ -4464,11 +4464,14 @@ namespace bgfx { namespace d3d11
 
 	void TextureD3D11::overrideInternal(uintptr_t _ptr)
 	{
+		D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc{};
+		m_srv->GetDesc(&srvDesc);
+
 		destroy();
 		m_flags |= BGFX_SAMPLER_INTERNAL_SHARED;
 		m_ptr = (ID3D11Resource*)_ptr;
 
-		s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, NULL, &m_srv);
+		s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, &srvDesc, &m_srv);
 	}
 
 	void TextureD3D11::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
@@ -4879,7 +4882,9 @@ namespace bgfx { namespace d3d11
 							break;
 						}
 
-						DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(texture.m_ptr, NULL, &m_srv[m_num]) );
+						D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc{};
+						texture.m_srv->GetDesc(&srvDesc);
+						DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(texture.m_ptr, &srvDesc, &m_srv[m_num]));
 						m_num++;
 					}
 					else