GPU: the fifth dword of a root constants parameter is read as a constant #2295

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

@⁠denkencar-sketch on GitHub · 2026-11-25 10:05 UTC · original
denkencar-sketch:fix/draw-001 → main · +17 −1 · 1 files · 1 commits · open

Summary

Any user-data entry at the view-offset dword was taken for a root view's offset, so a draw reading that constant was dropped. Only a root view descriptor's entry is now read as a view offset; the fifth dword of a root constants parameter is a constant.

Testing

Test only_a_root_view_has_a_view_offset fails without the root-view check and passes with this change. It tests the helper is_view_offset, not the whole draw path. cargo test --workspace --locked passes apart from known flakes: modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too, and so does a parallel-run flake in victory-gpu's lib tests (watch:: and descriptor::host:: tests, 2 of 40 runs on pristine main).

Not tried: a run in the game.

AI-assisted.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 10:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2295) `denkencar-sketch:fix/draw-001` → `main` · +17 −1 · 1 files · 1 commits · open ## Summary Any user-data entry at the view-offset dword was taken for a root view's offset, so a draw reading that constant was dropped. Only a root view descriptor's entry is now read as a view offset; the fifth dword of a root constants parameter is a constant. ## Testing Test `only_a_root_view_has_a_view_offset` fails without the root-view check and passes with this change. It tests the helper `is_view_offset`, not the whole draw path. `cargo test --workspace --locked` passes apart from known flakes: `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too, and so does a parallel-run flake in `victory-gpu`'s lib tests (`watch::` and `descriptor::host::` tests, 2 of 40 runs on pristine `main`). Not tried: a run in the game. AI-assisted.
Any user-data entry at the view-offset dword was taken for a root view's
offset, so a draw reading that constant was dropped.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:01:20 +00:00
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-25 10:44 UTC · original

I reproduced the dropped draw on the parent and verified the fix on an RTX 5080 and Windows’ built-in WARP. With the fifth root constant, the parent dropped both draws and left all 256 pixels blue. On the PR, both adapters rendered the expected 128 red pixels on the left and 128 green on the right, with zero pixel mismatches.

Each row below was measured separately on both adapters. The four-dword control reads the last dword of a four-dword parameter.

Revision Constant read Draws issued / dropped Red / green / blue pixels Incorrect positions
Parent 940d32f Fourth 2 / 0 128 / 128 / 0 0/256
Parent 940d32f Fifth 0 / 2 0 / 0 / 256 256/256
PR 9d8a69b Fourth 2 / 0 128 / 128 / 0 0/256
PR 9d8a69b Fifth 2 / 0 128 / 128 / 0 0/256

The test translates a synthetic GFX10 pixel shader that reads s3 or s4, checks which root dword the translator requested, then submits two scissored draws through State::set_constants and State::draw. Only the selected constant changes between draws. It checks every RGBA8 pixel after submission against its expected position. The D3D12 device LUIDs resolved to NVIDIA GeForce RTX 5080 (10de:2c02) and Microsoft Basic Render Driver (1414:008c) using the system WARP DLL. This run used synthetic inputs.

