Repository navigation
D3D12.X: preserve concrete sRGB plane formats in PresentX compositor SRVs - #2537
ramon-victor wants to merge 1 commit into
Conversation
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
|
Tested: current PR head merged onto current
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
left a comment
There was a problem hiding this comment.
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.
…cl-dev#2480 + xcl-dev#2537) (cherry picked from commit b114829419c3fb66a8c680c8bbc7cb1acbad8c19)
Preserves 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.