D3D12.X: add depth+UAV color twins, format-aliased placed texture copies, and dual-twin UAV barriers #1989

Open
github-bot wants to merge 1 commit from github-bot/gh-1989 into main AGit
Owner

@⁠raylitebull on GitHub · 2026-11-25 00:26 UTC · original
raylitebull:feat/lit-world-d3d12x-v2 → main · +4347 −90 · 8 files · 1 commits · open

Adds two D3D12.X translation layers for console texture behaviors not natively allowed on PC D3D12:

  1. Depth+UAV shadow/color twins (depth_uav.rs): tracks console depth-stencil textures created with ALLOW_UNORDERED_ACCESS (including CreatePlacedResource #29 via dev_create_placed_resource_x), creates typeless/UAV-compatible color (and optional stencil) twin resources (TwinPlan, plan_for_console_format), redirects CreateUnorderedAccessView to the twin (resolve_uav, integrating uav_companion_srv + null_uav_desc and pointing slot.pc_srv at the twin resource), synchronizes dirty per-subresource planes across both legacy ResourceBarrier (filter_transition, on_uav_barrier), Enhanced Barriers (#146 D3D12_BARRIER_GROUP texture & global barriers in filter_enhanced_barriers), wildcard global UAV barriers (on_global_uav_barrier), and DSV binds/clears (before_bind_dsv, on_clear_dsv, keeping STATE_COMMON targets in legal DEPTH_READ/DEPTH_WRITE via note_dsv flags and unifying RowPitch = max(src_pitch, dst_pitch) across 2-plane copy_plane_through_buffer), emits post-DepthToTwin UAV barriers, and restores internal-pass graphics/compute root signatures, PSO state, and dynamic depth bias (restore_after_internal_pass).
  2. Format-aliased placed texture copies (format_alias.rs): tracks aliased placed textures at overlapping GPU addresses with per-subresource state tracking (COMPUTE_VALID_STATES = 0xC48), copies/synchronizes between incompatible formats via RAII OwnedCopyLoc buffer-through passes (copy_one_subresource_through_buffer with max(src_pitch, dst_pitch) pitch alignment, try_copy_texture_region), and routes evicted/orphaned descriptors and heaps through late_release::hold (is_adopted-guarded).

Part of #1833.

What is in it

  • crates/xcl/src/hle/d3d12x/depth_uav.rs & mod.rs: TwinPlan / DepthSyncKind / PlaneMask / SyncOp per-subresource state machine (filter_enhanced_barriers, on_global_uav_barrier, note_dsv, pc_states_depth, pc_states_stencil, split_uav_*, copy_direct_subs, transition_plane_subs, on_uav_barrier), post-DepthToTwin UAV barrier, late_release::hold teardown, plus unit & WARP GPU tests (depth_uav::tests, including enhanced_barriers_handle_texture_subresources_uav_and_discard and gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test with real::preserve_vtable across test Reset calls).
  • crates/xcl/src/hle/d3d12x/format_alias.rs: placed texture alias tracking (list_reset), RAII OwnedCopyLoc buffer-through sync (max(src_pitch, dst_pitch)), COMPUTE_VALID_STATES = 0xC48, element byte width / block-scaled dimension checks in try_copy_texture_region, and unit tests in format_alias::tests.
  • crates/xcl/src/hle/d3d12x/bind.rs, device_x.rs, late_release.rs, list_x.rs, real.rs: rs_cs + rs_gfx restoration (restore_after_internal_pass), is_adopted-guarded late_release::drain_known, dev_create_placed_resource_x + dev_create_uav_x integration (#1914 companion SRV + slot.pc_srv twin SRV + #2280 pc_clear_for_desc), and Enhanced Barrier (#146) / UAV (#26) routing in list_x.rs.

Tested

  • Toolchain: Windows 11 x64, rustc 1.99.1 (58cf8f9c3 2026-10-13), WARP (XCL_ADAPTER=warp), rebased cleanly onto 569f0fc5 (bfafdf77).
  • cargo check --workspace --tests: passed (0 warnings in touched files).
  • Debug layer OFF (matching CI, 0 skips): XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4: 251 passed, 0 failed, 2 ignored (4.25s, 0 crashes).
  • Debug layer ON: XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias": 9 passed, 0 failed (0.11s, 0 D3D12 debug errors, including enhanced_barriers_handle_texture_subresources_uav_and_discard and gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test).

Regression run

  • Standalone scripts/smoke.ps1 pair on bfafdf77 vs 569f0fc5 has not been run yet. AMD and NVIDIA reviewers are invited to test on bfafdf77 vs 569f0fc5 (including scripts/smoke.ps1, depth_uav/format_alias GPU tests, and world lighting/depth-UAV workloads) and post results in the comments.

Not tested

  • 60 s scripts/smoke.ps1 pair on bfafdf77, full cargo test --workspace suite on bfafdf77, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.

AI use

  • Antigravity assisted with implementation, WARP debug-layer diagnostics, rebase onto 569f0fc5, and unit/GPU tests; the author reviewed the diff and test output.
**@⁠raylitebull** on GitHub · 2026-11-25 00:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989) `raylitebull:feat/lit-world-d3d12x-v2` → `main` · +4347 −90 · 8 files · 1 commits · open Adds two D3D12.X translation layers for console texture behaviors not natively allowed on PC D3D12: 1. **Depth+UAV shadow/color twins (`depth_uav.rs`):** tracks console depth-stencil textures created with `ALLOW_UNORDERED_ACCESS` (including `CreatePlacedResource` `#29` via `dev_create_placed_resource_x`), creates typeless/UAV-compatible color (and optional stencil) twin resources (`TwinPlan`, `plan_for_console_format`), redirects `CreateUnorderedAccessView` to the twin (`resolve_uav`, integrating `uav_companion_srv` + `null_uav_desc` and pointing `slot.pc_srv` at the twin resource), synchronizes dirty per-subresource planes across both legacy `ResourceBarrier` (`filter_transition`, `on_uav_barrier`), Enhanced Barriers (`#146` `D3D12_BARRIER_GROUP` texture & global barriers in `filter_enhanced_barriers`), wildcard global UAV barriers (`on_global_uav_barrier`), and DSV binds/clears (`before_bind_dsv`, `on_clear_dsv`, keeping `STATE_COMMON` targets in legal `DEPTH_READ`/`DEPTH_WRITE` via `note_dsv` flags and unifying `RowPitch = max(src_pitch, dst_pitch)` across 2-plane `copy_plane_through_buffer`), emits post-`DepthToTwin` UAV barriers, and restores internal-pass graphics/compute root signatures, PSO state, and dynamic depth bias (`restore_after_internal_pass`). 2. **Format-aliased placed texture copies (`format_alias.rs`):** tracks aliased placed textures at overlapping GPU addresses with per-subresource state tracking (`COMPUTE_VALID_STATES = 0xC48`), copies/synchronizes between incompatible formats via RAII `OwnedCopyLoc` buffer-through passes (`copy_one_subresource_through_buffer` with `max(src_pitch, dst_pitch)` pitch alignment, `try_copy_texture_region`), and routes evicted/orphaned descriptors and heaps through `late_release::hold` (`is_adopted`-guarded). Part of #1833. **What is in it** - `crates/xcl/src/hle/d3d12x/depth_uav.rs` & `mod.rs`: `TwinPlan` / `DepthSyncKind` / `PlaneMask` / `SyncOp` per-subresource state machine (`filter_enhanced_barriers`, `on_global_uav_barrier`, `note_dsv`, `pc_states_depth`, `pc_states_stencil`, `split_uav_*`, `copy_direct_subs`, `transition_plane_subs`, `on_uav_barrier`), post-`DepthToTwin` UAV barrier, `late_release::hold` teardown, plus unit & WARP GPU tests (`depth_uav::tests`, including `enhanced_barriers_handle_texture_subresources_uav_and_discard` and `gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test` with `real::preserve_vtable` across test `Reset` calls). - `crates/xcl/src/hle/d3d12x/format_alias.rs`: placed texture alias tracking (`list_reset`), RAII `OwnedCopyLoc` buffer-through sync (`max(src_pitch, dst_pitch)`), `COMPUTE_VALID_STATES = 0xC48`, element byte width / block-scaled dimension checks in `try_copy_texture_region`, and unit tests in `format_alias::tests`. - `crates/xcl/src/hle/d3d12x/bind.rs`, `device_x.rs`, `late_release.rs`, `list_x.rs`, `real.rs`: `rs_cs` + `rs_gfx` restoration (`restore_after_internal_pass`), `is_adopted`-guarded `late_release::drain_known`, `dev_create_placed_resource_x` + `dev_create_uav_x` integration (`#1914` companion SRV + `slot.pc_srv` twin SRV + `#2280` `pc_clear_for_desc`), and Enhanced Barrier (`#146`) / UAV (`#26`) routing in `list_x.rs`. **Tested** - Toolchain: Windows 11 x64, `rustc 1.99.1 (58cf8f9c3 2026-10-13)`, WARP (`XCL_ADAPTER=warp`), rebased cleanly onto `569f0fc5` (`bfafdf77`). - `cargo check --workspace --tests`: passed (`0` warnings in touched files). - Debug layer OFF (matching CI, 0 skips): `XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4`: 251 passed, 0 failed, 2 ignored (`4.25s`, `0` crashes). - Debug layer ON: `XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias"`: 9 passed, 0 failed (`0.11s`, `0` D3D12 debug errors, including `enhanced_barriers_handle_texture_subresources_uav_and_discard` and `gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test`). **Regression run** - Standalone `scripts/smoke.ps1` pair on `bfafdf77` vs `569f0fc5` has not been run yet. AMD and NVIDIA reviewers are invited to test on `bfafdf77` vs `569f0fc5` (including `scripts/smoke.ps1`, `depth_uav`/`format_alias` GPU tests, and world lighting/depth-UAV workloads) and post results in the comments. **Not tested** - 60 s `scripts/smoke.ps1` pair on `bfafdf77`, full `cargo test --workspace` suite on `bfafdf77`, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton. **AI use** - Antigravity assisted with implementation, WARP debug-layer diagnostics, rebase onto `569f0fc5`, and unit/GPU tests; the author reviewed the diff and test output.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:13:19 +00:00
Author
Owner

@⁠gsucristo on GitHub · 2026-11-25 00:57 UTC · original

Technical review findings:

Blocking

  1. Guaranteed COM refcount leak on every buffer-through copy (depth_uav.rs:873-899 copy_plane_through_buffer, format_alias.rs:696-722 copy_one_subresource_through_buffer): Both populate D3D12_TEXTURE_COPY_LOCATION::pResource with ManuallyDrop::new(Some(res.clone())) (AddRef), then call std::mem::forget(...) without ManuallyDrop::drop. This leaks +1 ref on src, +1 ref on dst, and +2 refs on the per-list CopyScratch buffer per subresource per copy, preventing res_release cleanup and leaking VRAM monotonically.
  2. Missing UAV barrier after FullscreenPass DepthToTwin compute dispatch (depth_uav.rs:1429-1438 execute_syncs, list_x.rs:3857-3861 resource_barrier_x): resource_barrier_x emits the global UAV barrier before depth_uav::execute_syncs. In DepthToTwin (FullscreenPass), the compute shader writes twin_res via UAV while twin_res stays in UNORDERED_ACCESS and returns without a UAV barrier on twin_res, racing subsequent title compute dispatches.
  3. restore_after_internal_pass clobbers PC root signatures, root parameters, and dynamic depth-bias PSO state (list_x.rs:134-147, depth_uav.rs:1317-1336, 1423-1435): FullscreenPass calls SetGraphicsRootSignature/SetComputeRootSignature and SetPipelineState on the PC list (invalidating bound root parameters), but restore_after_internal_pass doesn't restore the title's PC root signature/root args or handle using_fallback_pso/pso_dirty/RSSetDepthBiasX.
  4. Multi-subresource barrier corruption & StateBefore mismatches (depth_uav.rs:197-198, 563-642, 763-774, 802-827):
    • Entry tracks only one pc_state_depth/pc_state_stencil per plane instead of per subresource, so a single-subresource barrier transitions all 0..per_plane subresources.
    • entering_uav sets before_depth/before_stencil to the title's before instead of prev_d/prev_s.
    • In before_bind_dsv, PlaneMask::Both transitions both planes to e.pc_state_depth without updating e.pc_state_stencil.
  5. GPU UAF on unadopted pass descriptor heaps (depth_uav.rs:1128, 1147, 1179, 328-346): pass_dsv_heap and pass_srv_uav_heap are created via orig_fn(dev_raw, 14) (bypassing late_release), so depth_uav::forget drops them immediately even if a command list that bound them is still in flight on the GPU.
  6. Invalid RENDER_TARGET state allowed on COMPUTE lists (format_alias.rs:755 sync_pair): The non-DIRECT guard st & !0xC4F != 0 permits 0x4 (RENDER_TARGET), 0x2 (INDEX_BUFFER), and 0x1 (VERTEX_AND_CONSTANT_BUFFER), which are illegal on COMPUTE command lists.

Major

  • placed_uavs/placed_srvs in format_alias.rs own ID3D12Resources permanently (never evicted on forget or VA reuse), and on_uav_barrier copies every PlacedUav pair on the device on global bind::activity() changes.
  • note_title_transition returns early when ACTIVE_PAIRS == 0 (leaving pc_state stale for textures that transitioned before their alias peer was created) and ignores subresource / split-barrier BEGIN_ONLY flags.
  • try_copy_texture_region skips can_copy_through_buffer and only compares rows/RowPitch/Depth, which can silently alias incompatible bytes-per-texel formats that share the same 256-byte-aligned RowPitch.
  • dev_create_uav_x (real.rs:2435-2449) creates the paired SRV (slot.pc_srv) on the original depth res rather than uav_res (twin_res).
**@⁠gsucristo** on GitHub · 2026-11-25 00:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7149055745) Technical review findings: **Blocking** 1. **Guaranteed COM refcount leak on every buffer-through copy (`depth_uav.rs:873-899` `copy_plane_through_buffer`, `format_alias.rs:696-722` `copy_one_subresource_through_buffer`)**: Both populate `D3D12_TEXTURE_COPY_LOCATION::pResource` with `ManuallyDrop::new(Some(res.clone()))` (`AddRef`), then call `std::mem::forget(...)` without `ManuallyDrop::drop`. This leaks +1 ref on `src`, +1 ref on `dst`, and +2 refs on the per-list `CopyScratch` buffer per subresource per copy, preventing `res_release` cleanup and leaking VRAM monotonically. 2. **Missing UAV barrier after `FullscreenPass` `DepthToTwin` compute dispatch (`depth_uav.rs:1429-1438` `execute_syncs`, `list_x.rs:3857-3861` `resource_barrier_x`)**: `resource_barrier_x` emits the global UAV barrier *before* `depth_uav::execute_syncs`. In `DepthToTwin` (`FullscreenPass`), the compute shader writes `twin_res` via UAV while `twin_res` stays in `UNORDERED_ACCESS` and returns without a UAV barrier on `twin_res`, racing subsequent title compute dispatches. 3. **`restore_after_internal_pass` clobbers PC root signatures, root parameters, and dynamic depth-bias PSO state (`list_x.rs:134-147`, `depth_uav.rs:1317-1336, 1423-1435`)**: `FullscreenPass` calls `SetGraphicsRootSignature`/`SetComputeRootSignature` and `SetPipelineState` on the PC list (invalidating bound root parameters), but `restore_after_internal_pass` doesn't restore the title's PC root signature/root args or handle `using_fallback_pso`/`pso_dirty`/`RSSetDepthBiasX`. 4. **Multi-subresource barrier corruption & `StateBefore` mismatches (`depth_uav.rs:197-198, 563-642, 763-774, 802-827`)**: - `Entry` tracks only one `pc_state_depth`/`pc_state_stencil` per plane instead of per subresource, so a single-subresource barrier transitions *all* `0..per_plane` subresources. - `entering_uav` sets `before_depth`/`before_stencil` to the title's `before` instead of `prev_d`/`prev_s`. - In `before_bind_dsv`, `PlaneMask::Both` transitions both planes to `e.pc_state_depth` without updating `e.pc_state_stencil`. 5. **GPU UAF on unadopted pass descriptor heaps (`depth_uav.rs:1128, 1147, 1179, 328-346`)**: `pass_dsv_heap` and `pass_srv_uav_heap` are created via `orig_fn(dev_raw, 14)` (bypassing `late_release`), so `depth_uav::forget` drops them immediately even if a command list that bound them is still in flight on the GPU. 6. **Invalid `RENDER_TARGET` state allowed on `COMPUTE` lists (`format_alias.rs:755` `sync_pair`)**: The non-DIRECT guard `st & !0xC4F != 0` permits `0x4` (`RENDER_TARGET`), `0x2` (`INDEX_BUFFER`), and `0x1` (`VERTEX_AND_CONSTANT_BUFFER`), which are illegal on `COMPUTE` command lists. **Major** - `placed_uavs`/`placed_srvs` in `format_alias.rs` own `ID3D12Resource`s permanently (never evicted on `forget` or VA reuse), and `on_uav_barrier` copies every `PlacedUav` pair on the device on global `bind::activity()` changes. - `note_title_transition` returns early when `ACTIVE_PAIRS == 0` (leaving `pc_state` stale for textures that transitioned before their alias peer was created) and ignores `subresource` / split-barrier `BEGIN_ONLY` flags. - `try_copy_texture_region` skips `can_copy_through_buffer` and only compares `rows`/`RowPitch`/`Depth`, which can silently alias incompatible bytes-per-texel formats that share the same 256-byte-aligned `RowPitch`. - `dev_create_uav_x` (`real.rs:2435-2449`) creates the paired SRV (`slot.pc_srv`) on the original depth `res` rather than `uav_res` (`twin_res`).
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 00:59 UTC · original · edited 2026-11-25 01:10 UTC

