D3D12.X: a single presented plane in a packed float format goes through the compositor #3534

Open
throny wants to merge 1 commit from upstream-pr/3534 into main
throny commented 2026-11-30 16:00:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-30T16:00:49Z.


A title that presents a plane in a packed float format (R11G11B10_FLOAT, R9G9B9E5_SHAREDEXP) got no picture for that present: swap_format did not know the format, so backbuffer_like filtered the plane out in present_now and a single-plane present returned before anything was drawn. Such a plane now gets an R16G16B16A16_FLOAT swap chain and goes through the compositor's draw (the path that already scales a sub-rect plane and blends overlay planes), because a copy cannot change the format.

What is in it

  • crates/xcl/src/hle/d3d12x/present.rs:
    • swap_format: the two packed float formats map to R16G16B16A16_FLOAT.
    • plane_view_format / needs_conversion (new, private): the format the compositor samples a plane in, and whether a plane has to be drawn instead of copied.
    • needs_compositor: true for a single full-rect plane that needs conversion; the compositor's SRV uses plane_view_format.
    • Compositor::can_draw (the checks record made, moved out): present_now asks it before ensure_swapchain. A packed float plane the compositor cannot draw (no compositor, no pipeline, a plane no view can read) is not presented and warns once: no resize to a float swap chain, no undefined buffer on screen, as before this change.
    • Only the title's first plane is taken in a packed float format. As an overlay such a plane is left out, as before, so presents whose first plane is not packed float are unchanged.
    • note_execute (the fallback for titles that do not call PresentX) keeps ignoring packed float targets, as before: there they are scene targets, not back buffers.
    • Test compositor_converts_a_single_packed_float_plane (WARP): the format decision for both formats, can_draw for a readable and a DENY_SHADER_RESOURCE plane, then an R11G11B10_FLOAT plane of (1.0, 0.5, 0.25) drawn into an R16G16B16A16_FLOAT target and read back.

