D3D12.X: give the queue-specific barrier layouts their resource states #839

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

@⁠mastrr9 on GitHub · 2026-11-24 06:39 UTC · original
mastrr9:fix/d3d12x-barrier-layout-states → main · +48 −11 · 1 files · 1 commits · open

Extends device_x::layout_state() (used by CreateCommittedResource #127 and CreatePlacedResourceX #133 when creating resources with a D3D12_BARRIER_LAYOUT) to map SHADING_RATE_SOURCE (11) and all DIRECT_QUEUE_* / COMPUTE_QUEUE_* layouts (18–29) to their legacy D3D12_RESOURCE_STATES equivalents instead of falling back to COMMON.

  • Maps COMPUTE_QUEUE_SHADER_RESOURCE (27) to NON_PIXEL_SHADER_RESOURCE (0x40), DIRECT_QUEUE_SHADER_RESOURCE (21) to ALL_SHADER_RESOURCE (0xC0), SHADING_RATE_SOURCE (11) to 0x100_0000, and the remaining direct/compute queue layouts (GENERIC_READ, UNORDERED_ACCESS, COPY_SOURCE, COPY_DEST) to their corresponding states.
  • Adds unit test barrier_layouts_become_resource_states verifying every layout constant by name against the windows crate definitions.

Tested

  • Hardware/OS: NVIDIA RTX 5080 (driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC debug, DXC Windows SDK 10.0.26100.0, d3d12SDKLayers.dll installed
  • Commit tested: ba90058f7c5017469e2acd411aa0dd61ae6fc343
  • cargo build --workspace: clean (only pre-existing fetch_update deprecation warning)
  • cargo test --workspace -- --test-threads=4: 714 passed, 0 failed, 41 ignored (new test hle::d3d12x::device_x::tests::barrier_layouts_become_resource_states passed)
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64

Regression run
Smoke run by @⁠CuteBooty in comment below: #839
Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted.

main:

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

PR:

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

Tester's setup: RTX 3070 8 GB (32-lane waves), NVIDIA 621.24; Ryzen 5 3600, 32 GB; Windows 11 Pro 26200; rustc 1.100.0 MSVC; release build.

Tester's method: scripts\smoke.ps1 -Game <folder> -Seconds 60, no input, on this PR's head as it is and on main beaa245, the commit it branches from, each from a clean checkout. Each build ran twice back to back; the blocks are the second runs. The main block is shared with the tester's reports on other PRs of the same base.

Tester's AI use: Claude Code (Claude Opus 5.5) made the runs with the tester present and wrote the report from the script's output.

Not tested

  • No retail title was available to the author; whether the community regression run above reaches the code this PR changes is not known.

AI use

  • Authored with Claude Code (Claude Opus 5.5); reviewed, audited, and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5).
  • Claude Code (Claude Sonnet 5.5) added the community regression run to this description and updated the lines that it made out of date or that the PR check requires.
**@⁠mastrr9** on GitHub · 2026-11-24 06:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/839) `mastrr9:fix/d3d12x-barrier-layout-states` → `main` · +48 −11 · 1 files · 1 commits · open Extends `device_x::layout_state()` (used by `CreateCommittedResource` #127 and `CreatePlacedResourceX` #133 when creating resources with a `D3D12_BARRIER_LAYOUT`) to map `SHADING_RATE_SOURCE` (11) and all `DIRECT_QUEUE_*` / `COMPUTE_QUEUE_*` layouts (18–29) to their legacy `D3D12_RESOURCE_STATES` equivalents instead of falling back to `COMMON`. - Maps `COMPUTE_QUEUE_SHADER_RESOURCE` (27) to `NON_PIXEL_SHADER_RESOURCE` (`0x40`), `DIRECT_QUEUE_SHADER_RESOURCE` (21) to `ALL_SHADER_RESOURCE` (`0xC0`), `SHADING_RATE_SOURCE` (11) to `0x100_0000`, and the remaining direct/compute queue layouts (`GENERIC_READ`, `UNORDERED_ACCESS`, `COPY_SOURCE`, `COPY_DEST`) to their corresponding states. - Adds unit test `barrier_layouts_become_resource_states` verifying every layout constant by name against the `windows` crate definitions. **Tested** - Hardware/OS: NVIDIA RTX 5080 (driver `617.42` / `32.0.16.1742`), Windows 11 Pro 25H2 (`26200.9974`), `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC debug, DXC Windows SDK `10.0.26100.0`, `d3d12SDKLayers.dll` installed - Commit tested: `ba90058f7c5017469e2acd411aa0dd61ae6fc343` - `cargo build --workspace`: clean (only pre-existing `fetch_update` deprecation warning) - `cargo test --workspace -- --test-threads=4`: **714 passed, 0 failed, 41 ignored** (new test `hle::d3d12x::device_x::tests::barrier_layouts_become_resource_states` passed) - `SKIPPED` GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` **Regression run** Smoke run by @⁠CuteBooty in comment below: https://git.gtahub.st/github/xcl-dev--xcl/pulls/839 Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted. main: ``` xcl-smoke v1 commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2 gpu: NVIDIA GeForce RTX 3070 title: game seconds: 60 exit: 0x0 frames shown: 1466 (PresentX 1466) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15248 MB ``` PR: ``` xcl-smoke v1 commit: b904fda4535b225f2feabe62fd41cbc68d489680 gpu: NVIDIA GeForce RTX 3070 title: game seconds: 60 exit: 0x0 frames shown: 1536 (PresentX 1536) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15535 MB ``` Tester's setup: RTX 3070 8 GB (32-lane waves), NVIDIA 621.24; Ryzen 5 3600, 32 GB; Windows 11 Pro 26200; rustc 1.100.0 MSVC; release build. Tester's method: `scripts\smoke.ps1 -Game <folder> -Seconds 60`, no input, on this PR's head as it is and on `main` `beaa245`, the commit it branches from, each from a clean checkout. Each build ran twice back to back; the blocks are the second runs. The `main` block is shared with the tester's reports on other PRs of the same base. Tester's AI use: Claude Code (Claude Opus 5.5) made the runs with the tester present and wrote the report from the script's output. **Not tested** - No retail title was available to the author; whether the community regression run above reaches the code this PR changes is not known. **AI use** - Authored with Claude Code (Claude Opus 5.5); reviewed, audited, and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5). - Claude Code (Claude Sonnet 5.5) added the community regression run to this description and updated the lines that it made out of date or that the PR check requires.
CreateCommittedResource (#127) and CreatePlacedResourceX (#133) of the
newer device layout take a D3D12_BARRIER_LAYOUT for the initial state,
which layout_state() turns into a legacy resource state. It knew layouts
0 to 10 only, so the DIRECT_QUEUE_* and COMPUTE_QUEUE_* layouts (18 to 29)
and SHADING_RATE_SOURCE (11) all became COMMON: a texture made in
DIRECT_QUEUE_SHADER_RESOURCE or COMPUTE_QUEUE_UNORDERED_ACCESS started in
COMMON on the PC while the title treats it as already in that layout.

Assisted-by: Claude Code (Claude Opus 5.5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:34:13 +00:00
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 07:06 UTC · original

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

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: 714 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: barrier_layouts_become_resource_states.

Not tested

  • AMD, 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 07:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/839#issuecomment-7124620928) Full-suite run, since this PR has no test report yet. Tested exact head `ba90058` (on its base `beaa245`). **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`: **714 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: `barrier_layouts_become_resource_states`. **Not tested** - AMD, 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

@⁠SlopTart on GitHub · 2026-11-24 07:17 UTC · original

Linux / AMD RDNA3 datapoint.

Merged state: head ba90058 onto main a1672ef, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 709 passed, 7 failed, 41 ignored. Failures are the known Wine-lane set from my #42 rows plus #718 trio members; nothing here fails because of your change. Queue-specific barrier layout tests green; no new failures.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 07:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/839#issuecomment-7124834467) Linux / AMD RDNA3 datapoint. **Merged state:** head `ba90058` onto main `a1672ef`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **709 passed, 7 failed, 41 ignored**. Failures are the known Wine-lane set from my #42 rows plus #718 trio members; nothing here fails because of your change. Queue-specific barrier layout tests green; no new failures. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠CuteBooty on GitHub · 2026-11-24 19:41 UTC · original

Regression run on a retail title for b904fda: pass (no device removal, no crash, frames and peak commit within the check's limits).

Tested

  • RTX 3070 8 GB (32-lane waves), NVIDIA 621.24; Ryzen 5 3600, 32 GB; Windows 11 Pro 26200; rustc 1.100.0 MSVC; release build.
  • scripts\smoke.ps1 -Game <folder> -Seconds 60, no input, on this PR's head as it is and on main beaa245, the commit it branches from, each from a clean checkout. Each build ran twice back to back; the blocks are the second runs. The main block is shared with my reports on other PRs of the same base.

main:

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

this PR:

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

Not tested

  • Whether the 60 s reach the code this PR changes, the world load, the test suite, current main merged in, AMD and Intel GPUs.

AI use

  • Claude Code (Claude Opus 5.5) made the runs with me present and wrote this from the script's output.
**@⁠CuteBooty** on GitHub · 2026-11-24 19:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/839#issuecomment-7142450572) Regression run on a retail title for `b904fda`: **pass** (no device removal, no crash, frames and peak commit within the check's limits). **Tested** - RTX 3070 8 GB (32-lane waves), NVIDIA 621.24; Ryzen 5 3600, 32 GB; Windows 11 Pro 26200; rustc 1.100.0 MSVC; release build. - `scripts\smoke.ps1 -Game <folder> -Seconds 60`, no input, on this PR's head as it is and on `main` `beaa245`, the commit it branches from, each from a clean checkout. Each build ran twice back to back; the blocks are the second runs. The `main` block is shared with my reports on other PRs of the same base. main: ``` xcl-smoke v1 commit: beaa245ca04e212f064efc7cafcdce104bc5c0a2 gpu: NVIDIA GeForce RTX 3070 title: game seconds: 60 exit: 0x0 frames shown: 1466 (PresentX 1466) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15248 MB ``` this PR: ``` xcl-smoke v1 commit: b904fda4535b225f2feabe62fd41cbc68d489680 gpu: NVIDIA GeForce RTX 3070 title: game seconds: 60 exit: 0x0 frames shown: 1536 (PresentX 1536) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15535 MB ``` **Not tested** - Whether the 60 s reach the code this PR changes, the world load, the test suite, current `main` merged in, AMD and Intel GPUs. **AI use** - Claude Code (Claude Opus 5.5) made the runs with me present and wrote this from the script's output.
Author
Owner

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

Empirical test report (b904fda4)

Verified PR #839 at commit b904fda4535b225f2feabe62fd41cbc68d489680.

Hardware / environment

  • Windows x64, build 26200, on AuthenticAMD family 23, model 113, stepping 0.
  • Rust 1.100.0 (0ef1bc386 2026-11-09). DXC 1.9.2609.5 (01b62ad47).
  • Cargo's unoptimized test profile with debug info and incremental compilation disabled. The focused run used XCL_ADAPTER=NONE_CPU_ONLY and RUST_TEST_NOCAPTURE=1, outside the Arc test wrapper.

Commands and results

  • cargo test --workspace --no-run exited 0 and built the workspace test executables. The compiler emitted a deprecation warning for AtomicU32::fetch_update in XGameRuntime.
  • cargo test -p xcl --lib hle::d3d12x::device_x::tests::barrier_layouts_become_resource_states -- --exact exited 0. The fixture log recorded 1 passed, 0 failed, 0 ignored, 0 SKIPPED lines, and 693 filtered out.

Observed behavior

The fixture called layout_state directly and all assertions against D3D12 resource state constants passed. Direct-queue shader resources mapped to all shader stages and compute-queue shader resources mapped to non-pixel shader access. Both queues' generic-read, unordered-access, copy-source and copy-destination layouts mapped to their corresponding legacy states. The shading-rate-source layout mapped to its dedicated state. Undefined and the queue-common cases covered by the fixture mapped to COMMON. The fixture requires no D3D12 device.

Not tested

The full GPU workspace suite and game smoke runs were omitted. The focused run exercised the translation function only. Resource creation and runtime barrier behavior on a D3D12 device remain unverified.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr839-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 05:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/839#issuecomment-7154298503) ### Empirical test report (b904fda4) Verified PR #839 at commit `b904fda4535b225f2feabe62fd41cbc68d489680`. **Hardware / environment** - Windows x64, build 26200, on AuthenticAMD family 23, model 113, stepping 0. - Rust `1.100.0 (0ef1bc386 2026-11-09)`. DXC `1.9.2609.5 (01b62ad47)`. - Cargo's unoptimized test profile with debug info and incremental compilation disabled. The focused run used `XCL_ADAPTER=NONE_CPU_ONLY` and `RUST_TEST_NOCAPTURE=1`, outside the Arc test wrapper. **Commands and results** - `cargo test --workspace --no-run` exited 0 and built the workspace test executables. The compiler emitted a deprecation warning for `AtomicU32::fetch_update` in XGameRuntime. - `cargo test -p xcl --lib hle::d3d12x::device_x::tests::barrier_layouts_become_resource_states -- --exact` exited 0. The fixture log recorded 1 passed, 0 failed, 0 ignored, 0 `SKIPPED` lines, and 693 filtered out. **Observed behavior** The fixture called `layout_state` directly and all assertions against D3D12 resource state constants passed. Direct-queue shader resources mapped to all shader stages and compute-queue shader resources mapped to non-pixel shader access. Both queues' generic-read, unordered-access, copy-source and copy-destination layouts mapped to their corresponding legacy states. The shading-rate-source layout mapped to its dedicated state. Undefined and the queue-common cases covered by the fixture mapped to `COMMON`. The fixture requires no D3D12 device. **Not tested** The full GPU workspace suite and game smoke runs were omitted. The focused run exercised the translation function only. Resource creation and runtime barrier behavior on a D3D12 device remain unverified. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr839-focused.log` and published.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 10:27 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 10:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/839#issuecomment-7159729635) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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