(D3D11) get the hwrender texture format from the view desc

the format set in the texture desc isn't necessarily the same as the
view format.
This commit is contained in:
aliaspider 2020-11-15 15:07:53 +01:00
parent b3134fc05a
commit c6b77f6c62
2 changed files with 7 additions and 2 deletions

View File

@ -141,6 +141,11 @@ static INLINE void D3D11GetShaderResourceViewTexture2D(
{ {
shader_resource_view->lpVtbl->GetResource(shader_resource_view, (D3D11Resource*)texture2d); shader_resource_view->lpVtbl->GetResource(shader_resource_view, (D3D11Resource*)texture2d);
} }
static INLINE void D3D11GetShaderResourceViewDesc(
D3D11ShaderResourceView shader_resource_view, D3D11_SHADER_RESOURCE_VIEW_DESC* desc)
{
shader_resource_view->lpVtbl->GetDesc(shader_resource_view, desc);
}
static INLINE void static INLINE void
D3D11GetRenderTargetViewResource(D3D11RenderTargetView render_target_view, D3D11Resource* resource) D3D11GetRenderTargetViewResource(D3D11RenderTargetView render_target_view, D3D11Resource* resource)
{ {

View File

@ -1338,11 +1338,11 @@ static bool d3d11_gfx_frame(
D3D11Texture2D hw_texture = NULL; D3D11Texture2D hw_texture = NULL;
if (frame == RETRO_HW_FRAME_BUFFER_VALID) if (frame == RETRO_HW_FRAME_BUFFER_VALID)
{ {
D3D11_TEXTURE2D_DESC hw_desc; D3D11_SHADER_RESOURCE_VIEW_DESC hw_desc;
D3D11ShaderResourceView hw_view = NULL; D3D11ShaderResourceView hw_view = NULL;
D3D11GetPShaderResources(context, 0, 1, &hw_view); D3D11GetPShaderResources(context, 0, 1, &hw_view);
D3D11GetShaderResourceViewDesc(hw_view, &hw_desc);
D3D11GetShaderResourceViewTexture2D(hw_view, &hw_texture); D3D11GetShaderResourceViewTexture2D(hw_view, &hw_texture);
D3D11GetTexture2DDesc(hw_texture, &hw_desc);
if (d3d11->frame.texture[0].desc.Format != hw_desc.Format) if (d3d11->frame.texture[0].desc.Format != hw_desc.Format)
{ {