D3D12.X: preserve startup clears when target state is unknown #1324

Open
github-bot wants to merge 3 commits from github-bot/gh-1324 into main AGit
Owner

@⁠gloger2003 on GitHub · 2026-11-24 14:47 UTC · original
gloger2003:fix/startup-clear-queue-order → main · +713 −20 · 5 files · 3 commits · open

Stacked on #1261. Only c3f17d3 belongs to this PR. Review the follow-up diff.

A queue can wait on producer work that has yet to be submitted, so CPU submission order alone cannot establish a target's state. An alias barrier can also change which texture is active inside a recorded list. Keep title commands in these cases and skip automatic preparation for affected targets.

What is in it

  • Track outstanding queue waits and serialize native submission with preparation planning and wait registration in the existing opt-in mode.
  • Invalidate inferred states after unresolved waits and alias barriers. Auxiliary lists stay outside title lists, so they cannot cross an activation or a deactivation.
  • Test a real D3D12 handoff with the consumer submitted first, expiry of waits, overlapping CPU calls, and named and unnamed alias barriers.

Tested

  • On rebased head c3f17d3, Windows 11 x64, Ryzen 7 5700X, Radeon RX 7800 XT.
  • cargo build --offline --locked --release -p xcl on main and the rebased head.
  • cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output on the rebased head. 966 reported passed, 0 failed, 43 ignored. Runtime skips: 7 (gpu, heap_window_out_of_memory_falls_back_to_the_switch_form).

Earlier testing on 8a48b44, its predecessor and the indicated integration tree:

  • Radeon RX 7800 XT with driver 32.0.32029.2010, Ryzen 7 5700X, Windows 11 build 26300.9974, Rust 1.100.0 MSVC.
  • cargo build --offline --locked --workspace and cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output. The tests ran with XCL_TEST_PREP_SUBMITTED_TARGETS=1. 758 passed, 0 failed, 41 ignored, 0 capability skips.
  • Minecraft Preview on Xbox Series at 1x with the D3D12 debug layer. The startup target errors were absent with the opt-in flag. The run reported two existing warnings and one occurrence of the separate issue #262. Both runs exited normally.
  • Supplemental integration on main c160d86 at local merge f4be315, which includes #1038, #1047, #1087, #1105, #1156, #1261 and #1324. On the RX 7800 XT, matched 30-second Minecraft Preview runs at 1x with the debug layer and DRED had six startup errors with preparation disabled (three each of IDs 527 and 538) and zero with it enabled. Both runs showed the menu, exited cleanly and reported two Input Layout warnings. The sampled frame at present 1340 had 124,446 and 124,432 non-dark samples out of 129,600.
  • On the same integration tree with preparation enabled, the workspace harness reported 868 passed, 0 failed and 42 ignored, including one optional heap-window test that reported a skip. That test passed in a separate opt-in heap-window run on the same tree. A 30-second run at 4x MSAA with direct DXIL and preparation both enabled showed 1,474 frames with no device removals, crashes or D3D12 debug-layer errors.
  • Independent Windows coverage on RTX 3060 Ti and a 60-second Wine run on exact head 8a48b44. The Wine report did not establish that the title took the opt-in path.

Regression run

Minecraft Preview at 1x, 30 seconds per build. XCL_TEST_PREP_SUBMITTED_TARGETS=1 was set for both runs.

xcl-smoke v1
commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331
gpu: AMD Radeon RX 7800 XT
title: c22a3829
seconds: 30
exit: 0x0
frames shown: 1556 (PresentX 1556)
presents per 2 s (last 3): 120 120 120
device removals: 0
crashes: 0
peak commit: 3384 MB
xcl-smoke v1
commit: c3f17d382fa7e9abef05628e4da6b0cd288118db
gpu: AMD Radeon RX 7800 XT
title: c22a3829
seconds: 30
exit: 0x0
frames shown: 1623 (PresentX 1623)
presents per 2 s (last 3): 120 120 120
device removals: 0
crashes: 0
peak commit: 3345 MB

Not tested

  • Other titles, gameplay past the menu, other hardware drivers, and DRED on this revision.
  • The real-title run covers the normal startup path. The consumer-first queue order and alias fallbacks are covered by the local tests.

