HDR: Per-mode capability detection, menu visibility, and internal shader fixes#18777
Merged
LibretroAdmin merged 2 commits intolibretro:masterfrom Feb 27, 2026
Conversation
Add separate HDR10 and scRGB support flags so the menu only shows HDR modes that the driver actually supports. Vulkan enumerates surface formats to set each flag independently; DXGI sets both when the display reports PQ/ST.2084 (Windows HDR compositor guarantees both paths). The HDR mode selector range is dynamically capped and unsupported modes are clamped at swapchain creation time.
…ning - Port Sony Megatron v2 scanline chromaticity fix to internal shaders (hdr.frag and hdr_sm5.hlsl.h): scanlines now computed in Rec.709 space to prevent chromaticity shift from per-channel beam widths - Switch internal scanline from gamma-space to linear-space to match Megatron v2 (fixes darker/narrower scanlines vs external shader) - Add scRGB mask softening warning to HDR mode sublabel
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.
Summary
VIDEO_FLAG_HDR10_SUPPORTandVIDEO_FLAG_SCRGB_SUPPORTflags so the HDR menu only shows modes the driver actually supportsvideo_driver_hdr_max_mode()— if only HDR10 is available, scRGB is hidden; if neither is available, the entire HDR menu is hiddenContext
Fixes an issue on Linux where
VK_EXT_swapchain_colorspaceis available but no HDR surface formats are enumerated, causing the menu to offer HDR modes that produce a washed-out display. Previously, the extension presence alone was enough to advertise HDR support unconditionally.The internal shader scanline fix brings hdr.frag (Vulkan) and hdr_sm5.hlsl.h (D3D11/D3D12) in line with the Sony Megatron v2 refactor: scanlines are generated in Rec.709 space using SourceSDR directly (linear), avoiding chromaticity shift and gamma-space brightness mismatch.
Files changed
gfx/video_driver.h/.c— New flags and accessor functionsgfx/common/vulkan_common.c— Per-format HDR capability scan and mode clampinggfx/common/dxgi_common.c— Set both HDR10 and scRGB flags at detection timegfx/drivers/d3d11.c,gfx/drivers/d3d12.c,gfx/drivers/vulkan.c— Clear flags on cleanupmenu/menu_setting.c— Dynamic range cap for HDR mode selectorgfx/drivers/vulkan_shaders/hdr.frag+hdr.frag.inc— Scanline chromaticity fix (Vulkan)gfx/drivers/d3d_shaders/hdr_sm5.hlsl.h— Scanline chromaticity fix (D3D11/D3D12)intl/msg_hash_us.h— scRGB mask softening warning in HDR mode sublabel