diff --git a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp index c74da92e1..c7b97a8c6 100644 --- a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp @@ -655,6 +655,17 @@ bool WrappedID3D11Device::Serialise_CreateShaderResourceView( backbufferTypedDesc.Texture2D.MostDetailedMip = 0; pDesc = &backbufferTypedDesc; } + + // if we have a descriptor but it specifies DXGI_FORMAT_UNKNOWN format, that means use + // the texture's format. But as above, we fudge around the typeless backbuffer so we + // have to set the correct typed format + // + // This behaviour is documented only for render targets, but seems to be used & work for + // SRVs, so apply it here too. + if(pDesc && pDesc->Format == DXGI_FORMAT_UNKNOWN && WrappedID3D11Texture2D::IsAlloc(live) && tex2d->m_RealDescriptor) + { + pDesc->Format = tex2d->m_RealDescriptor->Format; + } HRESULT hr = m_pDevice->CreateShaderResourceView(GetResourceManager()->UnwrapResource(live), pDesc, &ret); @@ -886,7 +897,7 @@ bool WrappedID3D11Device::Serialise_CreateRenderTargetView( // if we have a descriptor but it specifies DXGI_FORMAT_UNKNOWN format, that means use // the texture's format. But as above, we fudge around the typeless backbuffer so we // have to set the correct typed format - if(HasDesc && pDesc->Format == DXGI_FORMAT_UNKNOWN && tex2d->m_RealDescriptor) + if(pDesc && pDesc->Format == DXGI_FORMAT_UNKNOWN && WrappedID3D11Texture2D::IsAlloc(live) && tex2d->m_RealDescriptor) { pDesc->Format = tex2d->m_RealDescriptor->Format; }