D3D12.X: encode sRGB compositor output for presentation #2763

Open
github-bot wants to merge 3 commits from github-bot/gh-2763 into main AGit
Owner

@⁠CryingLaughing on GitHub · 2026-11-26 10:57 UTC · original
CryingLaughing:fix/present-srgb-output-encoding → main · +208 −83 · 1 files · 3 commits · draft

Stacked on #2537. The follow-up is 0d380f427797fb91a07512d074a5f6f4e1892674, verified with b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 and the exact #2537 head e8d2258c5af20f108770ad8e0e983e9ecba8581e as its integration base. Part of #2456.

With concrete sRGB SRVs, the compositor reads linear values. An ordinary UNORM render target then stores those values directly, making midtones too dark on the SDR swap chain.

What is in it

  • Selects the matching sRGB RTV and pipeline state for 8-bit SDR output when every drawn plane explicitly carries sRGB. The compositor blends in linear space and stores encoded RGB.
  • Extends the compositor readback test with transparent, opaque, and fractional-alpha regions for sRGB and UNORM planes.

Tested

  • Windows 11 25H2 build 26200.9974, Intel Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 x64 MSVC, and DXC 1.8.2502.11.
  • cargo test -p xcl --lib --locked -j 4 compositor_blends_ui_plane_over_scene_plane -- --show-output --test-threads=1 passed 1/1 on this head using an offscreen RGBA8 target on WARP. The same fixture on the integration base failed at the intended assertion. The transparent pixel was [128, 55, 0, 255] before the fix and matched [188, 128, 0, 255] afterward.
  • cargo build --workspace --locked -j 4 passed. The four-thread workspace run stopped in the library harness at a_dispatch_with_a_pipeline_still_building_waits_at_the_submit with 1,309 passed, 1 failed, and 27 ignored. The compositor regression passed in that run. 25 capability skips were logged before it stopped.
  • The serial repeat, cargo test --workspace --locked -j 4 -- --test-threads=1 --show-output, finished with 1,436 passed, 0 failed, and 47 ignored across 37 harnesses. The pass count includes 29 capability skips.

Known limitation

  • A separate WARP diagnostic on this head still reproduced [128, 55, 0, 255] with a transparent UNORM UI plane over an sRGB scene. The expected pixel was [188, 128, 0, 255].

Not tested

  • Retail smoke, physical display output, BGRA8 output, and other GPU vendors remain untested.
**@⁠CryingLaughing** on GitHub · 2026-11-26 10:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/2763) `CryingLaughing:fix/present-srgb-output-encoding` → `main` · +208 −83 · 1 files · 3 commits · draft Stacked on #2537. The follow-up is `0d380f427797fb91a07512d074a5f6f4e1892674`, verified with `b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7` and the exact #2537 head `e8d2258c5af20f108770ad8e0e983e9ecba8581e` as its integration base. Part of #2456. With concrete sRGB SRVs, the compositor reads linear values. An ordinary UNORM render target then stores those values directly, making midtones too dark on the SDR swap chain. **What is in it** - Selects the matching sRGB RTV and pipeline state for 8-bit SDR output when every drawn plane explicitly carries sRGB. The compositor blends in linear space and stores encoded RGB. - Extends the compositor readback test with transparent, opaque, and fractional-alpha regions for sRGB and UNORM planes. **Tested** - Windows 11 25H2 build 26200.9974, Intel Core i5-13600K, RTX 4080 driver 621.01, Rust 1.100.0 x64 MSVC, and DXC 1.8.2502.11. - `cargo test -p xcl --lib --locked -j 4 compositor_blends_ui_plane_over_scene_plane -- --show-output --test-threads=1` passed 1/1 on this head using an offscreen RGBA8 target on WARP. The same fixture on the integration base failed at the intended assertion. The transparent pixel was `[128, 55, 0, 255]` before the fix and matched `[188, 128, 0, 255]` afterward. - `cargo build --workspace --locked -j 4` passed. The four-thread workspace run stopped in the library harness at `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` with 1,309 passed, 1 failed, and 27 ignored. The compositor regression passed in that run. 25 capability skips were logged before it stopped. - The serial repeat, `cargo test --workspace --locked -j 4 -- --test-threads=1 --show-output`, finished with 1,436 passed, 0 failed, and 47 ignored across 37 harnesses. The pass count includes 29 capability skips. **Known limitation** - A separate WARP diagnostic on this head still reproduced `[128, 55, 0, 255]` with a transparent UNORM UI plane over an sRGB scene. The expected pixel was `[188, 128, 0, 255]`. **Not tested** - Retail smoke, physical display output, BGRA8 output, and other GPU vendors remain untested.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:15:01 +00:00
Author
Owner

