Shaders: do not parse VS inputs when reading mesh shader stage I/O #1366

Merged
mgunes1311-lab merged 1 commit from upstream-pr/1366 into main 2026-11-25 00:22:20 +00:00
mgunes1311-lab commented 2026-11-24 17:36:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mgunes1311-lab on 2026-11-24T17:36:55Z.


ms_io in crates/victory-shader/src/native.rs previously called vs_io(data)? just to extract output semantics (E+0xc8, count at E+0x188). Because vs_io also validates and parses VS_INPUTS (E+0x24, count at E+0xc4, checked against MAX_SEMANTICS = 32), any mesh shader stage data whose unused E+0xc4 dword exceeded 32 was rejected with ShaderError::Malformed("implausible semantic count").

Changes

  • Extracted vs_outputs(data: &[u8]) -> Result<Vec<VsOutput>, ShaderError> in crates/victory-shader/src/native.rs.
  • Updated both vs_io and ms_io to call vs_outputs(data)?, so ms_io no longer reads unused VS_INPUTS / VS_INPUT_COUNT.
  • Added synthetic unit test mesh_stage_io_ignores_unused_vs_input_count.

Verification

  • cargo test -p victory-shader --target x86_64-pc-windows-msvc --locked native:: (11 passed; 0 failed)
  • cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --locked
  • cargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged (asset policy: 1 files ok)
<!-- greyfinch-sync:Marvisak/VIctory:issue:6587763394 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1366). Originally posted by [mgunes1311-lab](https://github.com/mgunes1311-lab) on 2026-11-24T17:36:55Z. --- `ms_io` in `crates/victory-shader/src/native.rs` previously called `vs_io(data)?` just to extract output semantics (`E+0xc8`, count at `E+0x188`). Because `vs_io` also validates and parses `VS_INPUTS` (`E+0x24`, count at `E+0xc4`, checked against `MAX_SEMANTICS = 32`), any mesh shader stage data whose unused `E+0xc4` dword exceeded 32 was rejected with `ShaderError::Malformed("implausible semantic count")`. ### Changes - Extracted `vs_outputs(data: &[u8]) -> Result<Vec<VsOutput>, ShaderError>` in `crates/victory-shader/src/native.rs`. - Updated both `vs_io` and `ms_io` to call `vs_outputs(data)?`, so `ms_io` no longer reads unused `VS_INPUTS` / `VS_INPUT_COUNT`. - Added synthetic unit test `mesh_stage_io_ignores_unused_vs_input_count`. ### Verification - `cargo test -p victory-shader --target x86_64-pc-windows-msvc --locked native::` (`11 passed; 0 failed`) - `cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings` - `RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --locked` - `cargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged` (`asset policy: 1 files ok`)
catminou4 commented 2026-11-24 18:05:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T17:42:42Z.

Review: APPROVED


vs_io split: ms_io now reads only VS_OUTPUTS via the shared vs_outputs() helper instead of parsing VS inputs — mesh stage data has no vertex inputs, so a garbage VS_INPUT_COUNT no longer breaks mesh parsing. New native.rs test pins exactly that. Minimal and safe. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, cargo test -p <crate> --locked. Shader execution tests (valu_tests/host/diff_tests) are #[cfg(all(test, windows))], so macOS covers lowering/decode/unit tests only. 97 passed, 0 failed (test runs on macOS).

<!-- greyfinch-sync:Marvisak/VIctory:review:6044388623 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1366#pullrequestreview-6044388623). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T17:42:42Z. **Review:** APPROVED --- vs_io split: ms_io now reads only VS_OUTPUTS via the shared vs_outputs() helper instead of parsing VS inputs — mesh stage data has no vertex inputs, so a garbage VS_INPUT_COUNT no longer breaks mesh parsing. New native.rs test pins exactly that. Minimal and safe. Local verification: macOS arm64, rustc 1.98.1, PR head merged into main ffe310e, `cargo test -p <crate> --locked`. Shader execution tests (valu_tests/host/diff_tests) are `#[cfg(all(test, windows))]`, so macOS covers lowering/decode/unit tests only. 97 passed, 0 failed (test runs on macOS).
catminou4 commented 2026-11-24 21:02:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:50:17Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 97 passed, 0 failed. Hardware/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers structure/lowering unit tests.

Mesh stage I/O no longer parses VS inputs when reading the mesh shader stage interface: vs_outputs returns Result and mesh_stage_io_ignores_unused_vs_input_count asserts StageIo::Ms. +1 macOS test.

<!-- greyfinch-sync:Marvisak/VIctory:review:6047176912 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1366#pullrequestreview-6047176912). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T20:50:17Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 97 passed, 0 failed. Hardware/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers structure/lowering unit tests. Mesh stage I/O no longer parses VS inputs when reading the mesh shader stage interface: vs_outputs returns Result and mesh_stage_io_ignores_unused_vs_input_count asserts StageIo::Ms. +1 macOS test.
upstream-sync closed this pull request 2026-11-25 01:06:21 +00:00
sinan-cmyk commented 2026-11-25 02:06:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T01:48:29Z.


Offline measurement on a retail dump, and the shader tests on Ada

Result: no count change against main.

Offline. I merged head 4e155a3 onto main ffe310e (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 21,724 on main, 21,724 with this PR.

No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on main. The count shows that the change rejects nothing. It does not show whether the output is right.

Tests: with the same merge, cargo test --locked -p victory-shader --lib passed 121, failed 0. The bitcode benchmark is ignored, as on main, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with VICTORY_WARP unset.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149979893 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1366#issuecomment-7149979893). Originally posted by [sinan-cmyk](https://github.com/sinan-cmyk) on 2026-11-25T01:48:29Z. --- ### Offline measurement on a retail dump, and the shader tests on Ada **Result: no count change against `main`.** **Offline.** I merged head 4e155a3 onto `main` ffe310e (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 21,724 on `main`, 21,724 with this PR. No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on `main`. The count shows that the change rejects nothing. It does not show whether the output is right. **Tests:** with the same merge, `cargo test --locked -p victory-shader --lib` passed 121, failed 0. The bitcode benchmark is ignored, as on `main`, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with `VICTORY_WARP` unset. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
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
Marvisak/VIctory!1366
No description provided.