AutoHDR: Use display-reported peak luminance to prevent HDR clipping#14486
Open
jasaaved wants to merge 9 commits intodolphin-emu:masterfrom
Open
AutoHDR: Use display-reported peak luminance to prevent HDR clipping#14486jasaaved wants to merge 9 commits intodolphin-emu:masterfrom
jasaaved wants to merge 9 commits intodolphin-emu:masterfrom
Conversation
Query the display's HDR min/max luminance and feed those values into the post-processing pipeline and shaders. - Add SwapChain::QueryDisplayHDRCapabilities(), include dxgi1_6, and call it during swapchain creation and resize to populate g_backend_info.hdr_max_luminance_nits and hdr_min_luminance_nits. - Extend BackendInfo with hdr_max_luminance_nits and hdr_min_luminance_nits. - Add hdr_max_luminance_nits/min to the built-in uniform block and fill them in PostProcessing::FillUniformBuffer so shaders can access actual panel values. - Update AutoHDR.glsl to use the reported hdr_max_luminance_nits (with a fallback to HDR_DISPLAY_MAX_NITS) when computing the auto-HDR white scaling. This enables more accurate AutoHDR tonemapping by using the display's real luminance capabilities when available.
Obtain SDR white data from the display when it is available.
If the user hasn't set a HDR DISPLAY MAX NITS, the first time a game is launched using DirectX11 or 12, the queried display values are saved in the ini Of course user settings always take preference. But for someone that doesn't have the HDR settings set, the correct default value should be set so clipping and those bright neon/fluorescent colors can be avoided.
Perceptual HDR does not benefit from the queries we make for luminance so we can restore the default values and the original code.
If checked, display peak will always be used. Works even across different devices if ini is saved on the cloud. Or game is changed between different displays.
-Whenever the config setting for AutoHDR is loaded, the current display nits are shown on the slider. -Added some text to the checkbox clarifying DX11+ API is needed for this feature to work properly.
Also removed an old comment that no longer applies to current code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
When the HDR nit value is set higher than what a display can actually reproduce, HDR values get clipped. Because RGB channels don’t clip at the same point, this can cause hue shifts that make colors appear neon or fluorescent.
This often looks brighter or more intense at first glance, but it’s actually an artifact of clipping rather than correct HDR behavior.
This is easy to trigger since most users don’t know their display’s actual peak brightness and end up setting a value that’s too high.
This PR queries the display’s peak luminance directly from the OS on DirectX 11/12 backends and exposes it to post-processing shaders, so users don’t have to guess or manually enter it.
Changes
hdr_sdr_white_nitsBackend / Requirements
Notes
(ensures OS-reported luminance values are accurate)
Testing