D3D12.X: preserve concrete sRGB plane formats in PresentX compositor SRVs #2527

Open
ramon-victor wants to merge 1 commit from upstream-pr/2537 into main
ramon-victor commented 2026-11-25 22:04:56 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ramon-victor on 2026-11-25T22:04:56Z.


Preserves concrete *_UNORM_SRGB resource formats when creating shader-resource views for composited PresentX planes in Compositor::record, resolving only *_TYPELESS formats to concrete SRV formats.

Previously Compositor::record passed swap_format(desc.Format).unwrap_or(desc.Format) to CreateShaderResourceView. Because swap_format maps DXGI_FORMAT_R8G8B8A8_UNORM_SRGB and DXGI_FORMAT_B8G8R8A8_UNORM_SRGB to *_UNORM for flip-model swap-chain creation, concrete sRGB plane textures received an invalid non-sRGB SRV format (CREATESHADERRESOURCEVIEW_INVALIDFORMAT in 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:
    • Add plane_srv_format(f) resolving only *_TYPELESS formats (R8G8B8A8_TYPELESS, B8G8R8A8_TYPELESS, R10G10B10A2_TYPELESS, R16G16B16A16_TYPELESS) to concrete SRV formats while preserving concrete formats (including *_UNORM_SRGB).
    • Use plane_srv_format(desc.Format) in Compositor::record when building D3D12_SHADER_RESOURCE_VIEW_DESC.
    • Add frame_dump_tests::compositor_preserves_concrete_srgb_plane_srv_format verifying plane_srv_format across concrete sRGB, typeless, and UNORM/float formats and exercising Compositor::record on WARP with a concrete DXGI_FORMAT_R8G8B8A8_UNORM_SRGB plane texture.

Tested

  • Hardware / toolchain: NVIDIA GeForce RTX 3070 8 GiB (driver 621.24, wave32), AMD Ryzen 7 5700X, 32 GiB RAM, Windows 11 Pro (26300), rustc 1.99.0 (x86_64-pc-windows-msvc), DXC/DXIL 1.8.2502.11 (Windows SDK 10.0.26100.0).
  • Failing-first before fix: cargo test -p xcl --lib compositor_preserves_concrete_srgb_plane_srv_format -- --nocapture failed (0 passed, 1 failed: expected sRGB-decoded concrete plane sample ~[128, 55, 0, 255], got [188, 128, 0, 255]).
  • After fix: cargo test -p xcl --lib hle::d3d12x::present -- --test-threads=1 --nocapture: 10 passed, 0 failed, 0 ignored.
  • Full workspace suite (.\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).
  • Release build (cargo build --release -p xcl) and clean 60 s retail smoke run (.\scripts\smoke.ps1).

Regression run

Baseline (main):

xcl-smoke v1
commit: f087b998d0d51a9f11bbfa0761967a63e778edd9
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14467 MB

PR (e8d2258):

xcl-smoke v1
commit: e8d2258c5af20f108770ad8e0e983e9ecba8581e
gpu: NVIDIA GeForce RTX 3070
title: 3c290c16
seconds: 60
exit: 0x0
frames shown: 1622 (PresentX 1622)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14037 MB

Not tested

  • Multi-plane retail title with concrete *_UNORM_SRGB planes (the retail smoke title presents a single plane; multi-plane concrete sRGB compositing is covered by the WARP regression test).
  • AMD / Intel GPUs and Wine / macOS hosts.

AI use

  • Antigravity (Gemini 4 Neon): analyzed #2456 item 2, implemented plane_srv_format and its WARP regression test, ran .\scripts\test.ps1, release build, and the 60 s smoke.ps1 run, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5499966265 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537). Originally posted by [ramon-victor](https://github.com/ramon-victor) on 2026-11-25T22:04:56Z. --- Preserves concrete `*_UNORM_SRGB` resource formats when creating shader-resource views for composited `PresentX` planes in `Compositor::record`, resolving only `*_TYPELESS` formats to concrete SRV formats. Previously `Compositor::record` passed `swap_format(desc.Format).unwrap_or(desc.Format)` to `CreateShaderResourceView`. Because `swap_format` maps `DXGI_FORMAT_R8G8B8A8_UNORM_SRGB` and `DXGI_FORMAT_B8G8R8A8_UNORM_SRGB` to `*_UNORM` for flip-model swap-chain creation, concrete sRGB plane textures received an invalid non-sRGB SRV format (`CREATESHADERRESOURCEVIEW_INVALIDFORMAT` in 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`: - Add `plane_srv_format(f)` resolving only `*_TYPELESS` formats (`R8G8B8A8_TYPELESS`, `B8G8R8A8_TYPELESS`, `R10G10B10A2_TYPELESS`, `R16G16B16A16_TYPELESS`) to concrete SRV formats while preserving concrete formats (including `*_UNORM_SRGB`). - Use `plane_srv_format(desc.Format)` in `Compositor::record` when building `D3D12_SHADER_RESOURCE_VIEW_DESC`. - Add `frame_dump_tests::compositor_preserves_concrete_srgb_plane_srv_format` verifying `plane_srv_format` across concrete sRGB, typeless, and UNORM/float formats and exercising `Compositor::record` on WARP with a concrete `DXGI_FORMAT_R8G8B8A8_UNORM_SRGB` plane texture. **Tested** - Hardware / toolchain: NVIDIA GeForce RTX 3070 8 GiB (driver `621.24`, wave32), AMD Ryzen 7 5700X, 32 GiB RAM, Windows 11 Pro (`26300`), `rustc 1.99.0` (`x86_64-pc-windows-msvc`), DXC/DXIL `1.8.2502.11` (Windows SDK `10.0.26100.0`). - Failing-first before fix: `cargo test -p xcl --lib compositor_preserves_concrete_srgb_plane_srv_format -- --nocapture` failed (`0 passed, 1 failed`: `expected sRGB-decoded concrete plane sample ~[128, 55, 0, 255], got [188, 128, 0, 255]`). - After fix: `cargo test -p xcl --lib hle::d3d12x::present -- --test-threads=1 --nocapture`: `10 passed, 0 failed, 0 ignored`. - Full workspace suite (`.\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`). - Release build (`cargo build --release -p xcl`) and clean 60 s retail smoke run (`.\scripts\smoke.ps1`). **Regression run** Baseline (`main`): ``` xcl-smoke v1 commit: f087b998d0d51a9f11bbfa0761967a63e778edd9 gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14467 MB ``` PR (`e8d2258`): ``` xcl-smoke v1 commit: e8d2258c5af20f108770ad8e0e983e9ecba8581e gpu: NVIDIA GeForce RTX 3070 title: 3c290c16 seconds: 60 exit: 0x0 frames shown: 1622 (PresentX 1622) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14037 MB ``` **Not tested** - Multi-plane retail title with concrete `*_UNORM_SRGB` planes (the retail smoke title presents a single plane; multi-plane concrete sRGB compositing is covered by the WARP regression test). - AMD / Intel GPUs and Wine / macOS hosts. **AI use** - Antigravity (Gemini 4 Neon): analyzed #2456 item 2, implemented `plane_srv_format` and its WARP regression test, ran `.\scripts\test.ps1`, release build, and the 60 s `smoke.ps1` run, and drafted this PR description.
DavidM1911 commented 2026-11-25 23:09:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T22:17:49Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7176184663 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7176184663). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T22:17:49Z. --- 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 commented 2026-11-25 23:09:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by emirduran707 on 2026-11-25T22:24:19Z.