The test-only commit applies to the PR head or its parent. It builds its shader fixtures locally with Windows SDK DXC. Regression test commit

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr-2295-root-constant-pixels
git cherry-pick 91231f99976d69e7edec00f3e616181d1c6f633f
$test = 'pipeline::host::root_constant_pixels::root_constants_draw_two_colors'
$env:VICTORY_D3D12_WARP = '0'
cargo test -p victory-gpu --all-features --lib --locked $test -- --exact --ignored --nocapture --test-threads=1
$env:VICTORY_D3D12_WARP = '1'
cargo test -p victory-gpu --all-features --lib --locked $test -- --exact --ignored --nocapture --test-threads=1
**@⁠steven-seagull27** on GitHub · 2026-11-25 10:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2295#issuecomment-7160118398) I reproduced the dropped draw on the parent and verified the fix on an RTX 5080 and Windows’ built-in WARP. With the fifth root constant, the parent dropped both draws and left all 256 pixels blue. On the PR, both adapters rendered the expected 128 red pixels on the left and 128 green on the right, with zero pixel mismatches. Each row below was measured separately on both adapters. The four-dword control reads the last dword of a four-dword parameter. | Revision | Constant read | Draws issued / dropped | Red / green / blue pixels | Incorrect positions | |---|---|---:|---:|---:| | Parent `940d32f` | Fourth | 2 / 0 | 128 / 128 / 0 | 0/256 | | Parent `940d32f` | Fifth | 0 / 2 | 0 / 0 / 256 | 256/256 | | PR `9d8a69b` | Fourth | 2 / 0 | 128 / 128 / 0 | 0/256 | | PR `9d8a69b` | Fifth | 2 / 0 | 128 / 128 / 0 | 0/256 | The test translates a synthetic GFX10 pixel shader that reads `s3` or `s4`, checks which root dword the translator requested, then submits two scissored draws through `State::set_constants` and `State::draw`. Only the selected constant changes between draws. It checks every RGBA8 pixel after submission against its expected position. The D3D12 device LUIDs resolved to NVIDIA GeForce RTX 5080 (`10de:2c02`) and Microsoft Basic Render Driver (`1414:008c`) using the system WARP DLL. This run used synthetic inputs. The test-only commit applies to the PR head or its parent. It builds its shader fixtures locally with Windows SDK DXC. [Regression test commit](https://github.com/steven-seagull27/VIctory/commit/91231f99976d69e7edec00f3e616181d1c6f633f) ```powershell git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr-2295-root-constant-pixels git cherry-pick 91231f99976d69e7edec00f3e616181d1c6f633f $test = 'pipeline::host::root_constant_pixels::root_constants_draw_two_colors' $env:VICTORY_D3D12_WARP = '0' cargo test -p victory-gpu --all-features --lib --locked $test -- --exact --ignored --nocapture --test-threads=1 $env:VICTORY_D3D12_WARP = '1' cargo test -p victory-gpu --all-features --lib --locked $test -- --exact --ignored --nocapture --test-threads=1 ```
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 14:52 UTC · original · edited 2026-11-26 00:23 UTC

Automated triage for the maintainers.

Merge candidate (worth a look). The head 8cfd7aa drops the pixel test that ran dxc.exe, which was the only thing holding this back. What remains: in State (crates/victory-gpu/src/draw.rs), user-data dword ROOT_VIEW_OFFSET is taken as a root view's offset only when the parameter is a root descriptor (is_view_offset, matching is_root_view), so the fifth dword of a root constants parameter no longer drops the draw. The unit test only_a_root_view_has_a_view_offset covers it. A tester earlier reproduced the dropped draws on main and correct pixels with the fix on an RTX 5080 and WARP. CI check passes and it merges cleanly.

On your reply: confirmed, no process is spawned any more and the diff is only the fix and its unit test.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 14:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2295#issuecomment-7165959052) · edited 2026-11-26 00:23 UTC <!-- victory-triage v1 head=8cfd7aa46cf1bb9169e140d08d6a1767c6128838 verdict=merge-candidate at=2026-11-26T00:23:30Z --> Automated triage for the maintainers. **Merge candidate (worth a look).** The head `8cfd7aa` drops the pixel test that ran `dxc.exe`, which was the only thing holding this back. What remains: in `State` (`crates/victory-gpu/src/draw.rs`), user-data dword `ROOT_VIEW_OFFSET` is taken as a root view's offset only when the parameter is a root descriptor (`is_view_offset`, matching `is_root_view`), so the fifth dword of a root constants parameter no longer drops the draw. The unit test `only_a_root_view_has_a_view_offset` covers it. A tester earlier reproduced the dropped draws on `main` and correct pixels with the fix on an RTX 5080 and WARP. CI `check` passes and it merges cleanly. On your reply: confirmed, no process is spawned any more and the diff is only the fix and its unit test. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠denkencar-sketch on GitHub · 2026-11-25 23:15 UTC · original

Dropped the \dxc.exe-spawning pixel test per triage (keeping the production fix and \only_a_root_view_has_a_view_offset\ unit test) and rebased onto current \main\ (\842b0cb). \cargo test, \cargo clippy, and \cargo xtask policy\ pass.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 23:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2295#issuecomment-7177325202) Dropped the \dxc.exe\-spawning pixel test per triage (keeping the production fix and \only_a_root_view_has_a_view_offset\ unit test) and rebased onto current \main\ (\842b0cb\). \cargo test\, \cargo clippy\, and \cargo xtask policy\ pass.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 10:19 UTC · original · reviewed