Full-suite run, since this PR has no test report yet. Tested exact head 3443fd3 (on its base 8c4a46a).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 991 passed, 0 failed, 43 ignored. SKIPPED (no wave64): a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu, a_per_lane_2d_or_3d_group_runs_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, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware, the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.
  • The new tests ran and passed: twin_plans_cover_console_depth_formats, uav_format_and_plane_classification, state_machine_handles_split_and_async_compute_transitions, uav_barrier_returns_zero_for_untracked_resources, r32_uint_and_r9g9b9e5_alias_needs_buffer_through, placed_uav_and_srv_descs_are_sanitized, alias_table_links_in_both_creation_orders.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1001 passed, 0 failed, 45 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), f32_programs_on_the_gpu (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 7994cd1 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (#1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests and const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-25 00:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7149097721) · edited 2026-11-25 01:10 UTC Full-suite run, since this PR has no test report yet. Tested exact head `3443fd3` (on its base `8c4a46a`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests`: **991 passed, 0 failed, 43 ignored**. SKIPPED (no wave64): `a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu`, `a_per_lane_2d_or_3d_group_runs_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`, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`, `the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu`. - The new tests ran and passed: `twin_plans_cover_console_depth_formats`, `uav_format_and_plane_classification`, `state_machine_handles_split_and_async_compute_transitions`, `uav_barrier_returns_zero_for_untracked_resources`, `r32_uint_and_r9g9b9e5_alias_needs_buffer_through`, `placed_uav_and_srv_descs_are_sanitized`, `alias_table_links_in_both_creation_orders`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1`: **1001 passed, 0 failed, 45 ignored**. SKIPPED: `f16_programs_on_the_gpu` (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f16_programs_on_the_gpu` (f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `f32_programs_on_the_gpu` (f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `--skip` leaves out tests that fail on main `7994cd1` too, not because of this PR. On NVIDIA: `heap_window_out_of_memory_falls_back_to_the_switch_form` (#1651), the four `gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu` tests and `const_and_null_mask_operands_agree_with_hlsl_on_the_gpu` ([follow-up on #1651](https://git.gtahub.st/github/xcl-dev--xcl/issues/1651)) fail because `runner::skip_test` turns their skips into failures under `XCL_REQUIRE_GPU=mesh`, and `gpu::dxil::fuzz_tests` seeds 70, 545, 1019 and 1507 fail `CreateComputePipelineState` with `E_OUTOFMEMORY` on this card (drivers 616.64 and 621.40). On AMD: `fuzz_validate_and_gpu_1` fails on seed 540 (`res[833]` 0x7 vs CPU 0x6). The AMD run does not set `XCL_REQUIRE_GPU`. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠Anon64 on GitHub · 2026-11-25 01:47 UTC · original

Regression run for this PR: head 3443fd3, based on main 80f4819. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s, in one batch with the main run.

main 80f4819:

xcl-smoke v1
commit: 80f4819098e921f2e1ab371144d4832f68ffedd6
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1588 (PresentX 1589)
presents per 2 s (last 3): 47 56 27
device removals: 0
crashes: 0
peak commit: 25184 MB

this PR:

xcl-smoke v1
commit: 3443fd31adb9a16dde42b7ecbe6793ef3841d514
gpu: NVIDIA GeForce RTX 3060
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1592 (PresentX 1593)
presents per 2 s (last 3): 45 56 20
device removals: 0
crashes: 0
peak commit: 26294 MB

No device removals or crashes; 100 % of main's frames, 104 % of its peak commit.

Not tested: the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings: XCL_DIRECT_DXIL and XCL_HEAP_WINDOWS unset).

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

**@⁠Anon64** on GitHub · 2026-11-25 01:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7149963684) Regression run for this PR: head `3443fd3`, based on `main` `80f4819`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s, in one batch with the `main` run. main `80f4819`: ``` xcl-smoke v1 commit: 80f4819098e921f2e1ab371144d4832f68ffedd6 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1588 (PresentX 1589) presents per 2 s (last 3): 47 56 27 device removals: 0 crashes: 0 peak commit: 25184 MB ``` this PR: ``` xcl-smoke v1 commit: 3443fd31adb9a16dde42b7ecbe6793ef3841d514 gpu: NVIDIA GeForce RTX 3060 title: 21222967 seconds: 60 exit: 0x0 frames shown: 1592 (PresentX 1593) presents per 2 s (last 3): 45 56 20 device removals: 0 crashes: 0 peak commit: 26294 MB ``` No device removals or crashes; 100 % of main's frames, 104 % of its peak commit. **Not tested:** the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings: `XCL_DIRECT_DXIL` and `XCL_HEAP_WINDOWS` unset). Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:53 UTC · original

