D3D12.X: depth+UAV buffers on the PC fallback paths start as depth writes #1353

Manually merged
github merged 1 commit from gh-pr/1353/head into gh-pr/1353/base 2026-11-26 04:51:45 +00:00
Owner

@⁠emirduran707 on GitHub · 2026-11-24 15:08 UTC · original
emirduran707:d3d12x-depth-uav-initial-state → main · +74 −9 · 2 files · 1 commits · merged 2026-11-24 15:57 UTC

pc_resource_desc drops ALLOW_UNORDERED_ACCESS from console depth buffers, since the PC does not allow it together with ALLOW_DEPTH_STENCIL. Only CreatePlacedResourceX (#44) also moved such a buffer's initial state off UNORDERED_ACCESS, to DEPTH_WRITE. Three other paths that use the same converted description only masked the state:

  • the committed fallback of CreateCommittedResource (#27 / #76 / #127), taken when the texture cannot be placed in unified memory;
  • the PC-way retry and committed fallback of CreatePlacedResource (#29);
  • own_memory_if_larger_on_the_pc.

So a console texture created as depth + unordered access in the UNORDERED_ACCESS state was refused there with E_INVALIDARG (D3D12 allows that state only with ALLOW_UNORDERED_ACCESS), or fell back to COMMON.

A helper, pc_initial_state, now does what #44 did (mask, then UNORDERED_ACCESS → DEPTH_WRITE for a depth buffer), and all four sites use it.

What is in it

  • crates/xcl/src/hle/d3d12x/device_x.rs:
    • pc_initial_state, used at #44 (same result as before);
    • unit test depth_buffers_created_for_unordered_access_start_as_depth;
    • GPU test gpu_depth_buffer_created_for_unordered_access_is_placed. It places a 256x256 D16 depth + UAV texture: with the masked state the PC refuses it, and with pc_initial_state's state it is created.
  • crates/xcl/src/hle/d3d12x/real.rs: the three other sites.

Tested

  • AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release
  • cargo test --workspace -- --test-threads=4 on 5383506: 753 passed, 0 failed, 41 ignored; no SKIPPED GPU tests; the GPU test ran on this adapter and shows both the refusal and the fix
  • the unit test against the mask alone (the old behaviour): left: 8, right: 16; with the helper it passes

Regression run

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1530 (PresentX 1530)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18961 MB

this PR:

xcl-smoke v1
commit: 538350681e4aac86b4dd5595a0ac229077b07979
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1551 (PresentX 1551)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16754 MB

Not tested

  • A title texture taking one of these fallback paths; the smoke title's run is a regression check only.
  • #1063 registers depth twins only on the #44 path; resources from the fallback paths are made in DEPTH_WRITE now but are not tracked by it.
  • NVIDIA and Intel GPUs.

AI use

  • Claude Code with Claude Opus 5.5: found the problem, wrote the change, the tests and this description; I reviewed the diff and ran the tests and smoke runs above.

🤖 Generated with Claude Code

**@⁠emirduran707** on GitHub · 2026-11-24 15:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/1353) `emirduran707:d3d12x-depth-uav-initial-state` → `main` · +74 −9 · 2 files · 1 commits · merged 2026-11-24 15:57 UTC `pc_resource_desc` drops `ALLOW_UNORDERED_ACCESS` from console depth buffers, since the PC does not allow it together with `ALLOW_DEPTH_STENCIL`. Only `CreatePlacedResourceX` (#44) also moved such a buffer's initial state off `UNORDERED_ACCESS`, to `DEPTH_WRITE`. Three other paths that use the same converted description only masked the state: - the committed fallback of `CreateCommittedResource` (#27 / #76 / #127), taken when the texture cannot be placed in unified memory; - the PC-way retry and committed fallback of `CreatePlacedResource` (#29); - `own_memory_if_larger_on_the_pc`. So a console texture created as depth + unordered access in the `UNORDERED_ACCESS` state was refused there with `E_INVALIDARG` (D3D12 allows that state only with `ALLOW_UNORDERED_ACCESS`), or fell back to COMMON. A helper, `pc_initial_state`, now does what #44 did (mask, then `UNORDERED_ACCESS` → `DEPTH_WRITE` for a depth buffer), and all four sites use it. **What is in it** - `crates/xcl/src/hle/d3d12x/device_x.rs`: - `pc_initial_state`, used at #44 (same result as before); - unit test `depth_buffers_created_for_unordered_access_start_as_depth`; - GPU test `gpu_depth_buffer_created_for_unordered_access_is_placed`. It places a 256x256 D16 depth + UAV texture: with the masked state the PC refuses it, and with `pc_initial_state`'s state it is created. - `crates/xcl/src/hle/d3d12x/real.rs`: the three other sites. **Tested** - AMD Radeon RX 9060 XT (driver 32.0.31044.16), Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0; tests debug, smoke release - `cargo test --workspace -- --test-threads=4` on 5383506: 753 passed, 0 failed, 41 ignored; no SKIPPED GPU tests; the GPU test ran on this adapter and shows both the refusal and the fix - the unit test against the mask alone (the old behaviour): `left: 8`, `right: 16`; with the helper it passes **Regression run** main: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1530 (PresentX 1530) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18961 MB ``` this PR: ``` xcl-smoke v1 commit: 538350681e4aac86b4dd5595a0ac229077b07979 gpu: AMD Radeon RX 9060 XT title: retail-title seconds: 60 exit: 0x0 frames shown: 1551 (PresentX 1551) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16754 MB ``` **Not tested** - A title texture taking one of these fallback paths; the smoke title's run is a regression check only. - #1063 registers depth twins only on the #44 path; resources from the fallback paths are made in `DEPTH_WRITE` now but are not tracked by it. - NVIDIA and Intel GPUs. **AI use** - Claude Code with Claude Opus 5.5: found the problem, wrote the change, the tests and this description; I reviewed the diff and ran the tests and smoke runs above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`pc_resource_desc` takes ALLOW_UNORDERED_ACCESS from a depth buffer the
console also lets shaders write (the PC refuses ALLOW_DEPTH_STENCIL with
ALLOW_UNORDERED_ACCESS). Only CreatePlacedResourceX (#44) moved such a
resource's initial state off UNORDERED_ACCESS as well (to DEPTH_WRITE).
The other paths that create a resource of the converted description
only masked the state with PC_RESOURCE_STATES: the committed fallback of
CreateCommittedResource (#27 / #76 / #127, reached without unified
memory or when its coherent window is full), the PC-way retry and the
committed fallback of CreatePlacedResource (#29), and its memory-of-its-
own path for textures larger on the PC. A console texture with flags
DEPTH_STENCIL | UNORDERED_ACCESS created in UNORDERED_ACCESS was then
asked for in a state D3D12 refuses for a resource without the UAV flag
(E_INVALIDARG; the #29 own-memory path fell back to COMMON).

`device_x::pc_initial_state` does both steps; #44 uses it with no change
in behaviour, and the four other sites use it with the console flags
(or the PC description's, which keep ALLOW_DEPTH_STENCIL).

Tests: a unit test of the helper; a GPU test placing a 256x256 D16
depth+UAV texture in UNORDERED_ACCESS as XCL now does (not run here).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:51:43 +00:00
github manually merged commit 538350681e into gh-pr/1353/base 2026-11-26 04:51:45 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 15:15 UTC · original · edited 2026-11-24 15:20 UTC

Full-suite run, since this PR has no test report yet. Tested exact head 5383506 (on its base 930e8b4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 753 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: depth_buffers_created_for_unordered_access_start_as_depth, gpu_depth_buffer_created_for_unordered_access_is_placed.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 753 passed, 0 failed, 41 ignored, no skips.

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-24 15:15 UTC · [original](https://github.com/xcl-dev/xcl/pull/1353#issuecomment-7135733743) · edited 2026-11-24 15:20 UTC Full-suite run, since this PR has no test report yet. Tested exact head `5383506` (on its base `930e8b4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **753 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `depth_buffers_created_for_unordered_access_start_as_depth`, `gpu_depth_buffer_created_for_unordered_access_is_placed`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **753 passed, 0 failed, 41 ignored**, no skips. **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

@⁠Mischief8713 on GitHub · 2026-11-24 15:55 UTC · original

GPU run of 5383506 on Windows (NVIDIA GTX 1660 Ti, Turing): 709 passed, 0 failed; the new test passes

Tested

  • NVIDIA GeForce GTX 1660 Ti 6 GB (Turing, driver 32.0.16.2114), Ryzen 5 2600X, Windows 11 (10.0.26300), rustc 1.100.0, debug build
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4
  • SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64)
  • main at 930e8b4 on the same machine: lib 707 passed, 0 failed, 21 ignored; e2e 3 passed
  • The head contains current main.
  • lib: 709 passed, 0 failed, 21 ignored. hle::d3d12x::device_x::tests::gpu_depth_buffer_created_for_unordered_access_is_placed ran on the GPU and passed (it did not print SKIPPED).

Not tested

  • No retail title and no scripts/smoke.ps1 run, so no regression run
  • AMD GPUs; only Turing was run here

AI use

  • Claude Code with Claude Sonnet 5.5 ran the commands and wrote this report. I checked the output.
**@⁠Mischief8713** on GitHub · 2026-11-24 15:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1353#issuecomment-7136829668) **GPU run of `5383506` on Windows (NVIDIA GTX 1660 Ti, Turing): 709 passed, 0 failed; the new test passes** **Tested** - NVIDIA GeForce GTX 1660 Ti 6 GB (Turing, driver 32.0.16.2114), Ryzen 5 2600X, Windows 11 (10.0.26300), rustc 1.100.0, debug build - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` - SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (no wave64) - `main` at `930e8b4` on the same machine: lib 707 passed, 0 failed, 21 ignored; `e2e` 3 passed - The head contains current `main`. - lib: 709 passed, 0 failed, 21 ignored. `hle::d3d12x::device_x::tests::gpu_depth_buffer_created_for_unordered_access_is_placed` ran on the GPU and passed (it did not print SKIPPED). **Not tested** - No retail title and no `scripts/smoke.ps1` run, so no regression run - AMD GPUs; only Turing was run here **AI use** - Claude Code with Claude Sonnet 5.5 ran the commands and wrote this report. I checked the output.
This discussion has been locked. Commenting is limited to contributors.
No description provided.