Repository navigation
D3D12.X: preserve the sRGB base with linear overlays - #2811
CryingLaughing wants to merge 4 commits into
Conversation
Select the output transfer from the opaque primary plane. A transparent UNORM overlay must preserve encoded scene colors. Cover RGBA and BGRA mixed formats and keep UNORM output when only an overlay is sRGB.
|
Regression run of Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main main: this PR: 101 % of main's frames, 97 % of its peak commit. One run each. Not tested: the suite on this head; whether the title reaches the code this PR changes in its first 60 s; AMD. AI use: Claude Code (Claude Opus 5.5) ran these runs on this machine and wrote this report. |
|
RX 9070 / Wine offscreen verification of the mixed sRGB/UNORM compositor change. Tested
Fixtures and controls Both source copies receive the same current-head blend fixture and existing single-plane fixture with the hardware selector and sample logging. An identical local clone, All production bytes remain original to each revision. Removing the documented test replacements/addition reconstructs the exact original source files. Results Three fresh serial processes per fixture/revision:
For both affected format families, stored bytes are:
The UNORM/UNORM, sRGB/sRGB and reverse UNORM-base/sRGB-overlay controls match on both. In the reverse case the fractional sample is The complete The final matrix contains 24 verified invocations. One earlier passing head module invocation was repeated with Build: Not tested Console presentation-plane transfer semantics as an independent oracle. The expected values above come from the committed test; these measurements establish the stored bytes produced by each implementation, not which interpretation of mixed UNORM/sRGB planes matches a console. Physical display/swap-chain output, HDR, overlays beyond these five synthetic cases, native Windows, other GPUs, full workspace suite, retail workload, AI use OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the stacked delta, adapted the native fixtures and all-pixel collection, ran and independently verified the paired evidence, and drafted this report. Publication authorized by the account owner. Scope wording clarified after the discussion about the console transfer assumption; no additional hardware measurements were made. |
|
Question on the mixed-format rule in present.rs:851-863 (96b0b18). With an sRGB base the RTV is sRGB, but a UNORM overlay keeps its UNORM SRV (plane_srv_format), so its bytes are sampled as linear and then sRGB-encoded on write: an opaque UNORM overlay texel of 64 is stored as ~137. Flip-model scanout treats UNORM bytes as already encoded (_SRGB only changes shader reads/writes), so I'd expect a UNORM UI plane holding 64 to stay 64. The new row (sRGB scene, UNORM UI, [0,64,0,128] -> green 161) asserts the linear reading; treating the overlay as encoded gives ~128. The opaque-overlay check uses only 255/0, which is the same in both transfers, so the tests can't see the shift. The reverse row (UNORM base, sRGB UI: 137 -> 64) darkens the overlay the same way. Before, the base was wrong in the mixed case; now the overlay is. Would sampling each plane through a view whose transfer matches the RTV (the typeless case already allows it), or blending in encoded space with UNORM views, keep both? Caveat: this assumes the console's planes scan out UNORM bytes as encoded, the way DXGI does. AI-assisted (Claude Code, Claude Opus 5.5): read the diff and the tests; nothing was run for this. |
|
The opaque midtone does distinguish the two interpretations. I ran the same five-case offscreen fixture on exact parent For an sRGB base and UNORM overlay, input The readback confirms the chosen SRV/RTV transfer on Windows. It leaves the Xbox overlay interpretation open. This GDK example sets |
Stacked on #2763, which follows #2537. The top commit
96b0b189fd0a8991c8e7883823191cf54d896223is the change under review.An UNORM overlay could force an sRGB scene to be stored as linear bytes. The primary plane already selects the SDR swap-chain format. Use it to select the compositor’s output transfer too, and keep each input plane’s own SRV format.
What is in it
present.rs.Tested
96b0b189fd0a8991c8e7883823191cf54d896223, with D3D12.X: encode sRGB compositor output for presentation #2763 head0d380f427797fb91a07512d074a5f6f4e1892674as its parent. RTX 4080 driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC and DXC 1.8.2502.11, debug.[128,55,0,255]. The native RTX 4080 fixture on the new production revision passed 1/0/0 with no capability skips over five offscreen cases. With an sRGB base and transparent UNORM overlay, it read[188,128,0,255]. A fractional overlay read[137,161,0,255]. The reverse case read[0,64,127,255]for the fractional sample. The BGRA case also passed.compositor_blends_ui_plane_over_scene_planetest passed 1/0/0.cargo build --workspace --locked -j 4succeeded.cargo test --workspace --locked -j 4 -- --test-threads=4 --show-outputreported 1,436 passed, 0 failed, 47 ignored across 37 harnesses. The pass count includes 29 capability skips.Regression run
Independent retail smoke by Anon64 compared release builds of main and this exact head on an RTX 3060 12 GB (driver 581.80), Core i9-14900KF, and Windows 11 build 26200. The 60-second runs used the same title. The head retained 101.4% of the baseline frames and used 97.7% of its peak commit, with zero crashes or device removals. The run did not establish whether the title reached the changed code.
main:
PR:
Not tested