Thanks for the exhaustive review and every single catch, @gsucristo!

Updated #1989 cleanly onto bf9eebd (39d08cc), addressing all 6 Blocking + 4 Major findings:

  1. RAII buffer-copy cleanup (depth_uav.rs, format_alias.rs): replaced ManuallyDrop::new(Some(res.clone())) + mem::forget with RAII OwnedCopyLoc (ManuallyDrop::drop) so COM refcounts and VRAM never leak.
  2. Post-DepthToTwin UAV barrier (depth_uav.rs): emitted an explicit D3D12_RESOURCE_BARRIER_TYPE_UAV on twin immediately after FullscreenPass DepthToTwin dispatches.
  3. Internal-pass state restoration (bind.rs, list_x.rs): tracked bind::rs_cs alongside rs_gfx and updated list_x::restore_after_internal_pass(list, clobbered_gfx, clobbered_cs) to restore PC root signatures, bound_pso, using_fallback_pso/pso_dirty, and dynamic RSSetDepthBias.
  4. Per-subresource depth_uav tracking: replaced scalar plane states with per-subresource pc_states_depth/pc_states_stencil + split_uav_*, used tracked prev states on entering_uav, preserved separate per-subresource depth/stencil states on before_bind_dsv PlaneMask::Both, and scoped transitions/copies (copy_direct_subs, transition_plane_subs) to the targeted subresources.
  5. Deferred heap release (late_release.rs, depth_uav.rs, format_alias.rs): guarded late_release::drain_known with real::is_adopted and routed pass_dsv_heap/pass_srv_uav_heap teardown + evicted alias textures through late_release::hold.
  6. Compute-list state mask (format_alias.rs::sync_pair): replaced 0xC4F with COMPUTE_VALID_STATES = 0x8 | 0x40 | 0x400 | 0x800 (0xC48).
  7. Major catches (depth_uav.rs, format_alias.rs, real.rs): evicted stale/orphaned placed_uavs/placed_srvs on forget and VA reuse (late_release::hold), scoped on_uav_barrier to specific barrier targets when non-global, tracked note_title_transition before peer creation with per-subresource pc_states + BEGIN_ONLY ignore, validated element byte width and block-scaled dimensions in try_copy_texture_region, and pointed dev_create_uav_x's paired SRV (slot.pc_srv) at twin_res instead of depth res.

Compiled cleanly in release (0 errors) and pushed 39d08cc for GitHub Actions Build and test + reviewer verification.

