Prune unread varyings from oversized mesh pairs #871

Closed
github-bot wants to merge 1 commit from gh-pr/871/head into gh-pr/871/base
Owner

@⁠Kamiloj9 on GitHub · 2026-11-25 11:16 UTC · original
Kamiloj9:codex/prune-oversized-mesh-pairs → main · +365 −27 · 7 files · 1 commits · closed without merging

Summary

  • Specialize an oversized mesh shader for the pixel shader actually selected for the pipeline. Remove only whole, uniquely matched generic varyings that the consumer never reads, and keep the original layout of retained elements.
  • Remap the DXIL signature IDs on both stages and require the host binding metadata to match the shared translations. Use both specialized blobs in the PSO and its library key.
  • Preserve the existing pipeline as a fallback while the device is live.

The mesh portion of #854 tackles the same limit with broader liveness filtering. This PR is scoped to the paired mesh fix. #397 uses FP16 packing and pixel-side reconstruction for inputs that cannot simply be dropped.

Verification

  • Windows cargo check --workspace --all-features, mesh-link and container unit tests, and staged asset policy.
  • Windows SDK DXIL validator accepted both stages of two captured pairs previously rejected for exceeding the 32 KiB mesh output limit. The crossed pair was declined.
  • Tested offline. No D3D12 PSO creation or gameplay run. The existing VICTORY_MESH_OUTPUT_STRICT experiment still rejects oversized standalone translations before runtime linking.
**@⁠Kamiloj9** on GitHub · 2026-11-25 11:16 UTC · [original](https://github.com/fxceless/victory-fork/pull/871) `Kamiloj9:codex/prune-oversized-mesh-pairs` → `main` · +365 −27 · 7 files · 1 commits · closed without merging ## Summary - Specialize an oversized mesh shader for the pixel shader actually selected for the pipeline. Remove only whole, uniquely matched generic varyings that the consumer never reads, and keep the original layout of retained elements. - Remap the DXIL signature IDs on both stages and require the host binding metadata to match the shared translations. Use both specialized blobs in the PSO and its library key. - Preserve the existing pipeline as a fallback while the device is live. The mesh portion of #854 tackles the same limit with broader liveness filtering. This PR is scoped to the paired mesh fix. #397 uses FP16 packing and pixel-side reconstruction for inputs that cannot simply be dropped. ## Verification - Windows `cargo check --workspace --all-features`, mesh-link and container unit tests, and staged asset policy. - Windows SDK DXIL validator accepted both stages of two captured pairs previously rejected for exceeding the 32 KiB mesh output limit. The crossed pair was declined. - Tested offline. No D3D12 PSO creation or gameplay run. The existing `VICTORY_MESH_OUTPUT_STRICT` experiment still rejects oversized standalone translations before runtime linking.
Specialize only the selected mesh and pixel stages when whole unread varyings bring the mesh output under the D3D12 size limit. Preserve binding metadata, other signature elements, and independent shader translations.

(cherry picked from commit 1e0ce45f2b8e95074459d4ccf10589083e9669c5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:52:53 +00:00
github-bot closed this pull request 2026-11-26 03:52:53 +00:00
Author
Owner

@⁠avt0m4t48 on GitHub · 2026-11-25 11:22 UTC · original

Independent verification on 7e656a3c689f73ddaf823603cc178bdb8986df40 against f85101b6095e8cf3cecf8f0647cc7f5428daa177, using synthetic shader containers.

  • A 128-lane mesh with 128 declared vertices, sixteen four-component outputs, and one scalar at row 16, column 2 emitted a 33,280-byte output layout. With an unread pixel input matching that scalar, prune_mesh_pair emitted a 32,768-byte mesh layout and removed the input from the pixel signature. All sixteen retained signature records matched their originals. The standalone mesh and pixel DXIL were byte-identical across base and head.
  • The linker declined a different semantic index, a different component column, a mesh already below the limit, reversed stages, and mismatched host binding metadata.
  • Two separate bitcode IR tests checked that removed vertex stores disappear, later vertex store and pixel read IDs shift, primitive store IDs stay fixed, and a surviving loadInput or attributeAtVertex read of a removed ID rejects the remap before editing the module.

The Linux shader library suite passed 171 tests on base and 172 on head, with 2 ignored on each. The head also passed cargo check -p victory-shader -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --features blake3/pure on Linux. This run checked emission and compile-time behavior. Microsoft DXIL validation, D3D12 PSO creation, and Windows/GPU execution remain unverified by these fixtures.

**@⁠avt0m4t48** on GitHub · 2026-11-25 11:22 UTC · [original](https://github.com/fxceless/victory-fork/pull/871#issuecomment-7160966304) Independent verification on `7e656a3c689f73ddaf823603cc178bdb8986df40` against `f85101b6095e8cf3cecf8f0647cc7f5428daa177`, using synthetic shader containers. - A 128-lane mesh with 128 declared vertices, sixteen four-component outputs, and one scalar at row 16, column 2 emitted a 33,280-byte output layout. With an unread pixel input matching that scalar, `prune_mesh_pair` emitted a 32,768-byte mesh layout and removed the input from the pixel signature. All sixteen retained signature records matched their originals. The standalone mesh and pixel DXIL were byte-identical across base and head. - The linker declined a different semantic index, a different component column, a mesh already below the limit, reversed stages, and mismatched host binding metadata. - Two separate bitcode IR tests checked that removed vertex stores disappear, later vertex store and pixel read IDs shift, primitive store IDs stay fixed, and a surviving `loadInput` or `attributeAtVertex` read of a removed ID rejects the remap before editing the module. The Linux shader library suite passed 171 tests on base and 172 on head, with 2 ignored on each. The head also passed `cargo check -p victory-shader -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --features blake3/pure` on Linux. This run checked emission and compile-time behavior. Microsoft DXIL validation, D3D12 PSO creation, and Windows/GPU execution remain unverified by these fixtures.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 12:23 UTC · original

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head 7e656a3 into main f85101b in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails with exactly the errors main itself has on this machine (placed_filler_twins, depth_written, a sort; PR #841 fixes them), also with --all-features; this PR adds none. cargo test --workspace --locked: run 1: 556 passed, 0 failed, 11 ignored; run 2: stopped at indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields (the one that fails on main itself most runs here (PR #849 and #847 fix its assertion)) (main alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-25 12:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/871#issuecomment-7162304234) Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head `7e656a3` into `main` `f85101b` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings` fails with exactly the errors `main` itself has on this machine (`placed_filler_twins`, `depth_written`, a sort; PR #841 fixes them), also with `--all-features`; this PR adds none. `cargo test --workspace --locked`: run 1: 556 passed, 0 failed, 11 ignored; run 2: stopped at `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields` (the one that fails on `main` itself most runs here (PR #849 and #847 fix its assertion)) (`main` alone: 555 passed, 0 failed, 11 ignored). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.