Independent AMD RDNA4 (native wave64) test report on exact head e8d2258c5af20f108770ad8e0e983e9ecba8581e (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (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 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused 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.
    • The PR's test passed: hle::d3d12x::present::frame_dump_tests::compositor_preserves_concrete_srgb_plane_srv_format.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: e8d2258c5af20f108770ad8e0e983e9ecba8581e
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1591 (PresentX 1591)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13937 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7176320499 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7176320499). Originally posted by [emirduran707](https://github.com/emirduran707) on 2026-11-25T22:24:19Z. --- Independent AMD RDNA4 (native wave64) test report on exact head `e8d2258c5af20f108770ad8e0e983e9ecba8581e` (clean detached checkout, no local changes). **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (`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 in `lower_dxil::tests::{f16,f32}_programs_on_the_gpu` refused 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. - The PR's test passed: `hle::d3d12x::present::frame_dump_tests::compositor_preserves_concrete_srgb_plane_srv_format`. - The 2 failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` seed 722 and `fuzz_validate_and_gpu_3` seed 1599) are pre-existing on unmodified `main` on this GPU. **Regression run** (60 s retail-title smoke, `XCL_NETWORK=0`, release) ``` xcl-smoke v1 commit: e8d2258c5af20f108770ad8e0e983e9ecba8581e gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1591 (PresentX 1591) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13937 MB ``` (Matched `main` `68a284a` baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.) **Not tested** - D3D12 debug layer; Intel GPUs. **AI use** - Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
SlopTart commented 2026-11-26 00:05:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-25T23:24:52Z.


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 target x86_64-pc-windows-gnu run 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.

<!-- greyfinch-sync:ivall/xcl:comment:7177526692 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7177526692). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-25T23:24:52Z. --- **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 target `x86_64-pc-windows-gnu` run 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 commented 2026-11-26 07:04:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T07:04:33Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:ivall/xcl:review:6069815489 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#pullrequestreview-6069815489). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T07:04:33Z. **Review:** COMMENTED --- 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](https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/converting-data-color-space) 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.
Decodere commented 2026-11-27 03:05:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T03:05:06Z.


Independent desktop NVIDIA verification of PR #2537 at head e8d2258c5af20f108770ad8e0e983e9ecba8581e (1 commit; exact parent & merge-base: 6d12f58a229bc73889878a448c64dc3af25eeba0, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (e8d2258c)

Command Result
cargo test --release -p xcl --lib compositor_preserves_concrete_srgb_plane_srv_format -- --nocapture (3 consecutive runs) 1 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.02s × 3, 0 skipped)
cargo test --release -p xcl --lib hle::d3d12x::present:: -- --test-threads=1 (3 consecutive runs) 10 passed; 0 failed; 0 ignored; 1315 filtered out × 3 (0.05s × 3, 0 skipped)
cargo build --release -p xcl Clean build (1m 11s, exit 0, 0 new warnings)

