Skip to content

d3d11/swapchain: be strict about swapchain reported colorspace

When ACM is enabled it's important to send correct signal, else we would have double conversions and invalid end image. Ensure that proper transfer function is comunicated to libplacebo users as swapchain metadata.

Unfortunately there is no C/C++ API to query ACM status. There is WinRT CurrentAdvancedColorKind(), but it's not available for us in libplacebo.

Alternative way as duscribed in docs is to check IDXGIOutput6 output description, but this in fact works only for HDR output, where ACM is enabled implicitly. [1] That's not what we are after. Instead assume that ACM is enabled for SDR and even if it's not, the worse that can happen is that target swapchain will have specified sRGB transfer function, when previously was unknown.

libplacebo users can decide should they use this transfer function and if they ignore it, everything works as before.

This fixes SDR output when HDR mode is enabled in Windows.

[1] https://learn.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range

Merge request reports

Loading