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

Merged
babuakhil merged 2 commits from upstream-pr/4223 into main 2026-11-30 23:37:36 +00:00
babuakhil commented 2026-11-30 17:34:22 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by babuakhil on 2026-11-30T17:34:22Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5570426084 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4223). Originally posted by [babuakhil](https://github.com/babuakhil) on 2026-11-30T17:34:22Z. --- ## 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)
Lyrnc commented 2026-11-30 18:56:55 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T18:56:55Z.


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, #4296) the same 1 error, nothing new
same with --all-features 1 error: loop_caps never read (lower.rs:114, #4296) 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: #4320.

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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7288609608 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4223#issuecomment-7288609608). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-30T18:56:55Z. --- 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`, #4296) | the same 1 error, nothing new | | same with `--all-features` | 1 error: `loop_caps` never read (`lower.rs:114`, #4296) | 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: #4320. AI use: tested with Claude Code. Commands and results are as listed.
babuakhil commented 2026-11-30 19:06:19 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by babuakhil on 2026-11-30T19:06:19Z.


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 #4320 for the split-LDS failure.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7288849395 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4223#issuecomment-7288849395). Originally posted by [babuakhil](https://github.com/babuakhil) on 2026-11-30T19:06:19Z. --- 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 #4320 for the split-LDS failure.
Lyrnc commented 2026-12-01 03:52:55 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-12-01T03:52:55Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7300157948 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4223#issuecomment-7300157948). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-12-01T03:52:55Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!4223
No description provided.