Present: configure HDR swapchain color space via SetColorSpace1 (#103) #238
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!238
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/238/head"
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?
@slopgobblercobbler on GitHub · 2026-11-23 21:45 UTC · original
slopgobblercobbler:feat/present-hdr-colorspace→main· +79 −1 · 1 files · 1 commits · closed without mergingAddresses #103 Item 3 (HDR color space configuration):
Configures appropriate DXGI color spaces on HDR swapchains instead of leaving them in default SDR G22/P709:
DXGI_FORMAT_R10G10B10A2_UNORM->DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020(HDR10)DXGI_FORMAT_R16G16B16A16_FLOAT->DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709(Linear FP16 scRGB)What is in it
crates/xcl/src/hle/d3d12x/present.rs:hdr_color_space(format)mapping.IDXGISwapChain3::SetColorSpace1inensure_swapchainon creation and resize.DXGI_ERROR_UNSUPPORTEDor query failure, without interrupting presentation.hdr_color_space_format_matchingandhdr_color_space_configuration.Tested
cargo test -p xcl -- present(5 passed, 0 failed).cargo test --workspace(604 passed, 0 failed).Not tested
AI use
author-hdr,verify-hdr). Verified and reviewed independently.@MesshM on GitHub · 2026-11-24 01:02 UTC · original
Test run and review of
bc727533d8c240fa30a53bb7749881fdb47ca063on AMD (RDNA4). The branch is based on6da33fa, so I merged it onto currentmaina6f5f7alocally (clean merge, onlypresent.rs) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debug.\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4) on the merge: 678 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 638 passed, 0 failed, 21 ignored (mainon this machine: 636 / 676, the difference is the 2 new tests)SKIPPED;hdr_color_space_format_matchingandhdr_color_space_configurationpassmain; it does not name a GPU, which CONTRIBUTING asks forReview: two points I would want addressed before merging, both from reading the code
ensure_swapchain, the resize path callsResizeBuffers(…, fmt)and thenconfigure_color_space(sc, fmt). For an SDR formathdr_color_spacereturnsNone, so nothing is called and the swap chain keeps the color space set for the previous R10G10B10A2 / R16G16B16A16 format. CallingSetColorSpace1(DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709)for the SDR formats (and checkingCheckColorSpaceSupportfirst) would cover it.present.rsgets from the title whether its output is PQ-encoded, and XCL's own frame dump (rgb()in the same file) reads R10G10B10A2 as display-ready SDR values. If a title presents SDR in that format, the display would decode it as PQ and the picture would be wrong. Unless the title's color space can be taken fromPresentXor its configuration, leaving 10:10:10:2 at the default and setting HDR only when the title asks for it seems safer.Smaller points:
hdr_color_space_configurationasserts nothing on the HDR path (its two calls arelet _ =), so it passes whateverSetColorSpace1does. When the WARP device or swap chain cannot be made it returns withoutgpu::recomp::runner::skip_test(…), which CONTRIBUTING asks GPU tests to call.Not tested: no HDR display and no retail title (I have no unpacked game), so neither point was observed on screen; they come from the code paths above. No regression run, no
XCL_SAMPLE_*tests, release build.Run and review by Claude Code (Claude Opus 5.5) on this machine; each point was checked against the code.
@ivall on GitHub · 2026-11-24 11:20 UTC · original
Closing in favor of #786 for the same HDR color-space work; it also handles restoring SDR color space after a format change. This work remains unmerged. Thank you for the contribution.
Pull request closed