**@⁠raylitebull** on GitHub · 2026-11-25 01:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7150083430) Thanks for the exhaustive review and every single catch, `@gsucristo`! Updated `#1989` cleanly onto `bf9eebd` (`39d08cc`), addressing all 6 Blocking + 4 Major findings: 1. **RAII buffer-copy cleanup (`depth_uav.rs`, `format_alias.rs`):** replaced `ManuallyDrop::new(Some(res.clone()))` + `mem::forget` with RAII `OwnedCopyLoc` (`ManuallyDrop::drop`) so COM refcounts and VRAM never leak. 2. **Post-`DepthToTwin` UAV barrier (`depth_uav.rs`):** emitted an explicit `D3D12_RESOURCE_BARRIER_TYPE_UAV` on `twin` immediately after `FullscreenPass` `DepthToTwin` dispatches. 3. **Internal-pass state restoration (`bind.rs`, `list_x.rs`):** tracked `bind::rs_cs` alongside `rs_gfx` and updated `list_x::restore_after_internal_pass(list, clobbered_gfx, clobbered_cs)` to restore PC root signatures, `bound_pso`, `using_fallback_pso`/`pso_dirty`, and dynamic `RSSetDepthBias`. 4. **Per-subresource `depth_uav` tracking:** replaced scalar plane states with per-subresource `pc_states_depth`/`pc_states_stencil` + `split_uav_*`, used tracked `prev` states on `entering_uav`, preserved separate per-subresource depth/stencil states on `before_bind_dsv` `PlaneMask::Both`, and scoped transitions/copies (`copy_direct_subs`, `transition_plane_subs`) to the targeted subresources. 5. **Deferred heap release (`late_release.rs`, `depth_uav.rs`, `format_alias.rs`):** guarded `late_release::drain_known` with `real::is_adopted` and routed `pass_dsv_heap`/`pass_srv_uav_heap` teardown + evicted alias textures through `late_release::hold`. 6. **Compute-list state mask (`format_alias.rs::sync_pair`):** replaced `0xC4F` with `COMPUTE_VALID_STATES = 0x8 | 0x40 | 0x400 | 0x800` (`0xC48`). 7. **Major catches (`depth_uav.rs`, `format_alias.rs`, `real.rs`):** evicted stale/orphaned `placed_uavs`/`placed_srvs` on `forget` and VA reuse (`late_release::hold`), scoped `on_uav_barrier` to specific barrier targets when non-global, tracked `note_title_transition` before peer creation with per-subresource `pc_states` + `BEGIN_ONLY` ignore, validated element byte width and block-scaled dimensions in `try_copy_texture_region`, and pointed `dev_create_uav_x`'s paired SRV (`slot.pc_srv`) at `twin_res` instead of depth `res`. Compiled cleanly in release (`0` errors) and pushed `39d08cc` for GitHub Actions `Build and test` + reviewer verification.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 01:58 UTC · original

Fixed the Build and test compile error in 197b104 (rebased cleanly onto 1e4fc10):

  • Passed None as the specific_targets argument to super::format_alias::on_uav_barrier(this, None) at crates/xcl/src/hle/d3d12x/list_x.rs:2889.
  • Removed the unused desc binding in crates/xcl/src/hle/d3d12x/real.rs.
**@⁠raylitebull** on GitHub · 2026-11-25 01:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7150166126) Fixed the `Build and test` compile error in `197b104` (rebased cleanly onto `1e4fc10`): - Passed `None` as the `specific_targets` argument to `super::format_alias::on_uav_barrier(this, None)` at `crates/xcl/src/hle/d3d12x/list_x.rs:2889`. - Removed the unused `desc` binding in `crates/xcl/src/hle/d3d12x/real.rs`.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 02:25 UTC · original

PR #1989 GPU verification

PR head 197b104b7a97a0fd9f68c7602291660802f552c4 was fetched from origin at refs/pull/1989/head and tested in a clean detached worktree. Fetched origin/main was aaa093657bd96a146c05c0c1a9b61149fe761453.

git merge-tree --write-tree origin/main HEAD exited 0 with tree c301c54bdb36c4dc9be3e1b1c779e01438160404 and no conflicts.

Tested

  • STOR-WINLAB, Intel Arc A770 16 GiB (driver 32.0.101.9175, DoublePrecisionFloatShaderOps=0, wave size 8–32), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation build 26200.9974. rustc 1.100.0 (0ef1bc386 2026-11-09). DXC and DXIL 1.9.2609.5.
  • cargo build --workspace and cargo test --workspace --no-run both succeeded in unoptimized profiles with debug info and incremental compilation disabled.
  • cargo test -p xcl --lib hle::d3d12x::depth_uav::tests -- --show-output reported 4 passed, 0 failed, 0 ignored, 0 skips.
  • cargo test -p xcl --lib hle::d3d12x::format_alias::tests -- --show-output reported 3 passed, 0 failed, 0 ignored, 0 skips.
  • Under the shared Arc A770 lock, cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output completed in one pass. Cargo exit 101. Across 20 harness summaries, libtest reported 1100 passed, 28 failed, 46 ignored. There were 27 SKIPPED lines across 17 tests, including partial skips. The harness pass count includes early returns. Skipped paths are excluded from coverage.
  • The library target had 27 failures. In 22, CreateComputePipelineState returned 0x80070057. The other five reported result mismatches in FMA contraction, implicit LOD sampling, split-wave reduction tails, 16/64-bit VALU, and pixel-shader whole-wave reductions.
  • The e2e target had one failure in test_title_runs_and_game_folder_is_untouched. Its dynamic depth-bias check (#94) read blue [0, 0, 255, 255] where the test expected green after RSSetDepthBiasX(-1000.5).
  • Full output is in the local suite log at L:\XclTooling\sol-slot-9\tmp\pr1989-suite.log.

SKIPPED output

SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu: const_mask, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu: mask_ff0_flbit, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)
SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2
SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))

Not tested

  • Retail-title smoke runs on main and the PR head, execution of the synthetic merge tree, and AMD or NVIDIA adapters. This run had no main baseline for the failures.
  • The suite reported missing XCL_SAMPLE_RPF, XCL_SAMPLE_TTPF, and XCL_SAMPLE_AWC inputs. The seven targeted CPU tests covered format, state, and alias tracking logic. Retail GPU execution of depth/UAV twin synchronization, alias copies, and dual-twin barriers remains unverified.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the build and tests and drafted this report. Coordinator #2 handles verification and publication.

Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against pr1989-suite.log and published this report.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 02:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7150711295) # PR #1989 GPU verification PR head `197b104b7a97a0fd9f68c7602291660802f552c4` was fetched from `origin` at `refs/pull/1989/head` and tested in a clean detached worktree. Fetched `origin/main` was `aaa093657bd96a146c05c0c1a9b61149fe761453`. `git merge-tree --write-tree origin/main HEAD` exited 0 with tree `c301c54bdb36c4dc9be3e1b1c779e01438160404` and no conflicts. **Tested** - STOR-WINLAB, Intel Arc A770 16 GiB (driver `32.0.101.9175`, `DoublePrecisionFloatShaderOps=0`, wave size 8–32), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation build `26200.9974`. `rustc 1.100.0 (0ef1bc386 2026-11-09)`. DXC and DXIL `1.9.2609.5`. - `cargo build --workspace` and `cargo test --workspace --no-run` both succeeded in unoptimized profiles with debug info and incremental compilation disabled. - `cargo test -p xcl --lib hle::d3d12x::depth_uav::tests -- --show-output` reported 4 passed, 0 failed, 0 ignored, 0 skips. - `cargo test -p xcl --lib hle::d3d12x::format_alias::tests -- --show-output` reported 3 passed, 0 failed, 0 ignored, 0 skips. - Under the shared Arc A770 lock, `cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output` completed in one pass. Cargo exit 101. Across 20 harness summaries, libtest reported **1100 passed, 28 failed, 46 ignored**. There were **27 SKIPPED lines across 17 tests**, including partial skips. The harness pass count includes early returns. Skipped paths are excluded from coverage. - The library target had 27 failures. In 22, `CreateComputePipelineState` returned `0x80070057`. The other five reported result mismatches in FMA contraction, implicit LOD sampling, split-wave reduction tails, 16/64-bit VALU, and pixel-shader whole-wave reductions. - The e2e target had one failure in `test_title_runs_and_game_folder_is_untouched`. Its dynamic depth-bias check (#94) read blue `[0, 0, 255, 255]` where the test expected green after `RSSetDepthBiasX(-1000.5)`. - Full output is in the local suite log at `L:\XclTooling\sol-slot-9\tmp\pr1989-suite.log`. **SKIPPED output** ~~~text SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)) SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu: const_mask, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)) SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu: mask_ff0_flbit, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)) SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64 SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64 SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64 SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64 SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D) SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2 SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)) ~~~ **Not tested** - Retail-title smoke runs on `main` and the PR head, execution of the synthetic merge tree, and AMD or NVIDIA adapters. This run had no `main` baseline for the failures. - The suite reported missing `XCL_SAMPLE_RPF`, `XCL_SAMPLE_TTPF`, and `XCL_SAMPLE_AWC` inputs. The seven targeted CPU tests covered format, state, and alias tracking logic. Retail GPU execution of depth/UAV twin synchronization, alias copies, and dual-twin barriers remains unverified. **AI use** T3 Code / Codex (gpt-6.2-sol) ran the build and tests and drafted this report. Coordinator #2 handles verification and publication. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against `pr1989-suite.log` and published this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 03:33 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 03:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7152023452) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-25 09:45 UTC · original

A test of this PR in the retail title's world, on the case that matters most there: a 2560 × 1440 D24S8 target that a compute program writes through its two UAVs and that the title's tiled lighting then tests with EQUAL. Full write-up, setup and numbers on #970: #970

