From 466a563e61330078ca4b0559308b42f9468b9da3 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Mon, 18 Nov 2019 08:31:03 -0800 Subject: D3D12 backend: fixed issue with the format of the swap chain's back buffer texture --- Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Graphics/GraphicsEngineD3DBase') diff --git a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h index 84a29a54..6ad6e0a9 100644 --- a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h +++ b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.h @@ -97,7 +97,20 @@ namespace Diligent // - DXGI_FORMAT_R10G10B10A2_UNORM // If RGBA8_UNORM_SRGB swap chain is required, we will create RGBA8_UNORM swap chain, but // create RGBA8_UNORM_SRGB render target view - swapChainDesc.Format = DXGIColorBuffFmt == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB ? DXGI_FORMAT_R8G8B8A8_UNORM : DXGIColorBuffFmt; + switch (DXGIColorBuffFmt) + { + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + swapChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + break; + + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + break; + + default: + swapChainDesc.Format = DXGIColorBuffFmt; + } + swapChainDesc.Stereo = FALSE; // Multi-sampled swap chains are not supported anymore. CreateSwapChainForHwnd() fails when sample count is not 1 -- cgit v1.2.3