Shader tests: the 0x403 loose metadata is built in the test, not the title's bytes #4224

Manually merged
github merged 2 commits from github-bot/gh-4223 into gh-pr/4223/base 2026-11-30 23:41:56 +00:00 AGit
Owner

@⁠babuakhil on GitHub · 2026-11-30 17:34 UTC · original
babuakhil:fix/synthetic-0x403-fixture → main · +36 −6 · 1 files · 2 commits · merged 2026-11-30 23:37 UTC

What it changes

loose_metadata_reads_version_0x403 (698ab79e, for #3831) held 0x118 bytes the title handed over, as a hex string. That's what docs/asset-policy.md asks us not to commit, and the policy refuses it: on main (84bd61e2), cargo xtask policy fails with crates/victory-shader/src/native.rs: 560-character hex/base64 run (embedded data?), and so does xtask's repository_passes_policy.

The test now builds a 0x403 block with the test module's record(): the 0x18-byte header, a sampler, SRV and UAV table, a CBV, a skipped 0x42 declaration and the end record. It checks what the old test did (version, 0x60 code dwords, four resources in order) and also the lower bounds, the root parameters and their user data, that loose_compute makes a container from it, and that a size that disagrees is refused. Test code only. The parser is unchanged.

Removing the string here doesn't remove it from history. Whether that matters is the maintainer's call.

How it was tested

  • GPU and profile: not applicable; test code only, Windows 11, Rust 1.98.1 (pinned).
  • Before: cargo xtask policy fails on the hex run; cargo test -p xtask gives 6 passed, 1 failed.
  • After: cargo xtask policy gives 462 files ok; cargo test -p xtask gives 7 passed.
  • The new test still guards 0x403: with the 0x403 arm removed, or 0x403 read with v3's record offset (0x38), v2's header size (0xc) or v2's record offset (0x10), it fails.
  • cargo test -p victory-shader: 535 passed, 1 failed. The failure is split_lds_wave32_read_after_read_barrier_coalescing_and_parity on an RTX 3060, which fails the same way on main. Clippy on victory-shader stops at lower.rs:114 (loop_caps never read), which is on main too.
  • cargo test passed for the crates it touches: yes, apart from that GPU test, which fails on main as well.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. #3168 makes a similar replacement as one part of a 13-file explicit-LOD sampling change. This is the same fix on its own, so the policy can pass before that lands. If #3168 goes in first, this can be closed. #2478 changes the 0x403 parser, not this test.

🤖 Generated with Claude Code

**@⁠babuakhil** on GitHub · 2026-11-30 17:34 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4223) `babuakhil:fix/synthetic-0x403-fixture` → `main` · +36 −6 · 1 files · 2 commits · merged 2026-11-30 23:37 UTC ## What it changes `loose_metadata_reads_version_0x403` (698ab79e, for #3831) held 0x118 bytes the title handed over, as a hex string. That's what docs/asset-policy.md asks us not to commit, and the policy refuses it: on `main` (`84bd61e2`), `cargo xtask policy` fails with `crates/victory-shader/src/native.rs: 560-character hex/base64 run (embedded data?)`, and so does xtask's `repository_passes_policy`. The test now builds a 0x403 block with the test module's `record()`: the 0x18-byte header, a sampler, SRV and UAV table, a CBV, a skipped 0x42 declaration and the end record. It checks what the old test did (version, 0x60 code dwords, four resources in order) and also the lower bounds, the root parameters and their user data, that `loose_compute` makes a container from it, and that a size that disagrees is refused. Test code only. The parser is unchanged. Removing the string here doesn't remove it from history. Whether that matters is the maintainer's call. ## How it was tested - GPU and profile: not applicable; test code only, Windows 11, Rust 1.98.1 (pinned). - Before: `cargo xtask policy` fails on the hex run; `cargo test -p xtask` gives 6 passed, 1 failed. - After: `cargo xtask policy` gives `462 files ok`; `cargo test -p xtask` gives 7 passed. - The new test still guards 0x403: with the 0x403 arm removed, or 0x403 read with v3's record offset (0x38), v2's header size (0xc) or v2's record offset (0x10), it fails. - `cargo test -p victory-shader`: 535 passed, 1 failed. The failure is `split_lds_wave32_read_after_read_barrier_coalescing_and_parity` on an RTX 3060, which fails the same way on `main`. Clippy on `victory-shader` stops at `lower.rs:114` (`loop_caps` never read), which is on `main` too. - `cargo test` passed for the crates it touches: yes, apart from that GPU test, which fails on `main` as well. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. #3168 makes a similar replacement as one part of a 13-file explicit-LOD sampling change. This is the same fix on its own, so the policy can pass before that lands. If #3168 goes in first, this can be closed. #2478 changes the 0x403 parser, not this test. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`loose_metadata_reads_version_0x403` held 0x118 bytes the title handed
over, as a hex string. The asset policy refuses it
(`crates/victory-shader/src/native.rs: 560-character hex/base64 run`),
so `cargo xtask policy` and xtask's `repository_passes_policy` failed on
main since 698ab79e. The test now builds the same shape with `record()`:
the 0x18-byte header, a sampler, SRV and UAV table, a CBV, a skipped
declaration and the end record. It checks what the old one did, plus the
lower bounds, the root parameters, a container from loose_compute, and a
size that disagrees.