Root constants: the fifth dword check now requires RootType::Descriptor (is_view_offset) — a constants parameter no longer mistaken for a view offset. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

**@⁠catminou4** on GitHub · 2026-11-25 10:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2295#pullrequestreview-6055712531) · **reviewed** Root constants: the fifth dword check now requires RootType::Descriptor (is_view_offset) — a constants parameter no longer mistaken for a view offset. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 19:44 UTC · original · approved these changes

Reviewed and verified 8cfd7aa46cf1bb9169e140d08d6a1767c6128838 merged onto origin/main (63bcca43c6a00a758510398fa43096ce7e4f7df0) on Windows 11 x64 (RTX 5090 + Microsoft WARP, --features diagnostics with VICTORY_D3D12_DEBUG=1, Rust 1.98.1 MSVC).

Code Audit

  • Audited all ROOT_VIEW_OFFSET, is_root_view, and RootType::Constants uses across crates/victory-gpu/src/: State::bind (crates/victory-gpu/src/draw.rs:771), shared by both graphics and compute pipelines, was the only site matching u.dword == victory_shader::emit::ROOT_VIEW_OFFSET without verifying u.root == RootType::Descriptor.
  • Introducing is_view_offset (L2013-2015) mirrors is_root_view (L2018-2019) cleanly so the fifth dword (and beyond) of a RootType::Constants parameter falls through to self.user_value(...) instead of failing a root-view lookup and dropping the draw/dispatch.

Local Verification

  • cargo xtask policy — pass (191 files ok).
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features) — 0 warnings.
  • cargo test --locked -p victory-gpu --features diagnostics --lib only_a_root_view_has_a_view_offset (RTX 5090 and WARP) — passed.
  • Additional synthetic probe binding 8-dword root constants on both graphics (compute = false) and compute (compute = true) slots: verified dwords 0..8 never match is_view_offset or is_root_view, RootType::Table with ROOT_VIEW_OFFSET is excluded, and State::user_value returns every dword verbatim on both RTX 5090 and WARP.

Looks good to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 19:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2295#pullrequestreview-6079708008) · **approved these changes** Reviewed and verified `8cfd7aa46cf1bb9169e140d08d6a1767c6128838` merged onto `origin/main` (`63bcca43c6a00a758510398fa43096ce7e4f7df0`) on Windows 11 x64 (RTX 5090 + Microsoft WARP, `--features diagnostics` with `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1 MSVC). ### Code Audit - Audited all `ROOT_VIEW_OFFSET`, `is_root_view`, and `RootType::Constants` uses across `crates/victory-gpu/src/`: `State::bind` (`crates/victory-gpu/src/draw.rs:771`), shared by both graphics and compute pipelines, was the only site matching `u.dword == victory_shader::emit::ROOT_VIEW_OFFSET` without verifying `u.root == RootType::Descriptor`. - Introducing `is_view_offset` (`L2013-2015`) mirrors `is_root_view` (`L2018-2019`) cleanly so the fifth dword (and beyond) of a `RootType::Constants` parameter falls through to `self.user_value(...)` instead of failing a root-view lookup and dropping the draw/dispatch. ### Local Verification - `cargo xtask policy` — pass (`191 files ok`). - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`) — 0 warnings. - `cargo test --locked -p victory-gpu --features diagnostics --lib only_a_root_view_has_a_view_offset` (RTX 5090 and WARP) — passed. - Additional synthetic probe binding 8-dword root constants on both graphics (`compute = false`) and compute (`compute = true`) slots: verified dwords `0..8` never match `is_view_offset` or `is_root_view`, `RootType::Table` with `ROOT_VIEW_OFFSET` is excluded, and `State::user_value` returns every dword verbatim on both RTX 5090 and WARP. Looks good to merge.
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/2295/head:github-bot/gh-2295'
git switch 'github-bot/gh-2295'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2295'
git switch 'github-bot/gh-2295'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2295'
git switch 'github-bot/gh-2295'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2295'
git switch 'main'
git merge --squash 'github-bot/gh-2295'
git switch 'main'
git merge --ff-only 'github-bot/gh-2295'
git switch 'main'
git merge 'github-bot/gh-2295'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
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
github/Marvisak--VIctory!2295
No description provided.