Setup in short: 197b104 merged three-way into a local tree (main 689f2db + a stack of open PRs, listed in the linked comment; 9 conflicts, both sides kept), RTX 3090 24 GB (driver 616.56), Windows 11 22631.

  • The routing works: 257 UAVs routed to twins, no null view left.
  • The twin → depth copy never runs for this target: twins are marked dirty by resource-specific UAV barriers or legacy transitions (on_uav_barrier / filter_transition), and this title uses enhanced barriers (list #146), which end up as a global UAV barrier. So before_bind_dsv finds nothing dirty and the depth target stays 100 % zero.
  • With a local switch that copies the depth twin at every DSV bind of a D24S8, the target is written, but with two values only (0 and 1.0) where the title needs per-pixel values for its EQUAL test. I have not found yet whether that is the twin's content, the conversion of the R24_UNORM plane, or a later overwrite.

AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the merge and the runs) did this and drafted the comment.

**@⁠CharlyRien** on GitHub · 2026-11-25 09:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7158762448) **A test of this PR in the retail title's world, on the case that matters most there: a 2560 × 1440 D24S8 target that a compute program writes through its two UAVs and that the title's tiled lighting then tests with EQUAL.** Full write-up, setup and numbers on #970: https://git.gtahub.st/github/xcl-dev--xcl/issues/970 Setup in short: `197b104` merged three-way into a local tree (`main` `689f2db` + a stack of open PRs, listed in the linked comment; 9 conflicts, both sides kept), RTX 3090 24 GB (driver 616.56), Windows 11 22631. - The routing works: 257 UAVs routed to twins, no null view left. - The twin → depth copy never runs for this target: twins are marked dirty by resource-specific UAV barriers or legacy transitions (`on_uav_barrier` / `filter_transition`), and this title uses enhanced barriers (list #146), which end up as a global UAV barrier. So `before_bind_dsv` finds nothing dirty and the depth target stays 100 % zero. - With a local switch that copies the depth twin at every DSV bind of a D24S8, the target is written, but with two values only (0 and 1.0) where the title needs per-pixel values for its EQUAL test. I have not found yet whether that is the twin's content, the conversion of the `R24_UNORM` plane, or a later overwrite. **AI use**: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the merge and the runs) did this and drafted the comment.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 11:03 UTC · original

Thanks so much for catching the D24S8 Enhanced Barriers sync issue on RTX 3090, @CharlyRien (#issuecomment-7158762448)!

Rebased #1989 cleanly onto f087b998 (3c86172c) and fixed the Enhanced Barriers / global UAV sync path plus two additional bugs uncovered under the WARP D3D12 Debug Layer:

  1. Enhanced Barriers (#146 list_x::uav_barrier_x) & global UAV barriers (#26 res == 0):
    • Added depth_uav::filter_enhanced_barriers to parse D3D12_BARRIER_GROUP (D3D12_BARRIER_TYPE_TEXTURE and D3D12_BARRIER_TYPE_GLOBAL) on slot #146, executing TwinToDepth / DepthToTwin / TransitionOnly directly on DIRECT lists (handling Access*, Layout* including queue-specific layouts, DISCARD, UNDEFINED, and per-plane Subresources) and deferring cleanly on COMPUTE lists.
    • Added depth_uav::on_global_uav_barrier to mark materialized twins dirty on #146 global barriers and #26 wildcard UAV barriers only when !plane_dirty (so compute-written depth+UAV targets flush on before_bind_dsv without overwriting graphics-rendered depth targets).
  2. before_bind_dsv STATE_COMMON legal state & CreatePlacedResource #29 hook:
    • Recorded D3D12_DSV_FLAGS (READ_ONLY_DEPTH/READ_ONLY_STENCIL) in note_dsv so flushing a target still in STATE_COMMON transitions to legal DEPTH_READ/DEPTH_WRITE instead of illegal STATE_COMMON.
    • Hooked depth_uav::register_if_depth_uav into real.rs::dev_create_placed_resource_x (#29) and integrated upstream #1914 uav_companion_srv + null_uav_desc in dev_create_uav_x.
  3. 2-plane RowPitch mismatch in copy_plane_through_buffer (depth_uav.rs, format_alias.rs):
    • R24G8_TYPELESS plane 1 (stencil) can report RowPitch = 512 while its R8_TYPELESS twin reports 256, previously dropping the stencil copy on src_fp.RowPitch != dst_fp.RowPitch. Unified both footprints to max(src_pitch, dst_pitch) in both depth_uav.rs and format_alias.rs.

Verified on WARP (XCL_ADAPTER=warp, XCL_D3D12_DEBUG=1): cargo check --workspace --tests PASS (0 warnings in touched files) and hle::d3d12x::depth_uav + hle::d3d12x::format_alias 9 passed, 0 failed (0.07s), including enhanced_barriers_handle_texture_subresources_uav_and_discard and GPU draw test gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test (D24_UNORM_S8_UINT and D16_UNORM_S8_UINT DepthFunc = EQUAL + stencil preservation, 0 D3D12 debug errors). Pushed 3c86172c!

**@⁠raylitebull** on GitHub · 2026-11-25 11:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7160523356) Thanks so much for catching the D24S8 Enhanced Barriers sync issue on RTX 3090, `@CharlyRien` (`#issuecomment-7158762448`)! Rebased `#1989` cleanly onto `f087b998` (`3c86172c`) and fixed the Enhanced Barriers / global UAV sync path plus two additional bugs uncovered under the WARP D3D12 Debug Layer: 1. **Enhanced Barriers (`#146` `list_x::uav_barrier_x`) & global UAV barriers (`#26` `res == 0`):** - Added `depth_uav::filter_enhanced_barriers` to parse `D3D12_BARRIER_GROUP` (`D3D12_BARRIER_TYPE_TEXTURE` and `D3D12_BARRIER_TYPE_GLOBAL`) on slot `#146`, executing `TwinToDepth` / `DepthToTwin` / `TransitionOnly` directly on `DIRECT` lists (handling `Access*`, `Layout*` including queue-specific layouts, `DISCARD`, `UNDEFINED`, and per-plane `Subresources`) and deferring cleanly on `COMPUTE` lists. - Added `depth_uav::on_global_uav_barrier` to mark materialized twins dirty on `#146` global barriers and `#26` wildcard UAV barriers only when `!plane_dirty` (so compute-written depth+UAV targets flush on `before_bind_dsv` without overwriting graphics-rendered depth targets). 2. **`before_bind_dsv` `STATE_COMMON` legal state & `CreatePlacedResource` `#29` hook:** - Recorded `D3D12_DSV_FLAGS` (`READ_ONLY_DEPTH`/`READ_ONLY_STENCIL`) in `note_dsv` so flushing a target still in `STATE_COMMON` transitions to legal `DEPTH_READ`/`DEPTH_WRITE` instead of illegal `STATE_COMMON`. - Hooked `depth_uav::register_if_depth_uav` into `real.rs::dev_create_placed_resource_x` (`#29`) and integrated upstream `#1914` `uav_companion_srv` + `null_uav_desc` in `dev_create_uav_x`. 3. **2-plane `RowPitch` mismatch in `copy_plane_through_buffer` (`depth_uav.rs`, `format_alias.rs`):** - `R24G8_TYPELESS` plane 1 (stencil) can report `RowPitch = 512` while its `R8_TYPELESS` twin reports `256`, previously dropping the stencil copy on `src_fp.RowPitch != dst_fp.RowPitch`. Unified both footprints to `max(src_pitch, dst_pitch)` in both `depth_uav.rs` and `format_alias.rs`. Verified on WARP (`XCL_ADAPTER=warp`, `XCL_D3D12_DEBUG=1`): `cargo check --workspace --tests` PASS (`0` warnings in touched files) and `hle::d3d12x::depth_uav` + `hle::d3d12x::format_alias` **9 passed, 0 failed (`0.07s`)**, including `enhanced_barriers_handle_texture_subresources_uav_and_discard` and GPU draw test `gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test` (`D24_UNORM_S8_UINT` and `D16_UNORM_S8_UINT` `DepthFunc = EQUAL` + stencil preservation, `0` D3D12 debug errors). Pushed `3c86172c`!
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 11:12 UTC · original

Fixed the 0xc0000005 crash in gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test under --test-threads=4 in commit 51ee197c (rebased cleanly onto 96331383):

  • Root cause (test heap vtable ABI): the test called real::adopt(dev, Kind::Device) before creating its own test PC heaps/resources (uav_heap, dsv_heap, rtv_heap, PSOs, depth targets), causing uav_heap to be adopted with the console heap_cpu_start_x RAX-return ABI instead of PC's hidden out-param when called via windows-rs.
  • Fix (depth_uav.rs): created all test PC heaps, resources, footprints, and depth targets before adopting dev and list, used orig_fn(dev, 21) for CreateDepthStencilView after adoption, and cleaned up PIPELINES for dev on test exit.
  • Verified on WARP:
    • XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4 --skip pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa (2 consecutive runs): 214 passed, 0 failed, 2 ignored (0 crashes).
    • XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias": 9 passed, 0 failed (0.09s, 0 D3D12 debug errors).

Pushed 51ee197c!

**@⁠raylitebull** on GitHub · 2026-11-25 11:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7160745891) Fixed the `0xc0000005` crash in `gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test` under `--test-threads=4` in commit `51ee197c` (rebased cleanly onto `96331383`): - **Root cause (test heap vtable ABI):** the test called `real::adopt(dev, Kind::Device)` *before* creating its own test PC heaps/resources (`uav_heap`, `dsv_heap`, `rtv_heap`, PSOs, depth targets), causing `uav_heap` to be adopted with the console `heap_cpu_start_x` RAX-return ABI instead of PC's hidden out-param when called via `windows-rs`. - **Fix (`depth_uav.rs`):** created all test PC heaps, resources, footprints, and depth targets *before* adopting `dev` and `list`, used `orig_fn(dev, 21)` for `CreateDepthStencilView` after adoption, and cleaned up `PIPELINES` for `dev` on test exit. - **Verified on WARP:** - `XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4 --skip pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa` (2 consecutive runs): `214 passed, 0 failed, 2 ignored` (`0` crashes). - `XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias"`: `9 passed, 0 failed` (`0.09s`, `0` D3D12 debug errors). Pushed `51ee197c`!
Author
Owner

@⁠ivall on GitHub · 2026-11-25 15:16 UTC · original

The crash in gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test (0xc0000005, the CI failure of 51ee197 looks like it) is the test, not the twin code: fix below. With it, all tests of this PR pass on AMD.

On AMD RDNA4, Windows, DXC 1.8.2502.11, 51ee197 merged into my tree (main + other open PRs), debug, the test crashed every time without the debug layer and passed with XCL_D3D12_DEBUG=1.

Backtrace: list_x::transition (list_x.rs:124) ← execute_syncs ← before_bind_dsv ← phase 2 of the test, reading the vtable slot before the list's vtable at 0xffffffffffffffff. The runtime's Reset puts its own vtable back on the list; the title's path restores XCL's (preserve_vtable, called in list_x::reset_pc). The test calls the original Reset at both phase changes and does not. The debug layer's list does not swap it, so the test passed there.

// the runtime's Reset puts its own vtable back (as `list_x::reset_pc` knows)
let ext = *(list.as_raw() as *const usize);
assert_eq!(reset_orig(list.as_raw(), alloc.as_raw(), std::ptr::null_mut()), 0);
real::preserve_vtable(list.as_raw(), ext);

After both resets: cargo test -p xcl --lib -- hle::d3d12x --test-threads=4: 254 passed, 0 failed, 2 ignored (merged tree, so not only your tests).

Not checked: the D16_UNORM_S8 change you described (the stencil-read depth as R16_UINT times asfloat(0x37800080)) is not in 51ee197, so I have not run it; and no title run with this PR yet.

AI use: Claude Code (Claude Opus 5.5) found it, wrote the fix and this on the maintainer's behalf.

**@⁠ivall** on GitHub · 2026-11-25 15:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7166572303) **The crash in `gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test` (0xc0000005, the CI failure of `51ee197` looks like it) is the test, not the twin code: fix below. With it, all tests of this PR pass on AMD.** On AMD RDNA4, Windows, DXC 1.8.2502.11, `51ee197` merged into my tree (`main` + other open PRs), debug, the test crashed every time without the debug layer and passed with `XCL_D3D12_DEBUG=1`. Backtrace: `list_x::transition` (`list_x.rs:124`) ← `execute_syncs` ← `before_bind_dsv` ← phase 2 of the test, reading the vtable slot before the list's vtable at `0xffffffffffffffff`. The runtime's `Reset` puts its own vtable back on the list; the title's path restores XCL's (`preserve_vtable`, called in `list_x::reset_pc`). The test calls the original `Reset` at both phase changes and does not. The debug layer's list does not swap it, so the test passed there. ```rust // the runtime's Reset puts its own vtable back (as `list_x::reset_pc` knows) let ext = *(list.as_raw() as *const usize); assert_eq!(reset_orig(list.as_raw(), alloc.as_raw(), std::ptr::null_mut()), 0); real::preserve_vtable(list.as_raw(), ext); ``` After both resets: `cargo test -p xcl --lib -- hle::d3d12x --test-threads=4`: 254 passed, 0 failed, 2 ignored (merged tree, so not only your tests). Not checked: the `D16_UNORM_S8` change you described (the stencil-read depth as `R16_UINT` times `asfloat(0x37800080)`) is not in `51ee197`, so I have not run it; and no title run with this PR yet. AI use: Claude Code (Claude Opus 5.5) found it, wrote the fix and this on the maintainer's behalf.
Author
Owner

@⁠Toons29 on GitHub · 2026-11-25 03:51 UTC · original · edited 2026-11-25 15:29 UTC

Regression run of 51ee197c on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 1a0bbe3a, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1628 (PresentX 1628)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14561 MB
xcl-smoke v1
commit: 51ee197c69a3ba6ff37740457d4ecd39968c6e89
gpu: AMD Radeon RX 9070
title: 34df7c50
seconds: 60
exit: 0x0
frames shown: 1633 (PresentX 1633)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15027 MB

Against the limits in CONTRIBUTING.md: 100 % of main's frames, 103 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; both blocks are exactly as printed, and I approved posting this.

**@⁠Toons29** on GitHub · 2026-11-25 03:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7152305346) · edited 2026-11-25 15:29 UTC Regression run of `51ee197c` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `1a0bbe3a`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 1a0bbe3a2ba91ea8f5b6fc29130a053868d3c9e6 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1628 (PresentX 1628) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14561 MB ``` ``` xcl-smoke v1 commit: 51ee197c69a3ba6ff37740457d4ecd39968c6e89 gpu: AMD Radeon RX 9070 title: 34df7c50 seconds: 60 exit: 0x0 frames shown: 1633 (PresentX 1633) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15027 MB ``` Against the limits in CONTRIBUTING.md: 100 % of `main`'s frames, 103 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; both blocks are exactly as printed, and I approved posting this.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 18:15 UTC · original

