How do I use SRGB with DXGI_SWAP_EFFECT_FLIP_DISCARD?

  Kiến thức lập trình

I have a dx11 project and I’d like to change the color format from DXGI_FORMAT_R8G8B8A8_UNORM to DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.

The problem is that doing this while having DXGI_SWAP_EFFECT_FLIP_DISCARD active results in 0x887a0001 (DXGI_ERROR_INVALID_CALL) when trying to create the device&swapchain.

Using DXGI_SWAP_EFFECT_DISCARD instead of flip discard circumvents the issue, but I’d like to use the flip model somehow.

I found something that said that

you should provide the *_SRGB format only for the render target view, not the backbuffer itself.

but trying that out only resulted in CreateRenderTargetView crashing instead.

Is this possible? Am I missunderstanding something?

Edit: One minute after posting this I got this console output:

DXGI ERROR: IDXGIFactory::CreateSwapChain: Flip model swapchains (DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL and DXGI_SWAP_EFFECT_FLIP_DISCARD) only support the following Formats: (DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM), assuming the underlying Device does as well.

Does this mean it’s impossible to use SRGB and Flip Discard?

LEAVE A COMMENT