Reputation: 519
I want to add support for 10-bit color in my DirectX C++ Windows app. I'm talking about the 10-bit per RGB channel (30-bits total for RGB) using DXGI_FORMAT_R10G10B10A2_UNORM.
How to detect if the system supports that, I mean if the display monitor actually supports this mode?
Because for example, I'm enumerating display modes list:
IDXGIOutput *output=null; for(Int i=0; OK(adapter->EnumOutputs(i, &output)); i++)
{
DXGI_FORMAT mode=DXGI_FORMAT_R10G10B10A2_UNORM;
UInt descs_elms=0; output->GetDisplayModeList(mode, 0, &descs_elms, null); // get number of mode descs
RELEASE(output);
}
And even though my laptop display doesn't support 10-bit, I still get valid results, including the list of resolutions. Later on I can create a full screen swap chain, having 10-bit, and all works OK.
However because I don't know if the monitor is 10-bit or 8-bit, then I don't know if I need to manually apply some dithering to simulate 10-bit.
So what I want to know, if the display is actually 10-bit = no dithering needed, or is it 8-bit = then I will apply my custom dithering shader.
I'm working with both classic Win32/WinAPI and the new Universal Windows Platform (so I need solution for both platforms).
Upvotes: 1
Views: 2937
Reputation: 41057
You are probably better off having some kind of user-setting to turn on/off dithering and just using DXGI_FORMAT_R10G10B10A2_UNORM
for your swapchain.
Note that DXGI_FORMAT_R10G10B10A2_UNORM
is also a valid HDR format, but requires manual application of the ST.2084 color-curve and setting the color-space appropriately to indicate the use of wide-gamut (i.e. HDR10). You could use DXGI_FORMAT_R16G16B16A16_FLOAT
and render in linear color-space, but you are leaving it up to the system to do the 'correct' thing which may or may not match your expectations.
For non-HDR/4kUHD scenarios, you can't really get anything more than 8-bit with windowed mode or UWP CoreWindows swapchains anyhow because DWM is converting you to 8-bit. 10-bit scan out for Win32 'classic' desktop apps is possible with exclusive full-screen mode but there are a lot of variables (DVI cables don't support it for example).
See High Dynamic Range and Wide Color Gamut, as well as the D3D12HDR sample Win32 / UWP
Upvotes: 3
Reputation: 37495
Figuring out whether monitor really supports 10-bit mode seems to be very tricky since a lot of of 10-bit models are actually 8-bit + dither (and a lot of 8-bit models are just 6-bit + dither). At least in some software I'm familiar with such check was implemented through white list of display models. So I think it would be better for you to always use DXGI_FORMAT_R16G16B16A16_FLOAT
(this one is probably supported by most adapters) or DXGI_FORMAT_R32G32B32A32_FLOAT
as output format and let system convert it according to display expectations. Custom dithering can be left as option for user.
Upvotes: 1