Thanks for tracking down the debug-layer-off Reset vtable overwrite on RDNA4/CI and sharing the exact fix, @ivall (#issuecomment-7166572303)!

Updated #1989 cleanly onto 73e3aba6 (ced48914):

  • Test Reset vtable preservation (depth_uav.rs): wrapped both reset_orig calls in gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test with let ext = *(list.as_raw() as *const usize); assert_eq!(reset_orig(...), 0); real::preserve_vtable(list.as_raw(), ext); so the PC runtime's Reset does not overwrite XCL's vtable when XCL_D3D12_DEBUG=0.
  • Re D16_UNORM_S8_UINT depth/stencil note: for console D16_UNORM_S8_UINT (118..=120), depth_uav.rs allocates an R16_TYPELESS (53) depth twin and binds the FullscreenPass SRV as DXGI_FORMAT_R16_UNORM (56), which converts u16 depth directly in hardware without needing an explicit asfloat(0x37800080) scale (and if a title performs a separate stencil-view read on a D16_UNORM_S8_UINT texture, we can check that in a dedicated follow-up).
  • Verified on WARP (ced48914):
    • Debug layer OFF (matching CI): XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4 --skip pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa -> 236 passed, 0 failed, 2 ignored (4.25s, 0 crashes).
    • Debug layer ON: XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias" -> 9 passed, 0 failed (0.09s, 0 D3D12 debug errors).

Pushed ced48914!

**@⁠raylitebull** on GitHub · 2026-11-25 18:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7170655468) Thanks for tracking down the debug-layer-off `Reset` vtable overwrite on RDNA4/CI and sharing the exact fix, `@ivall` (`#issuecomment-7166572303`)! Updated `#1989` cleanly onto `73e3aba6` (`ced48914`): - **Test `Reset` vtable preservation (`depth_uav.rs`):** wrapped both `reset_orig` calls in `gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test` with `let ext = *(list.as_raw() as *const usize); assert_eq!(reset_orig(...), 0); real::preserve_vtable(list.as_raw(), ext);` so the PC runtime's `Reset` does not overwrite XCL's vtable when `XCL_D3D12_DEBUG=0`. - **Re `D16_UNORM_S8_UINT` depth/stencil note:** for console `D16_UNORM_S8_UINT` (`118..=120`), `depth_uav.rs` allocates an `R16_TYPELESS` (`53`) depth twin and binds the `FullscreenPass` SRV as `DXGI_FORMAT_R16_UNORM` (`56`), which converts `u16` depth directly in hardware without needing an explicit `asfloat(0x37800080)` scale *(and if a title performs a separate stencil-view read on a `D16_UNORM_S8_UINT` texture, we can check that in a dedicated follow-up)*. - **Verified on WARP (`ced48914`):** - Debug layer OFF (matching CI): `XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4 --skip pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa` -> `236 passed, 0 failed, 2 ignored` (`4.25s`, `0` crashes). - Debug layer ON: `XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias"` -> `9 passed, 0 failed` (`0.09s`, `0` D3D12 debug errors). Pushed `ced48914`!
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 18:24 UTC · original