It still catches the 0x403 cases it is for: with the 0x403 arm removed,
or 0x403 read with v3's record offset (0x38), v2's header (0xc) or v2's
record offset (0x10), it fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 18:08:58 +00:00
Author
Owner

@⁠Lyrnc on GitHub · 2026-11-30 18:56 UTC · original

Test report for 0d7bf355 on 84bd61e2. Windows 11, RTX 5080, Rust 1.98.1 (pinned). Test code only, so no game run.

check main 84bd61e2 this PR
cargo xtask policy fails: native.rs: 560-character hex/base64 run asset policy: 462 files ok
cargo test -p xtask — 7 passed (incl. repository_passes_policy)
cargo test -p victory-shader --lib -- native::tests — 21 passed, incl. loose_metadata_reads_version_0x403
cargo clippy -p victory-shader --all-targets -- -D warnings 1 error: loop_caps never read (lower.rs:114, #4297) the same 1 error, nothing new
same with --all-features 1 error: loop_caps never read (lower.rs:114, #4297) the same 1 error, nothing new

So it does what it says: policy is clean, and the test passes and still checks 0x403.

One coverage gap compared with the test it replaces: no test reaches RootType::ImmediateSampler in records() any more. The removed metadata's sampler record had root type 4, an immediate sampler: sgprs = 0, so it adds no root parameter. Its three tables also shared one slot and one user-data dword. Here the sampler is a table (root type 3), and nothing else in the crate's tests uses root type 4, so the RootType::ImmediateSampler => 0 arm went untested when the hex string went.

A one-record fix: add an immediate sampler, e.g. record(0x41, 1, 4, 0, 5, 4, 0, 9), before the end record. Assert that it shows up in used and adds nothing to layout. For a version that keeps the removed test's record mix (immediate sampler, SRV/UAV/CBV tables behind one user-data dword, three 0x42 declarations, the hash, 0x118 bytes, all values made up), see Lyrnc/VIctory-NVIDIA@c99a1f4a on branch fix/synthetic-loose-metadata-test. Results for it, same machine: policy 462 files ok, native::tests 21 passed, and clippy shows only the same lower.rs:114 error. Take whichever you like. I won't open a competing PR.

The split_lds_wave32_read_after_read_barrier_coalescing_and_parity failure you saw on main is the test's own dead UAV load (since #2623). Fix: #4321.

AI use: tested with Claude Code. Commands and results are as listed.

**@⁠Lyrnc** on GitHub · 2026-11-30 18:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4223#issuecomment-7288609608) Test report for `0d7bf355` on `84bd61e2`. Windows 11, RTX 5080, Rust 1.98.1 (pinned). Test code only, so no game run. | check | `main` 84bd61e2 | this PR | |---|---|---| | `cargo xtask policy` | fails: `native.rs: 560-character hex/base64 run` | `asset policy: 462 files ok` | | `cargo test -p xtask` | — | 7 passed (incl. `repository_passes_policy`) | | `cargo test -p victory-shader --lib -- native::tests` | — | 21 passed, incl. `loose_metadata_reads_version_0x403` | | `cargo clippy -p victory-shader --all-targets -- -D warnings` | 1 error: `loop_caps` never read (`lower.rs:114`, #4297) | the same 1 error, nothing new | | same with `--all-features` | 1 error: `loop_caps` never read (`lower.rs:114`, #4297) | the same 1 error, nothing new | So it does what it says: policy is clean, and the test passes and still checks 0x403. One coverage gap compared with the test it replaces: **no test reaches `RootType::ImmediateSampler` in `records()` any more.** The removed metadata's sampler record had root type 4, an immediate sampler: `sgprs = 0`, so it adds no root parameter. Its three tables also shared one slot and one user-data dword. Here the sampler is a table (root type 3), and nothing else in the crate's tests uses root type 4, so the `RootType::ImmediateSampler => 0` arm went untested when the hex string went. A one-record fix: add an immediate sampler, e.g. `record(0x41, 1, 4, 0, 5, 4, 0, 9)`, before the end record. Assert that it shows up in `used` and adds nothing to `layout`. For a version that keeps the removed test's record mix (immediate sampler, SRV/UAV/CBV tables behind one user-data dword, three 0x42 declarations, the hash, 0x118 bytes, all values made up), see Lyrnc/VIctory-NVIDIA@c99a1f4a on branch `fix/synthetic-loose-metadata-test`. Results for it, same machine: policy `462 files ok`, `native::tests` 21 passed, and clippy shows only the same `lower.rs:114` error. Take whichever you like. I won't open a competing PR. The `split_lds_wave32_read_after_read_barrier_coalescing_and_parity` failure you saw on main is the test's own dead UAV load (since #2623). Fix: #4321. AI use: tested with Claude Code. Commands and results are as listed.
The title's metadata this test replaced had a sampler of root type 4,
and no other test in the crate reaches `RootType::ImmediateSampler` in
`records()`. The made-up 0x403 block now ends with one (slot 9, no user
data); the test checks that it is read (`used`, root type, slot) and adds
no root parameter (`layout` is unchanged).

With that arm removed, or given an SGPR, the test fails, as it does for
the four 0x403 header and offset mistakes it already caught.

Suggested by Lyrnc in the review of #4223.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠babuakhil on GitHub · 2026-11-30 19:06 UTC · original

Thanks @⁠Lyrnc, good catch on the immediate sampler. 5efff6f2 adds one, your record: record(0x41, 1, 4, 0, 5, 4, 0, 9) before the end record. The test now checks that it's read (a fifth used entry, RootType::ImmediateSampler, slot 9) and that layout still has only the four root parameters.

Checked that it guards that arm: with RootType::ImmediateSampler => 0 removed, or changed to give it an SGPR, the test fails, as it still does for the four 0x403 header and offset mistakes. Same machine as before (Windows 11, Rust 1.98.1): cargo xtask policy 462 files ok, cargo test -p xtask 7 passed, native::tests 21 passed, and Clippy shows only the lower.rs:114 error that main has.

I kept the smaller fixture rather than your fuller one, so the test stays readable record by record, but thanks for putting it up. And thanks for pointing to #4321 for the split-LDS failure.

**@⁠babuakhil** on GitHub · 2026-11-30 19:06 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4223#issuecomment-7288849395) Thanks @⁠Lyrnc, good catch on the immediate sampler. 5efff6f2 adds one, your record: `record(0x41, 1, 4, 0, 5, 4, 0, 9)` before the end record. The test now checks that it's read (a fifth `used` entry, `RootType::ImmediateSampler`, slot 9) and that `layout` still has only the four root parameters. Checked that it guards that arm: with `RootType::ImmediateSampler => 0` removed, or changed to give it an SGPR, the test fails, as it still does for the four 0x403 header and offset mistakes. Same machine as before (Windows 11, Rust 1.98.1): `cargo xtask policy` 462 files ok, `cargo test -p xtask` 7 passed, `native::tests` 21 passed, and Clippy shows only the `lower.rs:114` error that `main` has. I kept the smaller fixture rather than your fuller one, so the test stays readable record by record, but thanks for putting it up. And thanks for pointing to #4321 for the split-LDS failure.
github-bot changed target branch from main to gh-pr/4223/base 2026-11-30 23:41:37 +00:00
github manually merged commit 5efff6f26c into gh-pr/4223/base 2026-11-30 23:41:37 +00:00
Author
Owner

@⁠Lyrnc on GitHub · 2026-12-01 03:52 UTC · original

Checked the immediate sampler as merged (a717774a), Windows 11, rustc 1.98.1: cargo test -p victory-shader --lib -- native::tests gives 21 passed, loose_metadata_reads_version_0x403 among them. With RootType::ImmediateSampler => 1 (an SGPR) the test fails at the layout assert, so that arm is covered again. Thanks for adding it.

AI use: Claude Code (Claude Opus 5.5) ran these checks and wrote this.

**@⁠Lyrnc** on GitHub · 2026-12-01 03:52 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4223#issuecomment-7300157948) Checked the immediate sampler as merged (a717774a), Windows 11, rustc 1.98.1: `cargo test -p victory-shader --lib -- native::tests` gives 21 passed, `loose_metadata_reads_version_0x403` among them. With `RootType::ImmediateSampler => 1` (an SGPR) the test fails at the `layout` assert, so that arm is covered again. Thanks for adding it. AI use: Claude Code (Claude Opus 5.5) ran these checks and wrote this.
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/trustno1-coder--VIctory-NVIDIA!4224
No description provided.