Hi,
I'm trying to set up a swap chain with an SRGB buffer format using Direct3D 12. The exact same code below both works when the buffer format does not have an _SRGB suffix and fails when the buffer format does have an _SRGB suffix. The commented out section is the only thing that changes.
I've enumerated my adapters and outputs and there are definitely results being returned for DXGI_FORMAT_R8G8B8A8_UNORM_SRGB (about 40, in fact). I'm also creating the device by specifying the adapter to use, which (through enumerating) I've verified is the correct one for my card.
Is anyone aware of an issue I may have missed in the documentation that enforces new limitations on buffer formats for swap chains?
Swap chain description and setup call. For what it's worth, the below code works perfectly in my DirectX 11 initialization routine using the _SRGB format for the buffers.
DXGI_SWAP_CHAIN_DESC swapChainDesc;
ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));
swapChainDesc.BufferDesc.Width = clientWidth;
swapChainDesc.BufferDesc.Height = clientHeight;
swapChainDesc.BufferDesc.RefreshRate.Numerator = 0u;
swapChainDesc.BufferDesc.RefreshRate.Denominator = 0u;
swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; // _SRGB
swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
swapChainDesc.SampleDesc.Count = 1u;
swapChainDesc.SampleDesc.Quality = 0u;
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferCount = m_frameCount;
swapChainDesc.OutputWindow = window.getHWND();
swapChainDesc.Windowed = true;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
IDXGISwapChain* pSwapChainPtr{nullptr};
hr = pFactory->CreateSwapChain(m_pCommandQueue.get(), &swapChainDesc, &pSwapChainPtr);
if(FAILED(hr))
{
getLogger().error(L"Unable to create the IDXGISwapChain.");
return false;
}
Thanks,
WFP