Rebased #1989 cleanly onto 569f0fc5 in commit bfafdf77, resolving the real.rs adjacency conflict cleanly alongside #2280 (pc_clear_for_desc + effective_st).

Verified on WARP (bfafdf77):

  • cargo check --workspace --tests PASS (0 warnings in touched files).
  • Debug layer OFF (0 skips): XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4 -> 251 passed, 0 failed, 2 ignored (4.25s).
  • Debug layer ON: XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias" -> 9 passed, 0 failed (0.11s).

Pushed bfafdf77!

**@⁠raylitebull** on GitHub · 2026-11-25 18:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7170859688) Rebased `#1989` cleanly onto `569f0fc5` in commit `bfafdf77`, resolving the `real.rs` adjacency conflict cleanly alongside `#2280` (`pc_clear_for_desc` + `effective_st`). Verified on WARP (`bfafdf77`): - `cargo check --workspace --tests` PASS (`0` warnings in touched files). - Debug layer OFF (0 skips): `XCL_ADAPTER=warp cargo test -p xcl --lib "hle::d3d12x::" -- --test-threads=4` -> `251 passed, 0 failed, 2 ignored` (`4.25s`). - Debug layer ON: `XCL_ADAPTER=warp XCL_D3D12_DEBUG=1 cargo test -p xcl --lib -- --nocapture --test-threads=1 "hle::d3d12x::depth_uav" "hle::d3d12x::format_alias"` -> `9 passed, 0 failed` (`0.11s`). Pushed `bfafdf77`!
Author
Owner

@⁠St5sz2Jk on GitHub · 2026-11-26 00:00 UTC · original · edited 2026-11-26 01:50 UTC

Linux / Wine / RADV (RX 9070 XT) on bfafdf7: all of this PR's tests pass with vkd3d-proton once the GPU test's two direct submits use #871's UnadoptGuard (part 1). In the retail title the twins are created and sync thousands of times, but the cutscene frame behind the credits and subtitles stays the flat grey of #970. One run each.

