GPU binding, barrier and readback fixes, with lightweight D3D12 validation for tests #594

Open
deama wants to merge 13 commits from deama/Darner:pr/1-gpu-fixes-validation into Main
First-time contributor

Not run in the game on Darner. These changes come from a local VIctory-NVIDIA branch (before the rename) and were ported onto Darner's main. The notes below about software (WARP) and RTX 4080 checks describe that branch, not this port.

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: read from the code, and from strict D3D12 validation (WARP, debug layer) on the VIctory branch these fixes came from.

Thirteen small fixes, each its own commit:

  • Bindings are restored after an external callback that fails (the list's root signature, heaps and pipeline were left as the callback set them).
  • Lightweight D3D12 validation without per-draw tracing: a gpu-validation feature, DARNER_D3D12_ERROR_ABORT=1 (strict: refuse further submissions after the first debug-layer error, with a bounded message history), refusal of a software/strict request in a build without the feature, and the device-removal report moved into host/validation.rs (main's newer report text kept as it is). Optional link-time Agility declarations for unit tests (DARNER_TEST_AGILITY=1).
  • Split command-list parts get their own constant snapshots (a WARP regression read recycled 0xdeadbeef data before).
  • Upload snapshots stay under the CPU-visible buffer limit (4 GiB - 64 KiB, message 1342 on Windows 10 / Agility 614), and DARNER_SEND_BAR staging is capped at 64 MiB a buffer. Main's made_for callers adapted.
  • Placed copies put both buffers back in COMMON afterwards (debug layer 538/527: a later placed copy could write this copy's source).
  • GPU readbacks merge only after confirmed fence completion (relay fetches, card fetches, settling).
  • The ambient pass's depth samples are declared DATA_VOLATILE.
  • Read-only depth plus shader-read states are kept across draws instead of being narrowed.
  • Strict validation storage ignores nonfatal cache-miss warnings (a run stopped on 1024 of them).
  • Explicit zero root buffers stay on the null-descriptor path.
  • Shader translator: a scalar buffer load's later dwords do not wrap at the 32-bit byte offset (they read the start of the view at 0xfffffffc); merged into main's bounded view_dwords.
  • The cache audit classifies strict shader-test admission.
  • Loose-window overlap search finds every overlap past crowded neighbouring entries.

Commits:

  • GPU: restore bindings after unsuccessful external callbacks
  • Restore lightweight D3D12 validation on the rewritten renderer
  • Give split command-list parts their own constant snapshots
  • Bound upload snapshots and speculative staging windows
  • Restore placed-copy resource states before later reads and writes
  • Require confirmed fence completion before merging GPU readbacks
  • Declare ambient depth samples mutable between passes
  • Retain compatible depth and shader read states across draws
  • Keep nonfatal cache warnings out of strict error history
  • Keep explicit zero root buffers on the null descriptor path
  • Keep scalar buffer-load tails from wrapping at 32-bit offsets
  • Classify strict shader-test admission in the cache audit
  • Find all loose-window overlaps beyond crowded neighbouring entries

How it was tested

  • Tested revision: f57d9ad85d
  • Commands and results: on f57d9ad85d (this branch's head), Windows 10 22H2 with its built-in Direct3D 12 (no Shader Model 6.6), Rust 1.98.1:
    • cargo clippy --workspace --all-targets --locked -- -D warnings: passed
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed
    • cargo --config 'profile.test.package.darner-shader.opt-level=3' test --workspace --locked --no-fail-fast (the opt-level only speeds up darner-shader's exhaustive float tests): 66 failed, all of which fail on unmodified main (c8258f9556) on this PC too (darner-shader tests that need Shader Model 6.6).
    • darner-gpu's test process aborts at the first test that needs Shader Model 6.6, on main too, so its tests were run in batches that survive the abort and compared one by one with main (main: 1658 pass, 8 fail, 139 need Shader Model 6.6, 81 ignored): no test that passes on main fails here, none removed; 11 new tests: 11 pass.
    • cargo xtask policy: ok on the PR 8 head, which contains this branch.
    • Not run: tests that need Shader Model 6.6 or a GPU, and the strict-WARP tests behind the diagnostics/gpu-validation features.
  • Changes a default: yes, as bug fixes for everyone: barrier states around placed copies and depth reads, readback merging, upload snapshot sizing, and the translated code of multi-dword scalar loads (one extra compare and select per later group). No switch defaults change.
  • A/B result: none on Darner. The original commits record no frame-time claims for these fixes ("No game FPS result asserted").
  • Gates run on that revision: see above.
  • Gameplay: not run on Darner.
  • Shader wave sizes tested: not tested in the game.
  • Hardware dependence: likely general.
  • Coverage gaps: no in-game run of the port. The strict-WARP tests need a diagnostics or gpu-validation build with the debug layer.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Not run in the game on Darner (see top).
  • This PR contains one change based on main. No: thirteen related fixes, one commit each, so they can be reviewed and reverted one at a time.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #517 (console flags on UAV/aliasing barriers; different barriers), #518 (frame event handles and fences; different code path).
  • Replaces or overlaps: none found
**Not run in the game on Darner.** These changes come from a local VIctory-NVIDIA branch (before the rename) and were ported onto Darner's `main`. The notes below about software (WARP) and RTX 4080 checks describe that branch, not this port. ## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: read from the code, and from strict D3D12 validation (WARP, debug layer) on the VIctory branch these fixes came from. Thirteen small fixes, each its own commit: - Bindings are restored after an external callback that fails (the list's root signature, heaps and pipeline were left as the callback set them). - Lightweight D3D12 validation without per-draw tracing: a `gpu-validation` feature, `DARNER_D3D12_ERROR_ABORT=1` (strict: refuse further submissions after the first debug-layer error, with a bounded message history), refusal of a software/strict request in a build without the feature, and the device-removal report moved into `host/validation.rs` (main's newer report text kept as it is). Optional link-time Agility declarations for unit tests (`DARNER_TEST_AGILITY=1`). - Split command-list parts get their own constant snapshots (a WARP regression read recycled `0xdeadbeef` data before). - Upload snapshots stay under the CPU-visible buffer limit (4 GiB - 64 KiB, message 1342 on Windows 10 / Agility 614), and `DARNER_SEND_BAR` staging is capped at 64 MiB a buffer. Main's `made_for` callers adapted. - Placed copies put both buffers back in COMMON afterwards (debug layer 538/527: a later placed copy could write this copy's source). - GPU readbacks merge only after confirmed fence completion (relay fetches, card fetches, settling). - The ambient pass's depth samples are declared `DATA_VOLATILE`. - Read-only depth plus shader-read states are kept across draws instead of being narrowed. - Strict validation storage ignores nonfatal cache-miss warnings (a run stopped on 1024 of them). - Explicit zero root buffers stay on the null-descriptor path. - Shader translator: a scalar buffer load's later dwords do not wrap at the 32-bit byte offset (they read the start of the view at `0xfffffffc`); merged into main's bounded `view_dwords`. - The cache audit classifies strict shader-test admission. - Loose-window overlap search finds every overlap past crowded neighbouring entries. Commits: - GPU: restore bindings after unsuccessful external callbacks - Restore lightweight D3D12 validation on the rewritten renderer - Give split command-list parts their own constant snapshots - Bound upload snapshots and speculative staging windows - Restore placed-copy resource states before later reads and writes - Require confirmed fence completion before merging GPU readbacks - Declare ambient depth samples mutable between passes - Retain compatible depth and shader read states across draws - Keep nonfatal cache warnings out of strict error history - Keep explicit zero root buffers on the null descriptor path - Keep scalar buffer-load tails from wrapping at 32-bit offsets - Classify strict shader-test admission in the cache audit - Find all loose-window overlaps beyond crowded neighbouring entries ## How it was tested - Tested revision: `f57d9ad85d` - Commands and results: on `f57d9ad85d` (this branch's head), Windows 10 22H2 with its built-in Direct3D 12 (no Shader Model 6.6), Rust 1.98.1: - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed - `cargo --config 'profile.test.package.darner-shader.opt-level=3' test --workspace --locked --no-fail-fast` (the opt-level only speeds up darner-shader's exhaustive float tests): 66 failed, all of which fail on unmodified `main` (c8258f9556) on this PC too (darner-shader tests that need Shader Model 6.6). - darner-gpu's test process aborts at the first test that needs Shader Model 6.6, on `main` too, so its tests were run in batches that survive the abort and compared one by one with `main` (`main`: 1658 pass, 8 fail, 139 need Shader Model 6.6, 81 ignored): no test that passes on `main` fails here, none removed; 11 new tests: 11 pass. - `cargo xtask policy`: ok on the PR 8 head, which contains this branch. - Not run: tests that need Shader Model 6.6 or a GPU, and the strict-WARP tests behind the diagnostics/gpu-validation features. - Changes a default: yes, as bug fixes for everyone: barrier states around placed copies and depth reads, readback merging, upload snapshot sizing, and the translated code of multi-dword scalar loads (one extra compare and select per later group). No switch defaults change. - A/B result: none on Darner. The original commits record no frame-time claims for these fixes ("No game FPS result asserted"). - Gates run on that revision: see above. - Gameplay: not run on Darner. - Shader wave sizes tested: not tested in the game. - Hardware dependence: likely general. - Coverage gaps: no in-game run of the port. The strict-WARP tests need a diagnostics or gpu-validation build with the debug layer. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). **Not run in the game on Darner** (see top). - [ ] This PR contains one change based on `main`. **No:** thirteen related fixes, one commit each, so they can be reviewed and reverted one at a time. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #517 (console flags on UAV/aliasing barriers; different barriers), #518 (frame event handles and fences; different code path). - Replaces or overlaps: none found
Ported to Darner from VIctory-NVIDIA b1443849.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refuse unsupported strict/software requests, retain bounded validation history, and guard host queue submissions. Preserve removal reports in a dedicated module. Add software-only regressions and optional link-time Agility declarations for tests.

Ported to Darner from VIctory-NVIDIA 3f156266.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebuild per-recording caches at both cut sites while retaining descriptor ownership. The current-renderer WARP regression read recycled 0xdeadbeef data before the fix and the expected constants after it; same-part and internal-pass reuse remain intact.

Ported to Darner from VIctory-NVIDIA 615e070f.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep current size classes and retention accounting while checking rounding and CPU-visible limits. Cap mapped-VRAM staging and avoid oversized spare reuse. Optional one-pass predictions outside the limit fall back to ordinary staging; six focused CPU checks pass.

Ported to Darner from VIctory-NVIDIA f7f0f1ec.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reconcile the legacy transition repair with the current memory wrappers and enhanced barriers. Strict WARP catches the previous invalid COPY_DEST-to-CBV use before submission. Constant, texture-source, cross-buffer and overlapping-copy regressions pass with legacy and enhanced barriers.

Ported to Darner from VIctory-NVIDIA 0e7a5c71.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Route relay fetches, card fetches and settling through the existing checked host wait. CPU regressions reject failed waits, incomplete fences and device-removal sentinels; a strict WARP copy/readback check still passes.

Ported to Darner from VIctory-NVIDIA bb4da85e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The current compiled root signature omitted DATA_VOLATILE. A software regression checks that contract and reads both successive synthetic depth values through the same bound descriptor.

Ported to Darner from VIctory-NVIDIA 838504a0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep readonly depth plus shader-read states legal across views and avoid narrowing an already-compatible state. Preserve alias/read-watch observers and exact transitions for writes and COMMON. The WARP fixture goes from two tracked transitions to none; it and the CPU state checks pass. No game FPS result asserted.

Ported to Darner from VIctory-NVIDIA a04c61e1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first guarded rework run stopped on 1024 stored cache-miss warnings rather than a GPU error. Filter only nonfatal severities in strict storage while retaining bounded, persistent errors and corruption. Software tests cover 6144 nonfatal messages followed by both fatal severities, real overflow, repeated refusal and concurrent reporting.

Ported to Darner from VIctory-NVIDIA 651f2399.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA 3c6511be.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA fae572a0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA eaee9c79.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ported to Darner from VIctory-NVIDIA af64880d.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TrustNo1 changed title from [pr-fix][rendering][shaders] GPU binding, barrier and readback fixes, with lightweight D3D12 validation for tests to GPU binding, barrier and readback fixes, with lightweight D3D12 validation for tests 2026-12-06 03:26:44 +00:00
Owner

Test needed — commit f57d9ad8; what to check:

  • The problem on main: read from the code, and from strict D3D12 validation (WARP, debug layer) on the an earlier fork branch these fixes came from.

Thirteen small fixes, each its own commit:

  • Bindings are restored after an external callback that fails (the list's root signature, heaps and pipeline were left as the callback set them).
  • Lightweight D3D12 validation without per-draw tracing: a gpu-validation feature, DARNER_D3D12_ERROR_ABORT=1 (strict: refuse further submissions after the first debug-layer error, with a bounded message history), refusal of a software/strict request in a build without the feature, and the device-removal report moved into host/validation.rs (main's newer report text kept as it is). Optional link-time Agility declarations for unit tests (DARNER_TEST_AGILITY=1).
  • Split command-list parts get their own constant snapshots (a WARP regression read recycled 0xdeadbeef data before).
  • Upload snapshots stay under the CPU-visible buffer limit (4 GiB - 64 KiB, message 1342 on Windows 10 / Agility 614), and DARNER_SEND_BAR staging is capped at 64 MiB a buffer. Main's made_for callers adapted.
  • Placed copies put both buffers back in COMMON afterwards (d

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `f57d9ad8`; what to check: - The problem on main: read from the code, and from strict D3D12 validation (WARP, debug layer) on the an earlier fork branch these fixes came from. Thirteen small fixes, each its own commit: - Bindings are restored after an external callback that fails (the list's root signature, heaps and pipeline were left as the callback set them). - Lightweight D3D12 validation without per-draw tracing: a `gpu-validation` feature, `DARNER_D3D12_ERROR_ABORT=1` (strict: refuse further submissions after the first debug-layer error, with a bounded message history), refusal of a software/strict request in a build without the feature, and the device-removal report moved into `host/validation.rs` (main's newer report text kept as it is). Optional link-time Agility declarations for unit tests (`DARNER_TEST_AGILITY=1`). - Split command-list parts get their own constant snapshots (a WARP regression read recycled `0xdeadbeef` data before). - Upload snapshots stay under the CPU-visible buffer limit (4 GiB - 64 KiB, message 1342 on Windows 10 / Agility 614), and `DARNER_SEND_BAR` staging is capped at 64 MiB a buffer. Main's `made_for` callers adapted. - Placed copies put both buffers back in COMMON afterwards (d Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
This pull request has changes conflicting with the target branch.
  • crates/darner-gpu/src/gpu_owned.rs
  • crates/darner-gpu/src/host.rs
  • crates/darner-gpu/src/host/bus.rs
  • crates/darner-gpu/src/host/upq.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 'pr/1-gpu-fixes-validation:deama-pr/1-gpu-fixes-validation'
git switch 'deama-pr/1-gpu-fixes-validation'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'deama-pr/1-gpu-fixes-validation'
git switch 'deama-pr/1-gpu-fixes-validation'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'deama-pr/1-gpu-fixes-validation'
git switch 'deama-pr/1-gpu-fixes-validation'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'deama-pr/1-gpu-fixes-validation'
git switch 'Main'
git merge --squash 'deama-pr/1-gpu-fixes-validation'
git switch 'Main'
git merge --ff-only 'deama-pr/1-gpu-fixes-validation'
git switch 'Main'
git merge 'deama-pr/1-gpu-fixes-validation'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!594
No description provided.