AI use

  • OpenAI Codex with GPT-6.2 Sol investigated the behavior, implemented the guard and tests, and ran the checks. The recorded reasoning effort was medium for the initial changes and high for the follow-up. Fast mode was selected in Codex for the high-effort work.
  • OpenAI Codex (GPT-6.2 Sol, high reasoning effort, Fast mode) rebased the changes, resolved the upstream conflict and reran the checks.
**@⁠gloger2003** on GitHub · 2026-11-24 14:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1324) `gloger2003:fix/startup-clear-queue-order` → `main` · +713 −20 · 5 files · 3 commits · open Stacked on #1261. Only `c3f17d3` belongs to this PR. [Review the follow-up diff](https://github.com/gloger2003/xcl/compare/14dfb3891410f43890f3b8fe966def70de111798...c3f17d382fa7e9abef05628e4da6b0cd288118db). A queue can wait on producer work that has yet to be submitted, so CPU submission order alone cannot establish a target's state. An alias barrier can also change which texture is active inside a recorded list. Keep title commands in these cases and skip automatic preparation for affected targets. **What is in it** - Track outstanding queue waits and serialize native submission with preparation planning and wait registration in the existing opt-in mode. - Invalidate inferred states after unresolved waits and alias barriers. Auxiliary lists stay outside title lists, so they cannot cross an activation or a deactivation. - Test a real D3D12 handoff with the consumer submitted first, expiry of waits, overlapping CPU calls, and named and unnamed alias barriers. **Tested** - On rebased head `c3f17d3`, Windows 11 x64, Ryzen 7 5700X, Radeon RX 7800 XT. - `cargo build --offline --locked --release -p xcl` on main and the rebased head. - `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output` on the rebased head. 966 reported passed, 0 failed, 43 ignored. Runtime skips: 7 (gpu, heap_window_out_of_memory_falls_back_to_the_switch_form). Earlier testing on `8a48b44`, its predecessor and the indicated integration tree: - Radeon RX 7800 XT with driver 32.0.32029.2010, Ryzen 7 5700X, Windows 11 build 26300.9974, Rust 1.100.0 MSVC. - `cargo build --offline --locked --workspace` and `cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-output`. The tests ran with `XCL_TEST_PREP_SUBMITTED_TARGETS=1`. 758 passed, 0 failed, 41 ignored, 0 capability skips. - Minecraft Preview on Xbox Series at 1x with the D3D12 debug layer. The startup target errors were absent with the opt-in flag. The run reported two existing warnings and one occurrence of the separate issue #262. Both runs exited normally. - Supplemental integration on main `c160d86` at local merge `f4be315`, which includes #1038, #1047, #1087, #1105, #1156, #1261 and #1324. On the RX 7800 XT, matched 30-second Minecraft Preview runs at 1x with the debug layer and DRED had six startup errors with preparation disabled (three each of IDs 527 and 538) and zero with it enabled. Both runs showed the menu, exited cleanly and reported two Input Layout warnings. The sampled frame at present 1340 had 124,446 and 124,432 non-dark samples out of 129,600. - On the same integration tree with preparation enabled, the workspace harness reported 868 passed, 0 failed and 42 ignored, including one optional heap-window test that reported a skip. That test passed in a separate opt-in heap-window run on the same tree. A 30-second run at 4x MSAA with direct DXIL and preparation both enabled showed 1,474 frames with no device removals, crashes or D3D12 debug-layer errors. - Independent [Windows coverage on RTX 3060 Ti](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1324) and a [60-second Wine run on exact head `8a48b44`](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1324). The Wine report did not establish that the title took the opt-in path. **Regression run** Minecraft Preview at 1x, 30 seconds per build. `XCL_TEST_PREP_SUBMITTED_TARGETS=1` was set for both runs. ``` xcl-smoke v1 commit: 1d027e5c76c9a86a7ee2ca1cc677edf0be95d331 gpu: AMD Radeon RX 7800 XT title: c22a3829 seconds: 30 exit: 0x0 frames shown: 1556 (PresentX 1556) presents per 2 s (last 3): 120 120 120 device removals: 0 crashes: 0 peak commit: 3384 MB ``` ``` xcl-smoke v1 commit: c3f17d382fa7e9abef05628e4da6b0cd288118db gpu: AMD Radeon RX 7800 XT title: c22a3829 seconds: 30 exit: 0x0 frames shown: 1623 (PresentX 1623) presents per 2 s (last 3): 120 120 120 device removals: 0 crashes: 0 peak commit: 3345 MB ``` **Not tested** - Other titles, gameplay past the menu, other hardware drivers, and DRED on this revision. - The real-title run covers the normal startup path. The consumer-first queue order and alias fallbacks are covered by the local tests. **AI use** - OpenAI Codex with GPT-6.2 Sol investigated the behavior, implemented the guard and tests, and ran the checks. The recorded reasoning effort was medium for the initial changes and high for the follow-up. Fast mode was selected in Codex for the high-effort work. - OpenAI Codex (GPT-6.2 Sol, high reasoning effort, Fast mode) rebased the changes, resolved the upstream conflict and reran the checks.
Track the submitted state of eligible placed textures. Add transitions around startup clears when needed and keep auxiliary lists alive until the GPU has finished.