@⁠CryingLaughing on GitHub · 2026-11-26 11:35 UTC · original

I verified a follow-up for the mixed-format case described above. Commit 96b0b189fd0a8991c8e7883823191cf54d896223 is based on this exact draft head 0d380f427797fb91a07512d074a5f6f4e1892674. It uses the opaque base plane to choose 8-bit SDR output encoding and keeps each input plane’s own SRV format.

  • With an sRGB base and a transparent UNORM UI, the draft produced [128, 55, 0, 255] on the WARP negative control. The follow-up read back [188, 128, 0, 255] on the RTX 4080. Native checks also covered fractional-alpha UI, BGRA, and the reverse mix with a UNORM base and an sRGB UI. All five offscreen checks ran in one focused test, with 1 passed, 0 failed, 0 ignored, 0 capability skips.
  • The portable test also passed 1/0/0 on the exact follow-up commit. cargo build --workspace --locked -j 4 and cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output passed with 1,436 passed, 0 failed, 47 ignored across 37 harnesses, including 29 capability skips in the pass count.

RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC and DXC 1.8.2502.11. The native test was hle::d3d12x::present::frame_dump_tests::compositor_blends_ui_plane_over_scene_plane with an adapter-selection and readback-logging overlay. Physical display output and retail smoke remain untested.

**@⁠CryingLaughing** on GitHub · 2026-11-26 11:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/2763#issuecomment-7190916358) I verified a follow-up for the mixed-format case described above. Commit [`96b0b189fd0a8991c8e7883823191cf54d896223`](https://github.com/CryingLaughing/xcl/commit/96b0b189fd0a8991c8e7883823191cf54d896223) is based on this exact draft head `0d380f427797fb91a07512d074a5f6f4e1892674`. It uses the opaque base plane to choose 8-bit SDR output encoding and keeps each input plane’s own SRV format. - With an sRGB base and a transparent UNORM UI, the draft produced `[128, 55, 0, 255]` on the WARP negative control. The follow-up read back `[188, 128, 0, 255]` on the RTX 4080. Native checks also covered fractional-alpha UI, BGRA, and the reverse mix with a UNORM base and an sRGB UI. All five offscreen checks ran in one focused test, with **1 passed, 0 failed, 0 ignored, 0 capability skips**. - The portable test also passed **1/0/0** on the exact follow-up commit. `cargo build --workspace --locked -j 4` and `cargo test --workspace --locked -j 4 -- --test-threads=4 --show-output` passed with **1,436 passed, 0 failed, 47 ignored** across 37 harnesses, including 29 capability skips in the pass count. RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC and DXC 1.8.2502.11. The native test was `hle::d3d12x::present::frame_dump_tests::compositor_blends_ui_plane_over_scene_plane` with an adapter-selection and readback-logging overlay. Physical display output and retail smoke remain untested.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2763/head:github-bot/gh-2763'
git switch 'github-bot/gh-2763'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2763'
git switch 'github-bot/gh-2763'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2763'
git switch 'github-bot/gh-2763'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2763'
git switch 'main'
git merge --squash 'github-bot/gh-2763'
git switch 'main'
git merge --ff-only 'github-bot/gh-2763'
git switch 'main'
git merge 'github-bot/gh-2763'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.