Paired quiet 60 s retail smoke (title: 29640639)

Exact parent & merge-base (6d12f58a229bc73889878a448c64dc3af25eeba0, cached baseline on the same machine):

xcl-smoke v1
commit: 6d12f58a229bc73889878a448c64dc3af25eeba0
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1606 (PresentX 1606)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14004 MB

PR #2537 (e8d2258c5af20f108770ad8e0e983e9ecba8581e):

xcl-smoke v1
commit: e8d2258c5af20f108770ad8e0e983e9ecba8581e
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1588 (PresentX 1589)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13973 MB

Runtime log observations (xcl.log)

  • 9219 log lines, 0 [ERROR] / device-removal / panic lines.
  • Final draw/memory telemetry in log: 19564 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample 13973 MB committed by the process; video memory 6116 MB local, 4651 MB non-local.

Limits of coverage

  • Preserving concrete sRGB plane formats in PresentX compositor SRV descriptors was verified via compositor_preserves_concrete_srgb_plane_srv_format (3/3) and hle::d3d12x::present:: (10/10 × 3, 0 skipped).
  • The 60 s retail smoke on title: 29640639 exercises live PresentX presentation (1588 frames shown, 1589 PresentX calls) with zero device removals or crashes (frame-count delta vs. cached parent reflects single-run startup variance, not this PR); visual pixel-level sRGB/SDR/HDR colorimetry inspection of an sRGB plane title was not performed here.

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7208691578 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7208691578). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-27T03:05:06Z. --- Independent desktop NVIDIA verification of **PR #2537** at head `e8d2258c5af20f108770ad8e0e983e9ecba8581e` (`1` commit; exact parent & merge-base: `6d12f58a229bc73889878a448c64dc3af25eeba0`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted release tests & build (`e8d2258c`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib compositor_preserves_concrete_srgb_plane_srv_format -- --nocapture` (3 consecutive runs) | `1 passed; 0 failed; 0 ignored; 1324 filtered out` × 3 (`0.02s` × 3, `0` skipped) | | `cargo test --release -p xcl --lib hle::d3d12x::present:: -- --test-threads=1` (3 consecutive runs) | `10 passed; 0 failed; 0 ignored; 1315 filtered out` × 3 (`0.05s` × 3, `0` skipped) | | `cargo build --release -p xcl` | Clean build (`1m 11s`, exit `0`, `0` new warnings) | ### Paired quiet 60 s retail smoke (`title: 29640639`) Exact parent & merge-base (`6d12f58a229bc73889878a448c64dc3af25eeba0`, cached baseline on the same machine): ``` xcl-smoke v1 commit: 6d12f58a229bc73889878a448c64dc3af25eeba0 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1606 (PresentX 1606) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14004 MB ``` PR #2537 (`e8d2258c5af20f108770ad8e0e983e9ecba8581e`): ``` xcl-smoke v1 commit: e8d2258c5af20f108770ad8e0e983e9ecba8581e gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1588 (PresentX 1589) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13973 MB ``` ### Runtime log observations (`xcl.log`) - `9219` log lines, `0` `[ERROR]` / device-removal / panic lines. - Final draw/memory telemetry in log: `19564 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped)`; last memory sample `13973 MB committed by the process; video memory 6116 MB local, 4651 MB non-local`. ### Limits of coverage - Preserving concrete sRGB plane formats in `PresentX` compositor SRV descriptors was verified via `compositor_preserves_concrete_srgb_plane_srv_format` (`3/3`) and `hle::d3d12x::present::` (`10/10` × 3, `0` skipped). - The 60 s retail smoke on `title: 29640639` exercises live `PresentX` presentation (`1588` frames shown, `1589` `PresentX` calls) with zero device removals or crashes (frame-count delta vs. cached parent reflects single-run startup variance, not this PR); visual pixel-level sRGB/SDR/HDR colorimetry inspection of an sRGB plane title was not performed here. *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
thehollowedone commented 2026-11-28 10:32:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T10:32:28Z.


Follow-up to the sRGB output review, checked against head e8d2258.