Tested

  • Hardware: NVIDIA GeForce RTX 4080 16 GB, driver 621.40, Intel i9-12900K, Windows 11 Pro 10.0.26300, rustc 1.100.0 (0ef1bc386 2026-11-09), debug. Head commit 1d54e15e, no uncommitted changes.
  • cargo test -p xcl --lib -j 4 -- compositor_converts_a_single_packed_float_plane --test-threads=2 without the fix (test only): 0 passed, 1 failed (swap_format(R11G11B10_FLOAT): left None, right Some(R16G16B16A16_FLOAT)).
  • cargo test -p xcl --lib -j 12 -- present, with the fix: 31 passed, 0 failed, 0 ignored.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 2885 passed, 2 failed, 51 ignored. The two failures:
    • gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 also fails on main (9dfbe3ea), run alone.
    • gpu::recomp::dxc::cache_tests::concurrent_cache_misses_compile_once ("cached-only waited 285.6092ms for the compile", a timing check under the suite's load) passes when run alone on this branch and on main.
  • 24 SKIPPED lines. no wave64 (21, this GPU is wave32 only):
    gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole, gpu::recomp::lower::tests::{a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu}, gpu::recomp::lower_dxil::tests::* (a_per_lane_2d_or_3d_group_runs_on_the_gpu, bridged_dpp, const_and_null_mask_operands, f16 arithmetic and packed, f32 arithmetic / compares / conversions / rounding / three-source / transcendentals, f64, integer arithmetic and carries, mask_ff0_and_flbit), gpu::recomp::tests::{gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware}.
    Others: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap (no heap windows, opt-in XCL_HEAP_WINDOWS=1), shaders::tests::pso_measurement_compiles_an_exact_synthetic_record (cannot disable the driver cache: Windows Developer Mode is required).

Regression run (scripts/smoke.ps1 -Game <title folder>, same title, 60 s)

main (9dfbe3ea):

xcl-smoke v1
commit: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b
gpu: NVIDIA GeForce RTX 4080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1626 (PresentX 1626)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16011 MB

this PR's head (1d54e15e):

xcl-smoke v1
commit: 1d54e15edab452f794e814208f6806372b79e561
gpu: NVIDIA GeForce RTX 4080
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1643 (PresentX 1643)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15622 MB

Not tested

  • No title that presents a packed float plane was run: the conversion is covered by the WARP test only, not by a real swap chain or a title's packed-float plane on screen.
  • How the picture looks on screen. No colour space is set on the swap chain and the one the title names for the plane in PresentX is not read, so the FP16 swap chain is read as linear scRGB: the brightness of a display-referred packed float plane is unverified.
  • Drawing an R9G9B9E5_SHAREDEXP plane: only the format decision is tested (the draw test uses R11G11B10_FLOAT).
  • The early return in present_now itself (it needs a window, a swap chain and a title queue): the test covers the can_draw decision it is made on, on WARP only.
  • A packed float plane as an overlay (plane 1 and up) is still left out. A packed float first plane under other overlays is now drawn with them (before, it was left out and the overlays were shown alone); no test or title run covers that.
  • AMD / wave64 hardware; the retail title's own output beyond the 60 s smoke run.
  • Overlaps #2537 (open), which changes the same SRV format line in Compositor::record; whichever merges second needs a one-line rebase.

AI use

  • Claude Code: Claude Fable 5.2 wrote the code and the test, Claude Opus 5.5 reviewed it; Claude Sonnet 5.5 rebased it onto main, ran the test suite and the smoke runs, and prepared this PR.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5568858254 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534). Originally posted by [throny](https://github.com/throny) on 2026-11-30T16:00:49Z. --- A title that presents a plane in a packed float format (`R11G11B10_FLOAT`, `R9G9B9E5_SHAREDEXP`) got no picture for that present: `swap_format` did not know the format, so `backbuffer_like` filtered the plane out in `present_now` and a single-plane present returned before anything was drawn. Such a plane now gets an `R16G16B16A16_FLOAT` swap chain and goes through the compositor's draw (the path that already scales a sub-rect plane and blends overlay planes), because a copy cannot change the format. **What is in it** - `crates/xcl/src/hle/d3d12x/present.rs`: - `swap_format`: the two packed float formats map to `R16G16B16A16_FLOAT`. - `plane_view_format` / `needs_conversion` (new, private): the format the compositor samples a plane in, and whether a plane has to be drawn instead of copied. - `needs_compositor`: true for a single full-rect plane that needs conversion; the compositor's SRV uses `plane_view_format`. - `Compositor::can_draw` (the checks `record` made, moved out): `present_now` asks it before `ensure_swapchain`. A packed float plane the compositor cannot draw (no compositor, no pipeline, a plane no view can read) is not presented and warns once: no resize to a float swap chain, no undefined buffer on screen, as before this change. - Only the title's first plane is taken in a packed float format. As an overlay such a plane is left out, as before, so presents whose first plane is not packed float are unchanged. - `note_execute` (the fallback for titles that do not call `PresentX`) keeps ignoring packed float targets, as before: there they are scene targets, not back buffers. - Test `compositor_converts_a_single_packed_float_plane` (WARP): the format decision for both formats, `can_draw` for a readable and a `DENY_SHADER_RESOURCE` plane, then an `R11G11B10_FLOAT` plane of (1.0, 0.5, 0.25) drawn into an `R16G16B16A16_FLOAT` target and read back. **Tested** - Hardware: NVIDIA GeForce RTX 4080 16 GB, driver 621.40, Intel i9-12900K, Windows 11 Pro 10.0.26300, rustc 1.100.0 (0ef1bc386 2026-11-09), debug. Head commit 1d54e15e, no uncommitted changes. - `cargo test -p xcl --lib -j 4 -- compositor_converts_a_single_packed_float_plane --test-threads=2` without the fix (test only): 0 passed, 1 failed (`swap_format(R11G11B10_FLOAT)`: left `None`, right `Some(R16G16B16A16_FLOAT)`). - `cargo test -p xcl --lib -j 12 -- present`, with the fix: 31 passed, 0 failed, 0 ignored. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: 2885 passed, 2 failed, 51 ignored. The two failures: - `gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16` also fails on `main` (9dfbe3ea), run alone. - `gpu::recomp::dxc::cache_tests::concurrent_cache_misses_compile_once` ("cached-only waited 285.6092ms for the compile", a timing check under the suite's load) passes when run alone on this branch and on `main`. - 24 `SKIPPED` lines. `no wave64` (21, this GPU is wave32 only): `gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole`, `gpu::recomp::lower::tests::{a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu, cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu}`, `gpu::recomp::lower_dxil::tests::*` (a_per_lane_2d_or_3d_group_runs_on_the_gpu, bridged_dpp, const_and_null_mask_operands, f16 arithmetic and packed, f32 arithmetic / compares / conversions / rounding / three-source / transcendentals, f64, integer arithmetic and carries, mask_ff0_and_flbit), `gpu::recomp::tests::{gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware}`. Others: `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows), `hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap` (no heap windows, opt-in `XCL_HEAP_WINDOWS=1`), `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` (cannot disable the driver cache: Windows Developer Mode is required). **Regression run** (`scripts/smoke.ps1 -Game <title folder>`, same title, 60 s) main (9dfbe3ea): ``` xcl-smoke v1 commit: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b gpu: NVIDIA GeForce RTX 4080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1626 (PresentX 1626) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16011 MB ``` this PR's head (1d54e15e): ``` xcl-smoke v1 commit: 1d54e15edab452f794e814208f6806372b79e561 gpu: NVIDIA GeForce RTX 4080 title: 9cc6a39e seconds: 60 exit: 0x0 frames shown: 1643 (PresentX 1643) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15622 MB ``` **Not tested** - No title that presents a packed float plane was run: the conversion is covered by the WARP test only, not by a real swap chain or a title's packed-float plane on screen. - How the picture looks on screen. No colour space is set on the swap chain and the one the title names for the plane in `PresentX` is not read, so the FP16 swap chain is read as linear scRGB: the brightness of a display-referred packed float plane is unverified. - Drawing an `R9G9B9E5_SHAREDEXP` plane: only the format decision is tested (the draw test uses `R11G11B10_FLOAT`). - The early return in `present_now` itself (it needs a window, a swap chain and a title queue): the test covers the `can_draw` decision it is made on, on WARP only. - A packed float plane as an overlay (plane 1 and up) is still left out. A packed float first plane under other overlays is now drawn with them (before, it was left out and the overlays were shown alone); no test or title run covers that. - AMD / wave64 hardware; the retail title's own output beyond the 60 s smoke run. - Overlaps #2537 (open), which changes the same SRV format line in `Compositor::record`; whichever merges second needs a one-line rebase. **AI use** - Claude Code: Claude Fable 5.2 wrote the code and the test, Claude Opus 5.5 reviewed it; Claude Sonnet 5.5 rebased it onto `main`, ran the test suite and the smoke runs, and prepared this PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Aniseto commented 2026-11-30 16:57:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-30T16:57:14Z.


Ran the packed-float compositor test and the present group at 1d54e15e on an NVIDIA Blackwell desktop part with 16 GB of VRAM.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib -j 4 -- compositor_converts_a_single_packed_float_plane --test-threads=2
1 passed; 0 failed; 0 ignored; 2769 filtered out      (exit 0)

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib -j 12 -- present
31 passed; 0 failed; 0 ignored; 2739 filtered out     (exit 0)

Both counts match the description at this exact head: the single packed-float plane conversion test and the 31 tests of the present group. The device used here is the NVIDIA adapter with driver 621.40 and 16 GB of VRAM, while the description's draw test was recorded on WARP; the test selects its own device, and it passed here.

Not tested: the full workspace suite, a title that presents a packed float plane, the R9G9B9E5_SHAREDEXP draw, the overlay path, native wave64 hosts, AMD and Intel GPUs, Wine, release profile, game data.

AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

<!-- greyfinch-sync:ivall/xcl:comment:7285487256 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#issuecomment-7285487256). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-30T16:57:14Z. --- Ran the packed-float compositor test and the `present` group at `1d54e15e` on an NVIDIA Blackwell desktop part with 16 GB of VRAM. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, `XCL_ADAPTER=NVIDIA`, detached worktree at the exact PR head, no local patches. ``` XCL_ADAPTER=NVIDIA cargo test -p xcl --lib -j 4 -- compositor_converts_a_single_packed_float_plane --test-threads=2 1 passed; 0 failed; 0 ignored; 2769 filtered out (exit 0) XCL_ADAPTER=NVIDIA cargo test -p xcl --lib -j 12 -- present 31 passed; 0 failed; 0 ignored; 2739 filtered out (exit 0) ``` Both counts match the description at this exact head: the single packed-float plane conversion test and the 31 tests of the `present` group. The device used here is the NVIDIA adapter with driver 621.40 and 16 GB of VRAM, while the description's draw test was recorded on WARP; the test selects its own device, and it passed here. Not tested: the full workspace suite, a title that presents a packed float plane, the `R9G9B9E5_SHAREDEXP` draw, the overlay path, native wave64 hosts, AMD and Intel GPUs, Wine, release profile, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Gevroska commented 2026-11-30 20:23:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-30T20:23:52Z.


@throny I tested both packed-float source formats on my RTX 3080 (driver 616.92) using 1d54e15e with a test-only extension. For each format, I drew an 8×8 two-stripe pattern through the compositor, waited for the GPU fence, and checked every FP16 output component.

Source format RTX 3080 readback
R11G11B10_FLOAT 64/64 pixels matched
R9G9B9E5_SHAREDEXP 64/64 pixels matched

The two stripes came back as RGBA (1.0, 0.5, 0.25, 1.0) and (0.5, 1.0, 0.25, 1.0) for both formats. The original R11G11B10_FLOAT WARP control also passed 64/64. This covers offscreen conversion on a physical adapter. I didn’t test swapchain presentation or establish whether the retail game supplies either format.

I used Codex GPT-6.2 Sol to extend and run the fixture. A separate GPT-6.2 Sol agent checked the source and saved results. Codex GPT-6.2 Astra drafted this comment.

I reviewed and approved this comment before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7290849505 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#issuecomment-7290849505). Originally posted by [Gevroska](https://github.com/Gevroska) on 2026-11-30T20:23:52Z. --- @throny I tested both packed-float source formats on my RTX 3080 (driver 616.92) using `1d54e15e` with a test-only extension. For each format, I drew an 8×8 two-stripe pattern through the compositor, waited for the GPU fence, and checked every FP16 output component. | Source format | RTX 3080 readback | |---|---| | `R11G11B10_FLOAT` | 64/64 pixels matched | | `R9G9B9E5_SHAREDEXP` | 64/64 pixels matched | The two stripes came back as RGBA `(1.0, 0.5, 0.25, 1.0)` and `(0.5, 1.0, 0.25, 1.0)` for both formats. The original `R11G11B10_FLOAT` WARP control also passed 64/64. This covers offscreen conversion on a physical adapter. I didn’t test swapchain presentation or establish whether the retail game supplies either format. I used Codex GPT-6.2 Sol to extend and run the fixture. A separate GPT-6.2 Sol agent checked the source and saved results. Codex GPT-6.2 Astra drafted this comment. I reviewed and approved this comment before posting.
Foniass commented 2026-12-01 03:09:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:09:47Z.


merge-check
base: b2b1f109d2
head: 1d54e15eda
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (present.rs, +115/-12). It only changes what a title runs when its first PresentX plane is R11G11B10_FLOAT or R9G9B9E5_SHAREDEXP (on main such a present shows nothing, since swap_format returns None). Findings: (1) the plane is drawn into an R16G16B16A16_FLOAT swap chain without a colour space being set, so DWM reads it as linear scRGB; if the title's plane holds display-encoded values, or 8-bit UI planes are composed on top, the picture comes out washed out. Not checked on a title (the PR says so). (2) can_draw (~1512) needs every plane to be drawable, so one unreadable UI plane (e.g. DENY_SHADER_RESOURCE) drops the whole present; dropping just that plane would keep the scene. (3) If Compositor::new fails, it is retried on every packed-float present (~1513). Fine: can_draw keeps record's checks identical, the note_execute fallback is unchanged for other formats, and the test's packed bit patterns and half-float read-back are right; it runs on WARP and fails without the change. The smoke run below does not present a packed-float plane, so it does not reach the changed path.
performance: 60 s smoke of a retail title, main b2b1f109 vs this merge (15f36f98): 1671 -> 1676 frames shown (100 %; last presents per 2 s: 61 60 60), peak commit 17394 -> 18970 MB, 0 device removals, 0 crashes. No cost outside packed-float presents. (Rerun on current main, edited in place; the first run, on d0832e61, was 1516 -> 1665 frames and 18133 -> 17394 MB.)
verdict: safe to merge (it only adds a picture where main shows none; finding 1 is worth a look on a title that presents R11G11B10)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7299393927 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#issuecomment-7299393927). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:09:47Z. --- merge-check base: b2b1f109d27e746a62ec95b04dd1f9924452e682 head: 1d54e15edab452f794e814208f6806372b79e561 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: read the whole diff (present.rs, +115/-12). It only changes what a title runs when its first PresentX plane is R11G11B10_FLOAT or R9G9B9E5_SHAREDEXP (on main such a present shows nothing, since swap_format returns None). Findings: (1) the plane is drawn into an R16G16B16A16_FLOAT swap chain without a colour space being set, so DWM reads it as linear scRGB; if the title's plane holds display-encoded values, or 8-bit UI planes are composed on top, the picture comes out washed out. Not checked on a title (the PR says so). (2) `can_draw` (~1512) needs every plane to be drawable, so one unreadable UI plane (e.g. DENY_SHADER_RESOURCE) drops the whole present; dropping just that plane would keep the scene. (3) If `Compositor::new` fails, it is retried on every packed-float present (~1513). Fine: `can_draw` keeps `record`'s checks identical, the note_execute fallback is unchanged for other formats, and the test's packed bit patterns and half-float read-back are right; it runs on WARP and fails without the change. The smoke run below does not present a packed-float plane, so it does not reach the changed path. performance: 60 s smoke of a retail title, main b2b1f109 vs this merge (15f36f98): 1671 -> 1676 frames shown (100 %; last presents per 2 s: 61 60 60), peak commit 17394 -> 18970 MB, 0 device removals, 0 crashes. No cost outside packed-float presents. (Rerun on current main, edited in place; the first run, on d0832e61, was 1516 -> 1665 frames and 18133 -> 17394 MB.) verdict: safe to merge (it only adds a picture where main shows none; finding 1 is worth a look on a title that presents R11G11B10) hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
brainhay5 commented 2026-12-01 05:18:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T05:18:03Z.


merge-check claim
head: 1d54e15eda

<!-- greyfinch-sync:ivall/xcl:comment:7301626054 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#issuecomment-7301626054). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T05:18:03Z. --- merge-check claim head: 1d54e15edab452f794e814208f6806372b79e561
brainhay5 commented 2026-12-01 05:24:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T05:24:51Z.


merge-check
base: d0832e614f
head: 1d54e15eda
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2890 passed, 1 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017

<!-- greyfinch-sync:ivall/xcl:comment:7301744342 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#issuecomment-7301744342). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T05:24:51Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: 1d54e15edab452f794e814208f6806372b79e561 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2890 passed, 1 failed, 51 ignored; 29 SKIPPED lines failing: test_title_runs_and_game_folder_is_untouched review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review. performance: not assessed beyond the suite. verdict: safe to merge hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
bmjask commented 2026-12-02 11:42:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T11:42:17Z.

Code review location: crates/xcl/src/hle/d3d12x/present.rs; line 1469

@@ -1439,8 +1462,13 @@ unsafe fn present_now(min_interval: Duration, frame: Option<(usize, Vec<(usize,
     let Some(_queue_pin) = pin_queue_for_internal_work(queue) else { return };
     let resolved: Vec<(ID3D12Resource, D3D12_RESOURCE_DESC, [f32; 4])> = raw_planes
         .into_iter()
-        .filter_map(|(res, rect)| {
+        .enumerate()
+        .filter_map(|(i, (res, rect))| {
             let desc = backbuffer_like(res)?;
+            // (a packed float plane is taken as the title's first plane only: as an overlay it is left out, as before)
+            if i > 0 && needs_conversion(desc.Format) {

The overlay filter uses the raw PresentX plane index i, not the plane's position after filtering, so a packed float plane is dropped whenever an earlier raw plane was rejected by backbuffer_like, even though it would have become resolved[0]. If raw plane 0 is under 640x360 or in a format swap_format rejects, and raw plane 1 is a 1920x1080 R11G11B10_FLOAT scene, plane 1 is dropped because i == 1, resolved ends up empty and nothing is presented. That's the no-picture bug this PR sets out to fix. Checking resolved.is_empty() instead of i > 0 would fix it.

<!-- greyfinch-sync:ivall/xcl:review-comment:4768974918 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#discussion_r4768974918). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T11:42:17Z. **Code review location:** `crates/xcl/src/hle/d3d12x/present.rs`; line 1469 ~~~~diff @@ -1439,8 +1462,13 @@ unsafe fn present_now(min_interval: Duration, frame: Option<(usize, Vec<(usize, let Some(_queue_pin) = pin_queue_for_internal_work(queue) else { return }; let resolved: Vec<(ID3D12Resource, D3D12_RESOURCE_DESC, [f32; 4])> = raw_planes .into_iter() - .filter_map(|(res, rect)| { + .enumerate() + .filter_map(|(i, (res, rect))| { let desc = backbuffer_like(res)?; + // (a packed float plane is taken as the title's first plane only: as an overlay it is left out, as before) + if i > 0 && needs_conversion(desc.Format) { ~~~~ --- The overlay filter uses the raw PresentX plane index `i`, not the plane's position after filtering, so a packed float plane is dropped whenever an earlier raw plane was rejected by `backbuffer_like`, even though it would have become resolved[0]. If raw plane 0 is under 640x360 or in a format `swap_format` rejects, and raw plane 1 is a 1920x1080 R11G11B10_FLOAT scene, plane 1 is dropped because i == 1, `resolved` ends up empty and nothing is presented. That's the no-picture bug this PR sets out to fix. Checking `resolved.is_empty()` instead of `i > 0` would fix it.
bmjask commented 2026-12-02 11:42:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T11:42:17Z.

Code review location: crates/xcl/src/hle/d3d12x/present.rs; line 300

@@ -296,10 +296,26 @@ pub fn swap_format(f: DXGI_FORMAT) -> Option<DXGI_FORMAT> {
         DXGI_FORMAT_B8G8R8A8_UNORM | DXGI_FORMAT_B8G8R8A8_UNORM_SRGB | DXGI_FORMAT_B8G8R8A8_TYPELESS => DXGI_FORMAT_B8G8R8A8_UNORM,
         DXGI_FORMAT_R10G10B10A2_UNORM | DXGI_FORMAT_R10G10B10A2_TYPELESS => DXGI_FORMAT_R10G10B10A2_UNORM,
         DXGI_FORMAT_R16G16B16A16_FLOAT | DXGI_FORMAT_R16G16B16A16_TYPELESS => DXGI_FORMAT_R16G16B16A16_FLOAT,
+        // packed float planes: no swap chain has these formats, the compositor draws them into a float one
+        DXGI_FORMAT_R11G11B10_FLOAT | DXGI_FORMAT_R9G9B9E5_SHAREDEXP => DXGI_FORMAT_R16G16B16A16_FLOAT,

Not certain about this one: a packed float plane now gets an R16G16B16A16_FLOAT swap chain, but no colour space is set on it, and the colour space the title names in PresentX is ignored, so DXGI reads the buffer as linear scRGB. A title presenting a display-referred (gamma-encoded) R11G11B10_FLOAT plane has 0.5 shown as linear 0.5 (about 0.73 sRGB) instead of sRGB 0.5, so the picture looks washed out. There's no SetColorSpace1 anywhere in ensure_swapchain.

<!-- greyfinch-sync:ivall/xcl:review-comment:4768974928 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#discussion_r4768974928). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T11:42:17Z. **Code review location:** `crates/xcl/src/hle/d3d12x/present.rs`; line 300 ~~~~diff @@ -296,10 +296,26 @@ pub fn swap_format(f: DXGI_FORMAT) -> Option<DXGI_FORMAT> { DXGI_FORMAT_B8G8R8A8_UNORM | DXGI_FORMAT_B8G8R8A8_UNORM_SRGB | DXGI_FORMAT_B8G8R8A8_TYPELESS => DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_R10G10B10A2_UNORM | DXGI_FORMAT_R10G10B10A2_TYPELESS => DXGI_FORMAT_R10G10B10A2_UNORM, DXGI_FORMAT_R16G16B16A16_FLOAT | DXGI_FORMAT_R16G16B16A16_TYPELESS => DXGI_FORMAT_R16G16B16A16_FLOAT, + // packed float planes: no swap chain has these formats, the compositor draws them into a float one + DXGI_FORMAT_R11G11B10_FLOAT | DXGI_FORMAT_R9G9B9E5_SHAREDEXP => DXGI_FORMAT_R16G16B16A16_FLOAT, ~~~~ --- Not certain about this one: a packed float plane now gets an R16G16B16A16_FLOAT swap chain, but no colour space is set on it, and the colour space the title names in PresentX is ignored, so DXGI reads the buffer as linear scRGB. A title presenting a display-referred (gamma-encoded) R11G11B10_FLOAT plane has 0.5 shown as linear 0.5 (about 0.73 sRGB) instead of sRGB 0.5, so the picture looks washed out. There's no SetColorSpace1 anywhere in `ensure_swapchain`.
bmjask commented 2026-12-02 11:42:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T11:42:17Z.

Review: COMMENTED


Review of 1d54e15e: 3 finding(s). 2 are inline. These are on lines outside the diff:

crates/xcl/src/hle/d3d12x/present.rs:1505: When a packed float plane is first and overlays follow, the swap-chain format comes from plane 0 (FP16), so 8-bit sRGB-encoded UI overlays are sampled through UNORM views and written into a linear scRGB target with no conversion. Take a PresentX with [R11G11B10 scene, R8G8B8A8_UNORM_SRGB UI]. Before this PR the UI plane went into an 8-bit swap chain and looked right. Now its gamma-encoded values land in the FP16 chain as linear values and are blended in the wrong space, so the UI looks washed out and its edges blend wrongly. Sampling overlays through their SRGB view (or converting) when the target is FP16 would keep them correct.


These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.

<!-- greyfinch-sync:ivall/xcl:review:6150045183 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#pullrequestreview-6150045183). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T11:42:17Z. **Review:** COMMENTED --- Review of `1d54e15e`: 3 finding(s). 2 are inline. These are on lines outside the diff: **`crates/xcl/src/hle/d3d12x/present.rs:1505`**: When a packed float plane is first and overlays follow, the swap-chain format comes from plane 0 (FP16), so 8-bit sRGB-encoded UI overlays are sampled through UNORM views and written into a linear scRGB target with no conversion. Take a PresentX with [R11G11B10 scene, R8G8B8A8_UNORM_SRGB UI]. Before this PR the UI plane went into an 8-bit swap chain and looked right. Now its gamma-encoded values land in the FP16 chain as linear values and are blended in the wrong space, so the UI looks washed out and its edges blend wrongly. Sampling overlays through their SRGB view (or converting) when the target is FP16 would keep them correct. --- _These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it._
bmjask commented 2026-12-02 14:11:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:11:49Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7348145426 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#issuecomment-7348145426). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T14:11:49Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
throny commented 2026-12-02 18:43:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-02T18:43:02Z.


Thanks for the reviews. I checked each point against the code at 1d54e15e and am leaving the code as it is. Here is why for each one.

1. No colour space on the R16G16B16A16_FLOAT swap chain (present.rs:300; Foniass's finding 1). This is right as a description: present.rs has no SetColorSpace1 and does not decode the colour space field of PresentX, so DXGI reads an FP16 chain as linear scRGB. That was already true on main for every R16G16B16A16_FLOAT plane (and an R10G10B10A2 plane gets no HDR10 colour space either). This PR gives packed float planes the same treatment. We have no title that presents R11G11B10 or R9G9B9E5 in hand, so we cannot tell whether its values are linear or display-encoded. Converting without knowing would be wrong for one of the two cases. On main such a present shows nothing, and with this PR it shows the picture, perhaps with the wrong tone. Choosing the colour space from what PresentX says is a separate change for all float and 10-bit planes, and I'd rather make it with a title that needs it.

2. The overlay filter uses the raw plane index (present.rs:1469). This is deliberate, and the comment on that line says so: only the title's own plane 0 is taken in a packed float format. When raw plane 0 is rejected and plane 1 is packed float, nothing is shown, which is exactly what main does for that present. So this is not a regression. It is a case the PR does not cover. In PresentX, planes after 0 are the overlay (UI) planes. Showing one of them alone, stretched over the whole window as the picture, would be a guess of its own. I'm happy to change this in a follow-up if a title shows it.

3. 8-bit sRGB overlays over an FP16 swap chain (present.rs:1505, outside the diff). This is the same thing main already does for an R16G16B16A16_FLOAT scene with an 8-bit UI plane: overlays are sampled through swap_format's UNORM view whatever the target is. It has the same root as point 1. Decoding only the UI to linear while the scene plane stays as the title wrote it would mix encodings whenever the scene is display-encoded. That would be wrong in a new way rather than right. So it belongs in the colour-space change. On main, by the way, [R11G11B10 scene, 8-bit UI] showed the UI plane alone, without the scene.

No code changed, so the head is still 1d54e15e.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7355046252 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3534#issuecomment-7355046252). Originally posted by [throny](https://github.com/throny) on 2026-12-02T18:43:02Z. --- Thanks for the reviews. I checked each point against the code at `1d54e15e` and am leaving the code as it is. Here is why for each one. **1. No colour space on the R16G16B16A16_FLOAT swap chain (present.rs:300; Foniass's finding 1).** This is right as a description: `present.rs` has no `SetColorSpace1` and does not decode the colour space field of PresentX, so DXGI reads an FP16 chain as linear scRGB. That was already true on `main` for every R16G16B16A16_FLOAT plane (and an R10G10B10A2 plane gets no HDR10 colour space either). This PR gives packed float planes the same treatment. We have no title that presents R11G11B10 or R9G9B9E5 in hand, so we cannot tell whether its values are linear or display-encoded. Converting without knowing would be wrong for one of the two cases. On `main` such a present shows nothing, and with this PR it shows the picture, perhaps with the wrong tone. Choosing the colour space from what PresentX says is a separate change for all float and 10-bit planes, and I'd rather make it with a title that needs it. **2. The overlay filter uses the raw plane index (present.rs:1469).** This is deliberate, and the comment on that line says so: only the title's own plane 0 is taken in a packed float format. When raw plane 0 is rejected and plane 1 is packed float, nothing is shown, which is exactly what `main` does for that present. So this is not a regression. It is a case the PR does not cover. In PresentX, planes after 0 are the overlay (UI) planes. Showing one of them alone, stretched over the whole window as the picture, would be a guess of its own. I'm happy to change this in a follow-up if a title shows it. **3. 8-bit sRGB overlays over an FP16 swap chain (present.rs:1505, outside the diff).** This is the same thing `main` already does for an R16G16B16A16_FLOAT scene with an 8-bit UI plane: overlays are sampled through `swap_format`'s UNORM view whatever the target is. It has the same root as point 1. Decoding only the UI to linear while the scene plane stays as the title wrote it would mix encodings whenever the scene is display-encoded. That would be wrong in a new way rather than right. So it belongs in the colour-space change. On `main`, by the way, `[R11G11B10 scene, 8-bit UI]` showed the UI plane alone, without the scene. No code changed, so the head is still `1d54e15e`. *AI use: Claude Code (Claude Opus 5.5).*
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/3534:upstream-pr/3534'
git switch 'upstream-pr/3534'

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/3534'
git switch 'upstream-pr/3534'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3534'
git switch 'upstream-pr/3534'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3534'
git switch 'main'
git merge --squash 'upstream-pr/3534'
git switch 'main'
git merge --ff-only 'upstream-pr/3534'
git switch 'main'
git merge 'upstream-pr/3534'
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!3534
No description provided.