From 07d16672a45a74b0b310322fe1f05cd5fc0a0aa1 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 26 May 2014 13:49:47 +0100 Subject: [PATCH] Fix backbuffer RTV not recreating properly if Desc->Format is UNKNOWN * Judging by the error reports that pointed to this crash, this happens with the Dolphin emulator. --- renderdoc/driver/d3d11/d3d11_device_wrap.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp index 04e8c3b45..9074acf84 100644 --- a/renderdoc/driver/d3d11/d3d11_device_wrap.cpp +++ b/renderdoc/driver/d3d11/d3d11_device_wrap.cpp @@ -870,6 +870,14 @@ bool WrappedID3D11Device::Serialise_CreateRenderTargetView( backbufferTypedDesc.Texture2D.MipSlice = 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 + if(HasDesc && pDesc->Format == DXGI_FORMAT_UNKNOWN && tex2d->m_RealDescriptor) + { + pDesc->Format = tex2d->m_RealDescriptor->Format; + } HRESULT hr = m_pDevice->CreateRenderTargetView(GetResourceManager()->UnwrapResource(live), pDesc, &ret);