I changed the WARP fixture to use two opaque copies of the same concrete sRGB plane, which is the path that invokes Compositor::record in present_now. The current PR produced [128, 55, 0, 255] from source bytes [188, 128, 0, 255]; the single-plane copy path preserves the source bytes. This reproduces a visible display-space change when a second plane appears. The revised test failed before the local fix (0 passed, 1 failed) and passed afterward (1 passed, 0 failed).

One bounded correction is to keep the existing encoded-domain UNORM blend, while re-encoding the RGB sampled through a concrete sRGB SRV when writing to an integer SDR target. Set the decision per plane; keep alpha unchanged and leave FP16 output linear. The local candidate below restored [188, 128, 0, 255] on WARP. It also keeps the existing UNORM blend test passing. This preserves the compositor's current behavior; it does not establish a full linear-light color-management contract for mixed planes. In particular, this shader pow path still needs a full-screen GPU cost check, and BGRA, R10, FP16, and mixed-format image cases need GPU readback coverage before adopting it as the final implementation. A hardware sRGB RTV approach could avoid the shader transfer cost, but its mixed-plane blend semantics need the same review.

Local checks on Windows 11 build 26300, RTX 3080 Ti 621.35, Ryzen 7 9800X3D, DXC 1.8.2502.11: cargo build --offline --locked -j 4 --workspace passed; cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::present -- --test-threads=1 had 10 passed, 0 failed; the full workspace run had 1,423 passed, 1 failed, 46 ignored, with 25 GPU skip notices. The sole failure was console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, outside this diff. This was an uncommitted local candidate; no paired title smoke or full-screen timing was run on it. If applied to the PR, its head needs new clean-commit smoke blocks under the repository rules.

Tested candidate diff against #2537 head
diff --git a/crates/xcl/src/hle/d3d12x/present.rs b/crates/xcl/src/hle/d3d12x/present.rs
index ef778cd9..fcfec040 100644
--- a/crates/xcl/src/hle/d3d12x/present.rs
+++ b/crates/xcl/src/hle/d3d12x/present.rs
@@ -289,6 +289,12 @@ fn plane_srv_format(f: DXGI_FORMAT) -> DXGI_FORMAT {
     }
 }
 
+fn encode_srgb_for_output(src: DXGI_FORMAT, dst: DXGI_FORMAT) -> bool {
+    let integer_sdr = matches!(dst, DXGI_FORMAT_R8G8B8A8_UNORM | DXGI_FORMAT_B8G8R8A8_UNORM | DXGI_FORMAT_R10G10B10A2_UNORM);
+    let srgb_source = matches!(src, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB | DXGI_FORMAT_B8G8R8A8_UNORM_SRGB);
+    integer_sdr && srgb_source
+}
+
 unsafe fn backbuffer_like(res: usize) -> Option<D3D12_RESOURCE_DESC> {
     let raw = res as *mut c_void;
     let r = ID3D12Resource::from_raw_borrowed(&raw)?;
@@ -715,8 +721,15 @@ fn compositor_shaders() -> Option<&'static (Vec<u8>, Vec<u8>)> {
         let ps = compile_fx(
             "Texture2D tex : register(t0);\n\
              SamplerState smp : register(s0);\n\
+             cbuffer Encode : register(b1) { uint encode_srgb; };\n\
              float4 main(float4 pos : SV_Position, float2 uv : TEXCOORD0) : SV_Target {\n\
-                 return tex.Sample(smp, uv);\n\
+                 float4 c = tex.Sample(smp, uv);\n\
+                 if (encode_srgb != 0) {\n\
+                     float3 lo = 12.92 * c.rgb;\n\
+                     float3 hi = 1.055 * pow(max(c.rgb, 0.0), 1.0 / 2.4) - 0.055;\n\
+                     c.rgb = (c.rgb <= 0.0031308) ? lo : hi;\n\
+                 }\n\
+                 return c;\n\
              }",
             "ps_5_0",
         )?;
@@ -757,6 +770,13 @@ impl Compositor {
                 },
                 ShaderVisibility: D3D12_SHADER_VISIBILITY_PIXEL,
             },
