diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-11-18 16:31:03 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-11-18 16:31:03 +0000 |
| commit | 466a563e61330078ca4b0559308b42f9468b9da3 (patch) | |
| tree | 8ac915e2ad60c08ff82bea18a3fb46102e54d311 /Graphics/GraphicsEngineD3D12 | |
| parent | D3D11 and D3D12 backends: fixed issue with resolving typeless resources (diff) | |
| download | DiligentCore-466a563e61330078ca4b0559308b42f9468b9da3.tar.gz DiligentCore-466a563e61330078ca4b0559308b42f9468b9da3.zip | |
D3D12 backend: fixed issue with the format of the swap chain's back buffer texture
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp index 9517c93f..0d24c669 100644 --- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp @@ -76,7 +76,6 @@ void SwapChainD3D12Impl::InitBuffersAndViews() VERIFY_EXPR(SUCCEEDED(hr)); TextureDesc BackBufferDesc; - BackBufferDesc.Format = m_SwapChainDesc.ColorBufferFormat; String Name = "Main back buffer "; Name += std::to_string(backbuff); BackBufferDesc.Name = Name.c_str(); @@ -85,6 +84,7 @@ void SwapChainD3D12Impl::InitBuffersAndViews() m_pRenderDevice.RawPtr<RenderDeviceD3D12Impl>()->CreateTexture(BackBufferDesc, pBackBuffer, RESOURCE_STATE_UNDEFINED, &pBackBufferTex); TextureViewDesc RTVDesc; RTVDesc.ViewType = TEXTURE_VIEW_RENDER_TARGET; + RTVDesc.Format = m_SwapChainDesc.ColorBufferFormat; RefCntAutoPtr<ITextureView> pRTV; pBackBufferTex->CreateView(RTVDesc, &pRTV); m_pBackBufferRTV[backbuff] = RefCntAutoPtr<ITextureViewD3D12>(pRTV, IID_TextureViewD3D12); diff --git a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp index 945e4428..61cdc181 100644 --- a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp @@ -339,9 +339,13 @@ static TextureDesc InitTexDescFromD3D12Resource(ID3D12Resource* pTexture, const TextureDesc TexDesc = SrcTexDesc; if (TexDesc.Format == TEX_FORMAT_UNKNOWN) TexDesc.Format = DXGI_FormatToTexFormat(ResourceDesc.Format); - auto RefDXGIFormat = TexFormatToDXGI_Format(TexDesc.Format); - if( RefDXGIFormat != TexDesc.Format) - LOG_ERROR_AND_THROW("Incorrect texture format (", GetTextureFormatAttribs(TexDesc.Format).Name, ")"); + else + { + auto RefFormat = DXGI_FormatToTexFormat(ResourceDesc.Format); + DEV_CHECK_ERR(RefFormat == TexDesc.Format, "The format specified by texture description (", GetTextureFormatAttribs(TexDesc.Format).Name, ")" + " does not match the D3D12 resource format (", GetTextureFormatAttribs(RefFormat).Name, ")"); + (void)RefFormat; + } TexDesc.Width = static_cast<Uint32>( ResourceDesc.Width ); TexDesc.Height = Uint32{ ResourceDesc.Height }; |