Setup:

  • RX 9070 XT 16 GB (RDNA4), Mesa 26.3.1 RADV, Wine 11.22, vkd3d-proton ec207194.
  • The tree is this PR merged into my local AMD/Wine stack: main + #871 + #684 + #433 + #2357 (see #1269).
  • The only conflict was vram.rs (the fences of #871 against main's retire changes).

Correction (edited): my first version of part 1 came from a test run without WINEDLLOVERRIDES. It used Wine's built-in vkd3d, not vkd3d-proton, and that run failed at fmt 44 stencil at (2,2) (0 for 17). With vkd3d-proton loaded, as the title runs:

1. This PR's tests under Wine + vkd3d-proton (each run alone): 8 passed. gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test crashes:

local: depth+UAV sync twin->depth #1
wine: Unhandled page fault on read access to 0000000000002B28 at address 00006FE8213D7FBD
  • With the build's DWARF, that address is d3d12core.dll+0x597fbd = d3d12_command_queue_ExecuteCommandLists.cold. In other words, vkd3d-proton was handed a command list it does not recognise; its release build has the vtable check compiled out.
  • Confirmed (update): the test's two q.ExecuteCommandLists(&[Some(list.cast().unwrap())]) submit a list whose vtable XCL patched. Wrapped in #871's guard, the test passes on RADV + vkd3d-proton, stencil check included:
    { let _g = real::UnadoptGuard::new(list.as_raw()); q.ExecuteCommandLists(&[Some(list.cast().unwrap())]); }
    
    So the twin sync itself works on this driver. Only the test needs the guard under Wine (with #871). #1993's copy-back submit had the same crash, and the same line fixed it (#1993).

2. The retail title, to the opening cutscene (XCL_HEAP_WINDOWS=1, frame dumps):

  • Tracked, among others:
    • 2 × 2560x1440x1, console fmt 19, two_plane true;
    • 1 × 2560x1440x1, console fmt 118, two_plane true;
    • the D16 shadow maps (fmt 53).
  • Over about 90 s of cutscene, more than 2048 TwinToDepth and more than 4096 other syncs ran (execute_syncs, counted with local logging).
  • The frame behind the credits and subtitles stays the flat grey. (The title loads vkd3d-proton from the prefix, so part 2 is not affected by the correction.)

3. Two other things the runs showed (not caused by this PR):

  • With #871, main's new vram::retire_heaps_and_sweep makes its retire fences with dev.CreateFence. Under Wine the title then crashes about 20 s in, in RetireQueue::retire_with (IUnknown::clone, read of -1). real::create_raw_fence there fixes it. #871's current head 153730d already does this.
  • With this PR, the remaining null UAVs (a UAV of a resource that cannot have one on the PC (a depth buffer) – a null view) are not depth buffers. They are R8G8B8A8_UNORM_SRGB render targets with UNORM UAV views:
    • 24 × 2048², 1 × 1024², 2 × 2560×1440.
    • pc_resource_desc drops ALLOW_UNORDERED_ACCESS from them, because sRGB has no typed UAV.
    • Locally I made those resources R8G8B8A8_TYPELESS (and gave description-less RTVs of them an sRGB format). The null UAVs went away, but the grey stayed, so they are not the cause of it.

Update: a title assert with this PR in a longer run (one run each).

  • Two 25-minute runs, the same tree in both:
    • main 569f0fc + #871 + #684 + #2357 + #1993 (with its UnadoptGuard line) + #751;
    • XCL_TARGET_PAGES_MB=6144, warm caches.
  • Without this PR: 1,500 s, exit 0, no assert, more than 300 draws in 627 of 731 two-second samples.
  • With this PR (bfafdf7): the title asserts (0x80000003 at game+0x5149aec, 7 times) from about 614 s. I stopped the run there.
  • I don't know yet what at that site depends on the twins. The other trees I ran this PR in did not get that far: crashes elsewhere at 7–19 min, or the runs stopped at about 5 min.

Not tested:

  • Windows.
  • This PR on its own base without #871.

AI use: Claude Code (Claude Opus 5.5) merged the tree, ran the tests and the title, added the local logging, and wrote this comment.

**@⁠St5sz2Jk** on GitHub · 2026-11-26 00:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7178301699) · edited 2026-11-26 01:50 UTC **Linux / Wine / RADV (RX 9070 XT) on `bfafdf7`: all of this PR's tests pass with vkd3d-proton once the GPU test's two direct submits use #871's `UnadoptGuard` (part 1). In the retail title the twins are created and sync thousands of times, but the cutscene frame behind the credits and subtitles stays the flat grey of [#970](https://git.gtahub.st/github/xcl-dev--xcl/issues/970).** One run each. **Setup:** - RX 9070 XT 16 GB (RDNA4), Mesa 26.3.1 RADV, Wine 11.22, vkd3d-proton `ec207194`. - The tree is this PR merged into my local AMD/Wine stack: `main` + #871 + #684 + #433 + #2357 (see [#1269](https://git.gtahub.st/github/xcl-dev--xcl/issues/1269)). - The only conflict was `vram.rs` (the fences of #871 against `main`'s retire changes). **Correction (edited):** my first version of part 1 came from a test run without `WINEDLLOVERRIDES`. It used Wine's built-in vkd3d, not vkd3d-proton, and that run failed at `fmt 44 stencil at (2,2)` (0 for 17). With vkd3d-proton loaded, as the title runs: **1. This PR's tests under Wine + vkd3d-proton** (each run alone): 8 passed. `gpu_d24s8_and_d16s8_enhanced_barrier_twin_sync_passes_equal_depth_test` crashes: ``` local: depth+UAV sync twin->depth #1 wine: Unhandled page fault on read access to 0000000000002B28 at address 00006FE8213D7FBD ``` - With the build's DWARF, that address is `d3d12core.dll+0x597fbd` = `d3d12_command_queue_ExecuteCommandLists.cold`. In other words, vkd3d-proton was handed a command list it does not recognise; its release build has the vtable check compiled out. - Confirmed (update): the test's two `q.ExecuteCommandLists(&[Some(list.cast().unwrap())])` submit a list whose vtable XCL patched. Wrapped in #871's guard, the test **passes** on RADV + vkd3d-proton, stencil check included: ```rust { let _g = real::UnadoptGuard::new(list.as_raw()); q.ExecuteCommandLists(&[Some(list.cast().unwrap())]); } ``` So the twin sync itself works on this driver. Only the test needs the guard under Wine (with #871). #1993's copy-back submit had the same crash, and the same line fixed it ([#1993](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1993)). **2. The retail title, to the opening cutscene** (`XCL_HEAP_WINDOWS=1`, frame dumps): - Tracked, among others: - 2 × `2560x1440x1, console fmt 19, two_plane true`; - 1 × `2560x1440x1, console fmt 118, two_plane true`; - the D16 shadow maps (`fmt 53`). - Over about 90 s of cutscene, more than 2048 `TwinToDepth` and more than 4096 other syncs ran (`execute_syncs`, counted with local logging). - The frame behind the credits and subtitles stays the flat grey. (The title loads vkd3d-proton from the prefix, so part 2 is not affected by the correction.) **3. Two other things the runs showed** (not caused by this PR): - With #871, `main`'s new `vram::retire_heaps_and_sweep` makes its retire fences with `dev.CreateFence`. Under Wine the title then crashes about 20 s in, in `RetireQueue::retire_with` (`IUnknown::clone`, read of `-1`). `real::create_raw_fence` there fixes it. #871's current head `153730d` already does this. - With this PR, the remaining null UAVs (`a UAV of a resource that cannot have one on the PC (a depth buffer) – a null view`) are not depth buffers. They are `R8G8B8A8_UNORM_SRGB` render targets with UNORM UAV views: - 24 × 2048², 1 × 1024², 2 × 2560×1440. - `pc_resource_desc` drops `ALLOW_UNORDERED_ACCESS` from them, because sRGB has no typed UAV. - Locally I made those resources `R8G8B8A8_TYPELESS` (and gave description-less RTVs of them an sRGB format). The null UAVs went away, but the grey stayed, so they are not the cause of it. **Update: a title assert with this PR in a longer run (one run each).** - Two 25-minute runs, the same tree in both: - `main` `569f0fc` + #871 + #684 + #2357 + #1993 (with its `UnadoptGuard` line) + #751; - `XCL_TARGET_PAGES_MB=6144`, warm caches. - **Without this PR:** 1,500 s, exit 0, no assert, more than 300 draws in 627 of 731 two-second samples. - **With this PR (`bfafdf7`):** the title asserts (`0x80000003` at `game+0x5149aec`, 7 times) from about 614 s. I stopped the run there. - I don't know yet what at that site depends on the twins. The other trees I ran this PR in did not get that far: crashes elsewhere at 7–19 min, or the runs stopped at about 5 min. **Not tested:** - Windows. - This PR on its own base without #871. **AI use:** Claude Code (Claude Opus 5.5) merged the tree, ran the tests and the title, added the local logging, and wrote this comment.
Author
Owner

@⁠CharlyRien on GitHub · 2026-11-26 05:42 UTC · original

Test report, RTX 3090: a title-placed R32_UINT writer never reaches its R9G9B9E5 PlacedSrv reader when the title moves it with enhanced barriers. Copying it at the reader's bind, with copy buffers of its own, fills the screen-probe radiance atlas: from 0–10 KB to 2.5 MB non-zero of 4.96 MB. The picture is still over-exposed, so this is one missing piece, not a fix of the frame. One run per arm.

What happens (read in format_alias.rs)

  • The pair is created (buffer_through true). It is synced only from a legacy transition out of a write state, or from a UAV barrier for PlacedUav writers. This title uses enhanced barriers and a TitlePlaced writer, so neither path fires and the reader stays zero.

Local changes (local commits on our tree, not pushed)

  1. At the reader's bind: at each translated bind, the first 64 T#s of each table are resolved to resources. sync_pair runs for any PlacedSrv reader whose pair has a TitlePlaced writer. A UAV barrier and a null aliasing barrier come before the copy.
  2. Copy buffers of their own: the buffer-through copy took its intermediate from the per-list copy scratch, which is held until the list's reset and capped for all lists. That pool was exhausted, so 94 % of the copies were skipped, silently. Each list type now gets its own grown, kept staging buffer.
  3. Direct reinterpret copy: R32_UINT / R32_SINT ↔ R9G9B9E5 are on the "Reinterpret copy" list of CopyResource on Microsoft Learn, as 1:1 pairs. We copy texture to texture, with no intermediate buffer. Measured bit-exact on this 3090, with 0 debug-layer messages.

Measured (in the title, captures of the reading pass and of the frame)

run writer at the read reader at the read atlas after the filter pass
without (1)–(3), several runs (some with earlier copy variants) 199–250 KB non-zero 0–5,632 B 0–10,070 of 4,961,280 bytes
(1) without (2) – copies skipped (94 %, scratch exhausted) –
(1) + (2) 2,030,430 non-zero 2,030,430 (equal) 2.52 MB non-zero
(1) + (2) + (3), lighting run – 50 pairs copied, 0 copies not done –

Setup

  • RTX 3090 24 GB, driver 616.56, Windows 11 22631, release, direct DXIL.
  • Tree: main e1d84b7d merged with our integrated tree, which carries #1989 at 197b104 and #2384 (ported), plus local diagnostics. On top: the three changes above, behind local switches.
  • Env: XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_NETWORK=0 XCL_GPU_VIEW_BUFFERS=1 XCL_DIRECT_DXIL=1 XCL_PAGE_BUDGET_MB=1024 XCL_GPU_VIEW_MB=1024, plus the switches of each row.

Not tested: other GPUs; other pair formats.

AI use: Claude Code (Claude Opus 5.5, coordinating session and agents). The agents read captures and code, wrote the local switches and the analysis scripts, and drafted this report; the coordinating session ran the in-title runs and checked the numbers.

**@⁠CharlyRien** on GitHub · 2026-11-26 05:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7183733933) **Test report, RTX 3090: a title-placed R32_UINT writer never reaches its R9G9B9E5 `PlacedSrv` reader when the title moves it with enhanced barriers. Copying it at the reader's bind, with copy buffers of its own, fills the screen-probe radiance atlas: from 0–10 KB to 2.5 MB non-zero of 4.96 MB.** The picture is still over-exposed, so this is one missing piece, not a fix of the frame. One run per arm. **What happens** (read in `format_alias.rs`) - The pair is created (`buffer_through true`). It is synced only from a legacy transition out of a write state, or from a UAV barrier for `PlacedUav` writers. This title uses enhanced barriers and a `TitlePlaced` writer, so neither path fires and the reader stays zero. **Local changes** (local commits on our tree, not pushed) 1. **At the reader's bind:** at each translated bind, the first 64 T#s of each table are resolved to resources. `sync_pair` runs for any `PlacedSrv` reader whose pair has a `TitlePlaced` writer. A UAV barrier and a null aliasing barrier come before the copy. 2. **Copy buffers of their own:** the buffer-through copy took its intermediate from the per-list copy scratch, which is held until the list's reset and capped for all lists. That pool was exhausted, so **94 % of the copies were skipped**, silently. Each list type now gets its own grown, kept staging buffer. 3. **Direct reinterpret copy:** R32_UINT / R32_SINT ↔ R9G9B9E5 are on the "Reinterpret copy" list of `CopyResource` on Microsoft Learn, as 1:1 pairs. We copy texture to texture, with no intermediate buffer. Measured bit-exact on this 3090, with 0 debug-layer messages. **Measured** (in the title, captures of the reading pass and of the frame) | run | writer at the read | reader at the read | atlas after the filter pass | |---|---|---|---| | without (1)–(3), several runs (some with earlier copy variants) | 199–250 KB non-zero | 0–5,632 B | 0–10,070 of 4,961,280 bytes | | (1) without (2) | – | copies skipped (94 %, scratch exhausted) | – | | (1) + (2) | 2,030,430 non-zero | 2,030,430 (equal) | 2.52 MB non-zero | | (1) + (2) + (3), lighting run | – | 50 pairs copied, 0 copies not done | – | **Setup** - RTX 3090 24 GB, driver 616.56, Windows 11 22631, release, direct DXIL. - Tree: `main` `e1d84b7d` merged with our integrated tree, which carries #1989 at `197b104` and #2384 (ported), plus local diagnostics. On top: the three changes above, behind local switches. - Env: `XCL_HEAP_WINDOWS=1 XCL_UMA_SHADOW=1 XCL_NETWORK=0 XCL_GPU_VIEW_BUFFERS=1 XCL_DIRECT_DXIL=1 XCL_PAGE_BUDGET_MB=1024 XCL_GPU_VIEW_MB=1024`, plus the switches of each row. **Not tested:** other GPUs; other pair formats. AI use: Claude Code (Claude Opus 5.5, coordinating session and agents). The agents read captures and code, wrote the local switches and the analysis scripts, and drafted this report; the coordinating session ran the in-title runs and checked the numbers.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 06:51 UTC · original

Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-26 06:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/1989#issuecomment-7184856259) Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/list_x.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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