+            D3D12_ROOT_PARAMETER {
+                ParameterType: D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS,
+                Anonymous: D3D12_ROOT_PARAMETER_0 {
+                    Constants: D3D12_ROOT_CONSTANTS { ShaderRegister: 1, RegisterSpace: 0, Num32BitValues: 1 },
+                },
+                ShaderVisibility: D3D12_SHADER_VISIBILITY_PIXEL,
+            },
         ];
         let sampler = D3D12_STATIC_SAMPLER_DESC {
             Filter: D3D12_FILTER_MIN_MAG_MIP_LINEAR,
@@ -886,9 +906,10 @@ impl Compositor {
         list.SetDescriptorHeaps(&[Some(self.srv_heap.clone())]);
         list.IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
         let srv_gpu_base = self.srv_heap.GetGPUDescriptorHandleForHeapStart();
-        for (i, (_, _, uv_rect)) in planes.iter().take(MAX_PLANES).enumerate() {
+        for (i, (_, desc, uv_rect)) in planes.iter().take(MAX_PLANES).enumerate() {
             list.SetPipelineState(if i == 0 { &opaque_pso } else { &blend_pso });
             list.SetGraphicsRoot32BitConstants(0, 4, uv_rect.as_ptr() as *const c_void, 0);
+            list.SetGraphicsRoot32BitConstant(2, u32::from(encode_srgb_for_output(desc.Format, dst_fmt)), 0);
             let mut gpu = srv_gpu_base;
             gpu.ptr += ((first + i) as u64) * (self.srv_inc as u64);
             list.SetGraphicsRootDescriptorTable(1, gpu);
@@ -1842,6 +1863,10 @@ mod frame_dump_tests {
 
     #[test]
     fn compositor_preserves_concrete_srgb_plane_srv_format() {
+        assert!(encode_srgb_for_output(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM));
+        assert!(encode_srgb_for_output(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, DXGI_FORMAT_R10G10B10A2_UNORM));
+        assert!(!encode_srgb_for_output(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM));
+        assert!(!encode_srgb_for_output(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R16G16B16A16_FLOAT));
         assert_eq!(plane_srv_format(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB), DXGI_FORMAT_R8G8B8A8_UNORM_SRGB);
         assert_eq!(plane_srv_format(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB), DXGI_FORMAT_B8G8R8A8_UNORM_SRGB);
         assert_eq!(plane_srv_format(DXGI_FORMAT_R8G8B8A8_TYPELESS), DXGI_FORMAT_R8G8B8A8_UNORM);
@@ -1948,7 +1973,12 @@ mod frame_dump_tests {
                 transition(&out, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_RENDER_TARGET),
             ]);
 
-            let planes = [(srgb.clone(), srgb.GetDesc(), [0.0, 0.0, 1.0, 1.0])];
+            // Two planes select the compositor in present_now; an opaque second copy of the
+            // same texture must still preserve the bytes of the single-plane copy path.
+            let planes = [
+                (srgb.clone(), srgb.GetDesc(), [0.0, 0.0, 1.0, 1.0]),
+                (srgb.clone(), srgb.GetDesc(), [0.0, 0.0, 1.0, 1.0]),
+            ];
             assert!(comp.record(&dev, &list, &out, 4, 4, DXGI_FORMAT_R8G8B8A8_UNORM, &planes, 0));
             list.ResourceBarrier(&[transition(&out, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE)]);
             let out_desc = out.GetDesc();
@@ -1966,11 +1996,11 @@ mod frame_dump_tests {
             let px = std::slice::from_raw_parts((rp as *const u8).add(off), 4);
             let got = [px[0], px[1], px[2], px[3]];
             rb.Unmap(0, None);
-            // Concrete R8G8B8A8_UNORM_SRGB sampled with an sRGB SRV decodes sRGB -> linear
-            // (~[128, 55, 0, 255]), whereas forcing UNORM fails SRV creation or skips sRGB decode.
+            // The compositor must leave an opaque sRGB plane at the same display-space value
+            // as the single-plane copy path, despite the sRGB SRV decoding the source.
             assert!(
-                (125..=131).contains(&got[0]) && (52..=58).contains(&got[1]) && got[2] == 0 && got[3] == 255,
-                "expected sRGB-decoded concrete plane sample ~[128, 55, 0, 255], got {got:?}"
+                (187..=189).contains(&got[0]) && (127..=129).contains(&got[1]) && got[2] == 0 && got[3] == 255,
+                "expected display-space parity with a single-plane copy ~[188, 128, 0, 255], got {got:?}"
             );
         }
     }

AI use: Codex (GPT-6.2 Sol) wrote and ran the local candidate and drafted this report; Codex (GPT-6.2 Astra) independently reviewed the color-space and blending choices.

<!-- greyfinch-sync:ivall/xcl:comment:7237962495 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7237962495). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-28T10:32:28Z. --- Follow-up to the [sRGB output review](https://github.com/xcl-dev/xcl/pull/2537#pullrequestreview-6069815489), checked against head [`e8d2258`](https://github.com/xcl-dev/xcl/commit/e8d2258c5af20f108770ad8e0e983e9ecba8581e). I changed the WARP fixture to use **two opaque copies of the same concrete sRGB plane**, which is the path that invokes `Compositor::record` in `present_now`. The current PR produced `[128, 55, 0, 255]` from source bytes `[188, 128, 0, 255]`; the single-plane copy path preserves the source bytes. This reproduces a visible display-space change when a second plane appears. The revised test failed before the local fix (0 passed, 1 failed) and passed afterward (1 passed, 0 failed). One bounded correction is to keep the existing encoded-domain UNORM blend, while re-encoding the RGB sampled through a concrete sRGB SRV when writing to an integer SDR target. Set the decision per plane; keep alpha unchanged and leave FP16 output linear. The local candidate below restored `[188, 128, 0, 255]` on WARP. It also keeps the existing UNORM blend test passing. This preserves the compositor's current behavior; it does not establish a full linear-light color-management contract for mixed planes. In particular, this shader `pow` path still needs a full-screen GPU cost check, and BGRA, R10, FP16, and mixed-format image cases need GPU readback coverage before adopting it as the final implementation. A hardware sRGB RTV approach could avoid the shader transfer cost, but its mixed-plane blend semantics need the same review. Local checks on Windows 11 build 26300, RTX 3080 Ti 621.35, Ryzen 7 9800X3D, DXC 1.8.2502.11: `cargo build --offline --locked -j 4 --workspace` passed; `cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::present -- --test-threads=1` had 10 passed, 0 failed; the full workspace run had 1,423 passed, 1 failed, 46 ignored, with 25 GPU skip notices. The sole failure was `console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk`, outside this diff. This was an uncommitted local candidate; no paired title smoke or full-screen timing was run on it. If applied to the PR, its head needs new clean-commit smoke blocks under the repository rules. <details><summary>Tested candidate diff against #2537 head</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/present.rs b/crates/xcl/src/hle/d3d12x/present.rs index ef778cd9..fcfec040 100644 --- a/crates/xcl/src/hle/d3d12x/present.rs +++ b/crates/xcl/src/hle/d3d12x/present.rs @@ -289,6 +289,12 @@ fn plane_srv_format(f: DXGI_FORMAT) -> DXGI_FORMAT { } } +fn encode_srgb_for_output(src: DXGI_FORMAT, dst: DXGI_FORMAT) -> bool { + let integer_sdr = matches!(dst, DXGI_FORMAT_R8G8B8A8_UNORM | DXGI_FORMAT_B8G8R8A8_UNORM | DXGI_FORMAT_R10G10B10A2_UNORM); + let srgb_source = matches!(src, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB | DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); + integer_sdr && srgb_source +} + unsafe fn backbuffer_like(res: usize) -> Option<D3D12_RESOURCE_DESC> { let raw = res as *mut c_void; let r = ID3D12Resource::from_raw_borrowed(&raw)?; @@ -715,8 +721,15 @@ fn compositor_shaders() -> Option<&'static (Vec<u8>, Vec<u8>)> { let ps = compile_fx( "Texture2D tex : register(t0);\n\ SamplerState smp : register(s0);\n\ + cbuffer Encode : register(b1) { uint encode_srgb; };\n\ float4 main(float4 pos : SV_Position, float2 uv : TEXCOORD0) : SV_Target {\n\ - return tex.Sample(smp, uv);\n\ + float4 c = tex.Sample(smp, uv);\n\ + if (encode_srgb != 0) {\n\ + float3 lo = 12.92 * c.rgb;\n\ + float3 hi = 1.055 * pow(max(c.rgb, 0.0), 1.0 / 2.4) - 0.055;\n\ + c.rgb = (c.rgb <= 0.0031308) ? lo : hi;\n\ + }\n\ + return c;\n\ }", "ps_5_0", )?; @@ -757,6 +770,13 @@ impl Compositor { }, ShaderVisibility: D3D12_SHADER_VISIBILITY_PIXEL, }, + D3D12_ROOT_PARAMETER { + ParameterType: D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS, + Anonymous: D3D12_ROOT_PARAMETER_0 { + Constants: D3D12_ROOT_CONSTANTS { ShaderRegister: 1, RegisterSpace: 0, Num32BitValues: 1 }, + }, + ShaderVisibility: D3D12_SHADER_VISIBILITY_PIXEL, + }, ]; let sampler = D3D12_STATIC_SAMPLER_DESC { Filter: D3D12_FILTER_MIN_MAG_MIP_LINEAR, @@ -886,9 +906,10 @@ impl Compositor { list.SetDescriptorHeaps(&[Some(self.srv_heap.clone())]); list.IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); let srv_gpu_base = self.srv_heap.GetGPUDescriptorHandleForHeapStart(); - for (i, (_, _, uv_rect)) in planes.iter().take(MAX_PLANES).enumerate() { + for (i, (_, desc, uv_rect)) in planes.iter().take(MAX_PLANES).enumerate() { list.SetPipelineState(if i == 0 { &opaque_pso } else { &blend_pso }); list.SetGraphicsRoot32BitConstants(0, 4, uv_rect.as_ptr() as *const c_void, 0); + list.SetGraphicsRoot32BitConstant(2, u32::from(encode_srgb_for_output(desc.Format, dst_fmt)), 0); let mut gpu = srv_gpu_base; gpu.ptr += ((first + i) as u64) * (self.srv_inc as u64); list.SetGraphicsRootDescriptorTable(1, gpu); @@ -1842,6 +1863,10 @@ mod frame_dump_tests { #[test] fn compositor_preserves_concrete_srgb_plane_srv_format() { + assert!(encode_srgb_for_output(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM)); + assert!(encode_srgb_for_output(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, DXGI_FORMAT_R10G10B10A2_UNORM)); + assert!(!encode_srgb_for_output(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM)); + assert!(!encode_srgb_for_output(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R16G16B16A16_FLOAT)); assert_eq!(plane_srv_format(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB), DXGI_FORMAT_R8G8B8A8_UNORM_SRGB); assert_eq!(plane_srv_format(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB), DXGI_FORMAT_B8G8R8A8_UNORM_SRGB); assert_eq!(plane_srv_format(DXGI_FORMAT_R8G8B8A8_TYPELESS), DXGI_FORMAT_R8G8B8A8_UNORM); @@ -1948,7 +1973,12 @@ mod frame_dump_tests { transition(&out, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_RENDER_TARGET), ]); - let planes = [(srgb.clone(), srgb.GetDesc(), [0.0, 0.0, 1.0, 1.0])]; + // Two planes select the compositor in present_now; an opaque second copy of the + // same texture must still preserve the bytes of the single-plane copy path. + let planes = [ + (srgb.clone(), srgb.GetDesc(), [0.0, 0.0, 1.0, 1.0]), + (srgb.clone(), srgb.GetDesc(), [0.0, 0.0, 1.0, 1.0]), + ]; assert!(comp.record(&dev, &list, &out, 4, 4, DXGI_FORMAT_R8G8B8A8_UNORM, &planes, 0)); list.ResourceBarrier(&[transition(&out, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE)]); let out_desc = out.GetDesc(); @@ -1966,11 +1996,11 @@ mod frame_dump_tests { let px = std::slice::from_raw_parts((rp as *const u8).add(off), 4); let got = [px[0], px[1], px[2], px[3]]; rb.Unmap(0, None); - // Concrete R8G8B8A8_UNORM_SRGB sampled with an sRGB SRV decodes sRGB -> linear - // (~[128, 55, 0, 255]), whereas forcing UNORM fails SRV creation or skips sRGB decode. + // The compositor must leave an opaque sRGB plane at the same display-space value + // as the single-plane copy path, despite the sRGB SRV decoding the source. assert!( - (125..=131).contains(&got[0]) && (52..=58).contains(&got[1]) && got[2] == 0 && got[3] == 255, - "expected sRGB-decoded concrete plane sample ~[128, 55, 0, 255], got {got:?}" + (187..=189).contains(&got[0]) && (127..=129).contains(&got[1]) && got[2] == 0 && got[3] == 255, + "expected display-space parity with a single-plane copy ~[188, 128, 0, 255], got {got:?}" ); } } ``` </details> AI use: Codex (GPT-6.2 Sol) wrote and ran the local candidate and drafted this report; Codex (GPT-6.2 Astra) independently reviewed the color-space and blending choices.
throny commented 2026-11-28 13:38:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T13:38:57Z.


merge-check claim
head: e8d2258c5a

<!-- greyfinch-sync:ivall/xcl:comment:7240085660 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7240085660). Originally posted by [throny](https://github.com/throny) on 2026-11-28T13:38:57Z. --- merge-check claim head: e8d2258c5af20f108770ad8e0e983e9ecba8581e
throny commented 2026-11-28 13:55:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T13:55:07Z.


merge-check
base: e13d6250
head: e8d2258c5a
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2131 passed, 10 failed, 48 ignored (26 SKIPPED lines). The 10 failures are the ones main itself has at e13d6250 on this GPU (#3093: the nine since #2959 and, since today, gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions), the same set with and without this PR; base alone: 2130 passed, 10 failed, 48 ignored.
review: blocking, the point two earlier reviews made and still on this head: an sRGB plane now gets an sRGB view, so the compositor samples linear values, but the back buffer keeps the plain UNORM format (present::swap_format maps the sRGB formats to UNORM, and the render-target format of the compositor pipeline is that same format) and the shader writes the sample unchanged. The gamma is removed and never put back: a value of 188 ends up as about 128 on screen. Only frames with more than one plane go through the compositor (one plane is still a byte copy), so the picture would change brightness whenever a second plane appears. The test in this PR asserts the darkened value.
performance: none; default path, frames with more than one plane only.
verdict: not yet: re-encode on output (an sRGB render-target view on the back buffer, or the encode in the shader) and assert the on-screen value in the test.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7240278110 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7240278110). Originally posted by [throny](https://github.com/throny) on 2026-11-28T13:55:07Z. --- merge-check base: e13d6250 head: e8d2258c5af20f108770ad8e0e983e9ecba8581e merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2131 passed, 10 failed, 48 ignored (26 SKIPPED lines). The 10 failures are the ones main itself has at e13d6250 on this GPU (#3093: the nine since #2959 and, since today, gpu::dxil::msaa_tests::direct_msaa_loads_precede_get_dimensions), the same set with and without this PR; base alone: 2130 passed, 10 failed, 48 ignored. review: blocking, the point two earlier reviews made and still on this head: an sRGB plane now gets an sRGB view, so the compositor samples linear values, but the back buffer keeps the plain UNORM format (present::swap_format maps the sRGB formats to UNORM, and the render-target format of the compositor pipeline is that same format) and the shader writes the sample unchanged. The gamma is removed and never put back: a value of 188 ends up as about 128 on screen. Only frames with more than one plane go through the compositor (one plane is still a byte copy), so the picture would change brightness whenever a second plane appears. The test in this PR asserts the darkened value. performance: none; default path, frames with more than one plane only. verdict: not yet: re-encode on output (an sRGB render-target view on the back buffer, or the encode in the shader) and assert the on-screen value in the test. hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
throny commented 2026-11-29 23:07:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-29T23:07:42Z.


@ramon-victor heads-up on an overlap: I have a local change (not pushed yet) that lets a single presented plane in a packed-float format (R11G11B10_FLOAT / R9G9B9E5_SHAREDEXP) go through the compositor instead of being dropped by swap_format. It edits the same SRV-format line in present.rs that this PR changes (the compositor SRV keeps the plane's own format there), so whichever merges second needs a one-line rebase. No conflict in intent: yours keeps concrete sRGB formats, mine adds the packed float ones. I will mention this PR in mine.

AI use: Claude Code (Claude Opus 5.5) wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7264217980 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7264217980). Originally posted by [throny](https://github.com/throny) on 2026-11-29T23:07:42Z. --- @ramon-victor heads-up on an overlap: I have a local change (not pushed yet) that lets a single presented plane in a packed-float format (R11G11B10_FLOAT / R9G9B9E5_SHAREDEXP) go through the compositor instead of being dropped by `swap_format`. It edits the same SRV-format line in `present.rs` that this PR changes (the compositor SRV keeps the plane's own format there), so whichever merges second needs a one-line rebase. No conflict in intent: yours keeps concrete sRGB formats, mine adds the packed float ones. I will mention this PR in mine. AI use: Claude Code (Claude Opus 5.5) wrote this.
Foniass commented 2026-12-01 08:18:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:18:51Z.


Triage (#1607) – head e8d2258

#2480 fixes the other half of #2456 (RTV tracking); nothing else makes this change.
Problem in present.rs Compositor::record: with plane_srv_format an *_UNORM_SRGB plane is sampled through an sRGB SRV (decoded to linear), but the render target is still dst_fmt = swap_format(..) = *_UNORM with a UNORM RTV, so nothing re-encodes it. The plane's gamma-encoded bytes reach the screen as linear values: darker than the same buffer presented alone, which main copies byte-for-byte into the UNORM swap chain. The new test asserts exactly this shift (stored [188, 128] read back as ~[128, 55]).
To keep the debug-layer-valid SRV, the output also needs an sRGB RTV view of the back buffer (or the planes need typeless views), so that an opaque plane passes through unchanged.
Recommendation: close (bad: composited sRGB planes are decoded but never re-encoded).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305153204 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2537#issuecomment-7305153204). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:18:51Z. --- **Triage (#1607)** – head e8d2258 #2480 fixes the other half of #2456 (RTV tracking); nothing else makes this change. Problem in `present.rs` `Compositor::record`: with `plane_srv_format` an `*_UNORM_SRGB` plane is sampled through an sRGB SRV (decoded to linear), but the render target is still `dst_fmt` = `swap_format(..)` = `*_UNORM` with a UNORM RTV, so nothing re-encodes it. The plane's gamma-encoded bytes reach the screen as linear values: darker than the same buffer presented alone, which main copies byte-for-byte into the UNORM swap chain. The new test asserts exactly this shift (stored [188, 128] read back as ~[128, 55]). To keep the debug-layer-valid SRV, the output also needs an sRGB RTV view of the back buffer (or the planes need typeless views), so that an opaque plane passes through unchanged. Recommendation: close (bad: composited sRGB planes are decoded but never re-encoded). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2537:upstream-pr/2537'
git switch 'upstream-pr/2537'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2537'
git switch 'upstream-pr/2537'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2537'
git switch 'upstream-pr/2537'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2537'
git switch 'main'
git merge --squash 'upstream-pr/2537'
git switch 'main'
git merge --ff-only 'upstream-pr/2537'
git switch 'main'
git merge 'upstream-pr/2537'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2527
No description provided.