Keep the path opt-in while testing more queue and resource patterns.

Assisted-by: OpenAI Codex (GPT-6)
Keep the title transition when building the submission preparation fails. Restore the expected state in a separate barrier call to avoid a duplicate-subresource diagnostic, and exercise normal and fallback behavior in the texture-state test.

Assisted-by: OpenAI Codex (GPT-6)
An unresolved queue wait can put a submitted clear behind producer work that has not reached the GPU queue yet. Keep the title commands in this case and stop inferring states for the targets involved. Serialize the planning and submission with waits, and avoid inserting transitions across alias activation or deactivation.

Assisted-by: OpenAI Codex (GPT-6.2 Sol)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:50:47 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 15:18 UTC · original

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

  • cargo test -p xcl --lib: 713 passed, 0 failed, 21 ignored (one earlier run hit the known coherent_buffer_sanitizes flake from #913; clean on rerun).

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 15:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/1324#issuecomment-7135813390) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 713 passed, 0 failed, 21 ignored (one earlier run hit the known `coherent_buffer_sanitizes` flake from #913; clean on rerun). Thanks!
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-24 15:28 UTC · original

A regression run under Wine on Linux, on a retail title.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. 8a48b44 as it is and main 930e8b4, no uncommitted changes. Retail title 1.0.2.1, scripts/linux/smoke.sh (#257) for 60 s, no input. Nine runs in a row, main first and last, other PRs in between.
  • A regression check: I did not check whether GTA VI reaches the changed code in these 60 s.

Regression run

main (first run):

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1371 (PresentX 1371)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

this PR:

xcl-smoke v1
commit: 8a48b441687ed8fd057618d3a93e985f9a1c18c6
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1333 (PresentX 1333)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

The last main run: 1338 frames, exit: 0x0, no device removal, no crash. Under Wine, peak commit reads 0 MB, so these blocks do not check memory.

Not tested

  • the test suite on this head; native Windows; AMD.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-24 15:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1324#issuecomment-7136076748) A regression run under Wine on Linux, on a retail title. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `8a48b44` as it is and `main` `930e8b4`, no uncommitted changes. Retail title 1.0.2.1, `scripts/linux/smoke.sh` (#257) for 60 s, no input. Nine runs in a row, `main` first and last, other PRs in between. - A regression check: I did not check whether GTA VI reaches the changed code in these 60 s. **Regression run** main (first run): ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1371 (PresentX 1371) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` this PR: ``` xcl-smoke v1 commit: 8a48b441687ed8fd057618d3a93e985f9a1c18c6 gpu: NVIDIA GeForce RTX 3060 title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1333 (PresentX 1333) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` The last `main` run: 1338 frames, `exit: 0x0`, no device removal, no crash. Under Wine, `peak commit` reads 0 MB, so these blocks do not check memory. **Not tested** - the test suite on this head; native Windows; AMD. **AI use** - Claude Code (Claude Opus 5.5) built both commits, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 15:58 UTC · original

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

  • cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodified main.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 15:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/1324#issuecomment-7136920591) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib -- --test-threads=1`: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodified `main`.) Thanks!
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:53 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 04:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1324#issuecomment-7182988979) 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/real.rs
  • crates/xcl/tests/texture_states.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/1324/head:github-bot/gh-1324'
git switch 'github-bot/gh-1324'

Merge

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