GPU, HLE: report host display HDR luminance and configure swap chain color space #212
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!212
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-212"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@n-romanovich on GitHub · 2026-11-24 01:28 UTC · original
n-romanovich:feat/gpu-hdr-output→main· +202 −12 · 3 files · 4 commits · openEnables HDR display detection and swap-chain color space configuration when HDR is active on the Windows host:
victory-gpu:display_hdr_info()(IDXGIOutput6::GetDesc1) returningHdrDisplayInfo { min_luminance, max_luminance, max_full_frame_luminance }when an output on the host adapter is inDXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020.Presenterto check and applyIDXGISwapChain3::SetColorSpace1(G2084_NONE_P2020forR10G10B10A2_UNORMandG10_NONE_P709forR16G16B16A16_FLOATwhen HDR is active, falling back toG22_NONE_P709otherwise).victory-hle:try_enable_hdr(XDisplayTryEnableHdrMode) to populateXDisplayHdrModeInfofromvictory_gpu::display_hdr_info()and return1(Enabled) when Windows HDR is active, or2(Disabled) in SDR.Testing
cargo clippy -p victory-gpu --lib -- -D warnings: passed (0 warnings).cargo xtask policy: passed (asset policy: 151 files ok).cargo test -p victory-hle: 86 unit tests and 1 integration test passed (includingmodules::display::tests::hdr_and_display_deferrals).@jeremygold02 on GitHub · 2026-11-24 04:59 UTC · original
Thanks @n-romanovich for adding coverage for both HDR metadata reporting and display deferral.
I tested commit
9496821b838f7b2b4c2c2885e863c253e49a4251with:The targeted test passed (1 passed, 0 failed; 85 filtered).
hdr_and_display_deferralschecks that the HLE returns HDR luminance matching the GPU host report when HDR data is available, or the documented deferral result otherwise. It also acquires and closes the display shell handle.This covers the HLE interface and capability-dependent HDR metadata branch. It does not validate swap-chain color output or a rendered title on an HDR display.
@Marvisak on GitHub · 2026-11-25 00:22 UTC · original · edited 2026-11-26 00:21 UTC
Automated triage for the maintainers.
Needs work. The rebase is clean, and the review points are addressed: the
OnceLockcache indisplay_hdr_info(), the deterministictry_enable_hdr_withtest, neutral field names incrates/victory-hle/src/modules/display.rs, and the test moved out ofmod batch. But your own live run shows the HDR path is not ready to be on by default. With Windows HDR on, the title switches toR10G10B10A2+ PQ and then crashes (0xc0000005, read0x30). The same build with Windows HDR off reaches frame 64+. With this PR, every user with HDR enabled in Windows gets that path, becausetry_enable_hdrreturns1wheneverdisplay_hdr_info()finds an HDR output.What would change the verdict:
2(SDR) as the default and put the HDR report behind an explicit opt-in until an HDR run of the title works.HdrModeInfolayout (threef32luminance values) is still assumed. Say where it comes from, for example what the title reads back from it.On your reply: the format-to-color-space mapping (
R10G10B10A2_UNORMto G2084/P2020,R16G16B16A16_FLOATto G10/P709) is the standard DXGI convention and looks right. The open question is what happens to the title once it is told HDR is on, and the run you posted answers that with a crash.CI: passing.
Generated by Claude Code
@n-romanovich on GitHub · 2026-11-25 01:00 UTC · original
@Marvisak, thank you for the review.
Rebased onto
mainas a single commit (368a1bb) and addressed the code review items:crates/victory-hle/src/modules/display.rswithout naming the console API function or struct.display_hdr_info()incrates/victory-gpu/src/host.rsnow cachesquery_display_hdr_info()in aOnceLock, andPresenter::sync_color_spacerecordsself.color_space = wantedon unsupported or failedSetColorSpace1calls as well, so DXGI is queried once at startup,try_enable_hdrandPresenteralways agree throughout a run, and unsupported outputs are not retried every frame.try_enable_hdr_withincrates/victory-hle/src/modules/display.rssohdr_and_display_deferralstests both HDR-enabled and SDR paths deterministically regardless of the host display, and addeddesired_color_space_matches_format_and_hdr_stateincrates/victory-gpu/src/host.rs.mod batch.Re-ran on Windows 11 (NVIDIA GeForce RTX 5060 Ti):
cargo test -p victory-gpu --locked -- desired_color_space_matches_format_and_hdr_state:1 passed, 0 failedcargo test -p victory-hle --locked -- hdr_and_display_deferrals:1 passed, 0 failedFor the swap-chain encoding,
DXGI_FORMAT_R10G10B10A2_UNORMmaps to HDR10 (DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020) andDXGI_FORMAT_R16G16B16A16_FLOATmaps to scRGB (DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709) per standard D3D12/DXGI swap-chain conventions; live HDR-vs-SDR title capture is not yet included in this run.@n-romanovich on GitHub · 2026-11-25 22:57 UTC · original
@Marvisak Updated
feat/gpu-hdr-output(58bdffe):desired_color_space_matches_format_and_hdr_stateout ofmod batchintomod hdr_tests(victory-gputest and CIcheckpass).Live run check on Windows 11 with HDR enabled (
#212 + #2177on NVIDIA):victory_hle::modules::displayreportsHDR mode: enabled preference=0 min=0.0014 max=1015.27 max_ff=603.70.format=24(DXGI_FORMAT_R10G10B10A2_UNORM), andvictory_gpu::hostsetscolor_space=12(DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020, PQ/BT.2020).0xc0000005atvictory.exe+0x1f4473, read0x30), whereas the same build with Windows HDR disabled reachedframe=64+without crashing, so in-game visual HDR-vs-SDR comparison is still blocked on that crash.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.