D3D12.X: preserve concrete sRGB plane formats in PresentX compositor SRVs #2537
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!2537
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2537"
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?
@ramon-victor on GitHub · 2026-11-25 22:04 UTC · original
ramon-victor:fix/compositor-srgb-plane-srv→main· +149 −1 · 1 files · 1 commits · openPreserves concrete
*_UNORM_SRGBresource formats when creating shader-resource views for compositedPresentXplanes inCompositor::record, resolving only*_TYPELESSformats to concrete SRV formats.Previously
Compositor::recordpassedswap_format(desc.Format).unwrap_or(desc.Format)toCreateShaderResourceView. Becauseswap_formatmapsDXGI_FORMAT_R8G8B8A8_UNORM_SRGBandDXGI_FORMAT_B8G8R8A8_UNORM_SRGBto*_UNORMfor flip-model swap-chain creation, concrete sRGB plane textures received an invalid non-sRGB SRV format (CREATESHADERRESOURCEVIEW_INVALIDFORMATin D3D12) and skipped sRGB-to-linear decoding on WARP.Part of #2456 (specifically the sRGB plane SRV format issue left open by #2480).
What is in it
crates/xcl/src/hle/d3d12x/present.rs:plane_srv_format(f)resolving only*_TYPELESSformats (R8G8B8A8_TYPELESS,B8G8R8A8_TYPELESS,R10G10B10A2_TYPELESS,R16G16B16A16_TYPELESS) to concrete SRV formats while preserving concrete formats (including*_UNORM_SRGB).plane_srv_format(desc.Format)inCompositor::recordwhen buildingD3D12_SHADER_RESOURCE_VIEW_DESC.frame_dump_tests::compositor_preserves_concrete_srgb_plane_srv_formatverifyingplane_srv_formatacross concrete sRGB, typeless, and UNORM/float formats and exercisingCompositor::recordon WARP with a concreteDXGI_FORMAT_R8G8B8A8_UNORM_SRGBplane texture.Tested
621.24, wave32), AMD Ryzen 7 5700X, 32 GiB RAM, Windows 11 Pro (26300),rustc 1.99.0(x86_64-pc-windows-msvc), DXC/DXIL1.8.2502.11(Windows SDK10.0.26100.0).cargo test -p xcl --lib compositor_preserves_concrete_srgb_plane_srv_format -- --nocapturefailed (0 passed, 1 failed:expected sRGB-decoded concrete plane sample ~[128, 55, 0, 255], got [188, 128, 0, 255]).cargo test -p xcl --lib hle::d3d12x::present -- --test-threads=1 --nocapture:10 passed, 0 failed, 0 ignored..\scripts\test.ps1, debug):1424 passed, 0 failed, 46 ignored(skipped on this adapter: wave64-only GPU tests, unsupported per-lane semantics variants,no heap windows).cargo build --release -p xcl) and clean 60 s retail smoke run (.\scripts\smoke.ps1).Regression run
Baseline (
main):PR (
e8d2258):Not tested
*_UNORM_SRGBplanes (the retail smoke title presents a single plane; multi-plane concrete sRGB compositing is covered by the WARP regression test).AI use
plane_srv_formatand its WARP regression test, ran.\scripts\test.ps1, release build, and the 60 ssmoke.ps1run, and drafted this PR description.@DavidM1911 on GitHub · 2026-11-25 22:17 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@emirduran707 on GitHub · 2026-11-25 22:24 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
e8d2258c5af20f108770ad8e0e983e9ecba8581e(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1422 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.hle::d3d12x::present::frame_dump_tests::compositor_preserves_concrete_srgb_plane_srv_format.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@SlopTart on GitHub · 2026-11-25 23:24 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
compositor_preserves_concrete_srgb_plane_srv_format: passed.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@luckyteagirl on GitHub · 2026-11-26 07:04 UTC · original · reviewed
Could the compositor re-encode its linear result for the SDR swap chain? This change correctly decodes a concrete sRGB plane through its SRV, but the compositor shader writes the linear sample directly to the UNORM RTV/PSO selected by
swap_format. The swap chain still presents those integer bytes as sRGB. For an opaque midtone encoded as 188, the new test expects about 128 in the UNORM target; that is the decoded linear value, so a real SDR presentation would appear darker. The test confirms decoding but not the display-space round trip.A two-plane case with an opaque sRGB base and a transparent overlay could compare the presented color with the existing single-plane copy path. Microsoft's color-space guidance says that linear shader output must be converted back to sRGB for integer screen presentation, for example through an sRGB RTV. Exact-head source review of
e8d2258c5af20f108770ad8e0e983e9ecba8581e; I did not run a display capture or title. AI-assisted review with Codex.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.