Shaders, GPU: link over-budget mesh and pixel shaders under D3D12's 32 KiB output limit #2398

Open
github-bot wants to merge 2 commits from github-bot/gh-2398 into main AGit
Owner

@⁠Texbirds on GitHub · 2026-11-25 12:46 UTC · original
Texbirds:feat/shader-mesh-linked-output-budget → main · +819 −16 · 5 files · 2 commits · open

Problem

On main (940d32f), the remaining 71 mesh shader DXIL validation failures all fail with vertex plus primitive output size is greater than 32768. These shaders declare 65–68 output components across 128 lanes (up to 34,816 B > 32,768 B), so lowering max_vertices/max_primitives to the thread count alone cannot fit them under D3D12's 32 KiB budget, while refusing them drops their draws.

Fix

  1. Exact budget computation (victory-shader/src/emit/container.rs, emit/mod.rs):
    • Add MESH_OUTPUT_LIMIT (32 * 1024) and mesh_output_bytes matching DXIL's 32-vertex / 32-primitive chunked output-size validation formula (also readable from emitted DXIL via PSV0/OSG1/PSG1 with no HostShader / shader-cache schema change).
  2. Standalone count tightening (victory-shader/src/emit/lower.rs):
    • When a mesh shader's declared max_vertices/max_primitives push its output footprint past 32 KiB, tighten them to ms.threads (every lowered mesh output writes mesh_thread()).
  3. Linked mesh + pixel output pruning (victory-shader/src/emit/lower.rs, emit/mod.rs, victory-gpu/src/pipeline.rs, pipeline/host.rs):
    • Add emit::translate_linked(mesh, pixel, options) which inspects the paired pixel shader's ISG1 read masks (or empty reads for depth-only pixel = None), removes arbitrary (kind == 0) outputs the pixel shader never reads, and trims unread leading/trailing channels identically on both stages so D3D12 cross-stage signature linking stays exact.
    • Keep packed_half and unnamed_row anchored to the unpruned console signatures (x.inputs / x.outputs) so 16-bit packed-half placement is preserved when dead elements are pruned.
    • In HostPipeline::new, invoke cached pipeline::translate_linked only when a mesh shader still exceeds MESH_OUTPUT_LIMIT standalone (zero overhead for the ~99% of mesh shaders already under 32 KiB).

Tests

  • container::tests::mesh_output_bytes_matches_dxil_budget
  • emit::tests::mesh_exceeding_32k_tightens_counts_to_group_threads (64-lane mesh tightened from 34,816 B to 17,408 B + dxil.dll validation)
  • emit::tests::linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw (128-lane, 68-component = 34,816 B mesh linked depth-only to 2,048 B and linked with a paired pixel shader reading TEXCOORD0.xy + TEXCOORD15.zw to 4,096 B, validated with dxil.dll and rendered on hardware + WARP verifying all 256 pixels match [1.0, 0.5, 0.25, 1.0])

Verification

Awaiting Windows CI (cargo clippy default + --all-features, cargo test --workspace --locked) and hardware/corpus testing.

**@⁠Texbirds** on GitHub · 2026-11-25 12:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398) `Texbirds:feat/shader-mesh-linked-output-budget` → `main` · +819 −16 · 5 files · 2 commits · open ## Problem On `main` (`940d32f`), the remaining 71 mesh shader DXIL validation failures all fail with `vertex plus primitive output size is greater than 32768`. These shaders declare 65–68 output components across 128 lanes (up to 34,816 B > 32,768 B), so lowering `max_vertices`/`max_primitives` to the thread count alone cannot fit them under D3D12's 32 KiB budget, while refusing them drops their draws. ## Fix 1. **Exact budget computation (`victory-shader/src/emit/container.rs`, `emit/mod.rs`):** - Add `MESH_OUTPUT_LIMIT` (`32 * 1024`) and `mesh_output_bytes` matching DXIL's 32-vertex / 32-primitive chunked output-size validation formula (also readable from emitted DXIL via `PSV0`/`OSG1`/`PSG1` with no `HostShader` / shader-cache schema change). 2. **Standalone count tightening (`victory-shader/src/emit/lower.rs`):** - When a mesh shader's declared `max_vertices`/`max_primitives` push its output footprint past 32 KiB, tighten them to `ms.threads` (every lowered mesh output writes `mesh_thread()`). 3. **Linked mesh + pixel output pruning (`victory-shader/src/emit/lower.rs`, `emit/mod.rs`, `victory-gpu/src/pipeline.rs`, `pipeline/host.rs`):** - Add `emit::translate_linked(mesh, pixel, options)` which inspects the paired pixel shader's `ISG1` read masks (or empty reads for depth-only `pixel = None`), removes arbitrary (`kind == 0`) outputs the pixel shader never reads, and trims unread leading/trailing channels identically on both stages so D3D12 cross-stage signature linking stays exact. - Keep `packed_half` and `unnamed_row` anchored to the unpruned console signatures (`x.inputs` / `x.outputs`) so 16-bit packed-half placement is preserved when dead elements are pruned. - In `HostPipeline::new`, invoke cached `pipeline::translate_linked` only when a mesh shader still exceeds `MESH_OUTPUT_LIMIT` standalone (zero overhead for the ~99% of mesh shaders already under 32 KiB). ## Tests - `container::tests::mesh_output_bytes_matches_dxil_budget` - `emit::tests::mesh_exceeding_32k_tightens_counts_to_group_threads` (64-lane mesh tightened from 34,816 B to 17,408 B + `dxil.dll` validation) - `emit::tests::linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw` (128-lane, 68-component = 34,816 B mesh linked depth-only to 2,048 B and linked with a paired pixel shader reading `TEXCOORD0.xy` + `TEXCOORD15.zw` to 4,096 B, validated with `dxil.dll` and rendered on hardware + WARP verifying all 256 pixels match `[1.0, 0.5, 0.25, 1.0]`) ## Verification Awaiting Windows CI (`cargo clippy` default + `--all-features`, `cargo test --workspace --locked`) and hardware/corpus testing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:04:40 +00:00
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-25 13:02 UTC · original

Tested 35ae33b on an RTX 5080 (driver 621.40) and built-in Microsoft WARP (10.0.26100.10068). All three new tests passed on the unmodified PR head. I also ran the linked draw once per adapter with readback logging and checked each adapter’s DXGI identity.

16 × 16 linked mesh + pixel draw Expected RGBA32F Pixels matching all four channels
RTX 5080 [1.0, 0.5, 0.25, 1.0] 256/256
Built-in WARP [1.0, 0.5, 0.25, 1.0] 256/256

The 128-thread synthetic mesh declared 34,816 bytes standalone. Linking reduced that to 4,096 bytes with the paired pixel shader and 2,048 bytes for positions alone. The Windows SDK DXIL validator accepted both linked mesh shaders and the paired pixel shader. The separate 64-thread case validated at 17,408 bytes.

The PR test validates the positions-only mesh. As an additional local check, I drew it on the RTX with no pixel shader into a D32 target cleared to 1.0. With a full viewport, 256/256 depths read exactly 0.5. With a half-width scissor, all 128 covered pixels read 0.5 and all 128 outside it retained 1.0. On built-in WARP, that additional draw returned a device error before any depth readback, so its depth result is inconclusive. The color readback above completed on both adapters.

These are synthetic shader fixtures. The 71 title shaders and their in-game draws remain unverified here.

**@⁠steven-seagull27** on GitHub · 2026-11-25 13:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7163206247) Tested `35ae33b` on an RTX 5080 (driver 621.40) and built-in Microsoft WARP (10.0.26100.10068). All three new tests passed on the unmodified PR head. I also ran the linked draw once per adapter with readback logging and checked each adapter’s DXGI identity. | 16 × 16 linked mesh + pixel draw | Expected RGBA32F | Pixels matching all four channels | |---|---|---:| | RTX 5080 | `[1.0, 0.5, 0.25, 1.0]` | 256/256 | | Built-in WARP | `[1.0, 0.5, 0.25, 1.0]` | 256/256 | The 128-thread synthetic mesh declared 34,816 bytes standalone. Linking reduced that to **4,096 bytes** with the paired pixel shader and **2,048 bytes** for positions alone. The Windows SDK DXIL validator accepted both linked mesh shaders and the paired pixel shader. The separate 64-thread case validated at **17,408 bytes**. The PR test validates the positions-only mesh. As an additional local check, I drew it on the RTX with no pixel shader into a D32 target cleared to 1.0. With a full viewport, 256/256 depths read exactly 0.5. With a half-width scissor, all 128 covered pixels read 0.5 and all 128 outside it retained 1.0. On built-in WARP, that additional draw returned a device error before any depth readback, so its depth result is inconclusive. The color readback above completed on both adapters. These are synthetic shader fixtures. The 71 title shaders and their in-game draws remain unverified here.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:55 UTC · original · edited 2026-11-26 00:20 UTC

Automated triage for the maintainers.

Merge candidate. Mesh shaders over D3D12's 32 KiB output budget have their counts tightened to the thread count (Lower::new, crates/victory-shader/src/emit/lower.rs). One that still doesn't fit is translated again with its pixel shader (translate_linked, emit/mod.rs), dropping outputs the pixel shader never reads. 13ac07b addresses both findings from the last triage: emit_linked_mesh returns an error if the linked mesh is still over MESH_OUTPUT_LIMIT (on both the paired and depth-only paths), and HostPipeline::new (crates/victory-gpu/src/pipeline/host.rs) now refuses the pipeline instead of falling back to the over-budget standalone mesh. Count tightening now looks at the unpruned x.outputs/x.prims, so pruning can't bring back 256 primitives on a 128-thread mesh. The test covers the exact limit, one component over it, and the kept primitive count.

On your reply: confirmed in the diff. eIBart0's in-game run on AMD in this thread (all 71 previously refused mesh shaders translate; faces and skin render) and the RTX/WARP/Intel runs are on the earlier head. A hardware re-run of 13ac07b would be welcome. CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7167435062) · edited 2026-11-26 00:20 UTC <!-- victory-triage v1 head=13ac07b570b806fbe77434a6240b6f6d190b063e verdict=merge-candidate at=2026-11-26T00:20:35Z --> Automated triage for the maintainers. **Merge candidate.** Mesh shaders over D3D12's 32 KiB output budget have their counts tightened to the thread count (`Lower::new`, `crates/victory-shader/src/emit/lower.rs`). One that still doesn't fit is translated again with its pixel shader (`translate_linked`, `emit/mod.rs`), dropping outputs the pixel shader never reads. `13ac07b` addresses both findings from the last triage: `emit_linked_mesh` returns an error if the linked mesh is still over `MESH_OUTPUT_LIMIT` (on both the paired and depth-only paths), and `HostPipeline::new` (`crates/victory-gpu/src/pipeline/host.rs`) now refuses the pipeline instead of falling back to the over-budget standalone mesh. Count tightening now looks at the unpruned `x.outputs`/`x.prims`, so pruning can't bring back 256 primitives on a 128-thread mesh. The test covers the exact limit, one component over it, and the kept primitive count. On your reply: confirmed in the diff. eIBart0's in-game run on AMD in this thread (all 71 previously refused mesh shaders translate; faces and skin render) and the RTX/WARP/Intel runs are on the earlier head. A hardware re-run of `13ac07b` would be welcome. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠eIBart0 on GitHub · 2026-11-25 16:13 UTC · original

Tested on AMD: RX 9070 XT (driver 32.0.31041.3013), Windows 11, ported onto Belobug's AMD fork (01aadd1). All 71 previously refused mesh shaders translate, and characters' faces and skin now render in game (they were missing before). The PR's three tests pass on Windows with dxil.dll validation.

Two notes from the port, in case they help here too:

  • On that fork, mesh shaders starting with v_mbcnt_lo_u32_b32 v1, -1, 0 declared WaveOps without emitting a wave op (the fork treats mesh masks as host masks), so the new tests failed validation with "Flags must match usage". Setting the flag only where waveGetLaneIndex is emitted fixed it. Upstream may not hit this, since mesh masks are not host masks there.
  • When translate_linked returns None for a mesh still over 32 KiB, the standalone over-budget mesh went on to PSO creation. Refusing the pipeline in that case keeps the previous clean refusal.
**@⁠eIBart0** on GitHub · 2026-11-25 16:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7167705671) Tested on AMD: RX 9070 XT (driver 32.0.31041.3013), Windows 11, ported onto Belobug's AMD fork (`01aadd1`). All 71 previously refused mesh shaders translate, and characters' faces and skin now render in game (they were missing before). The PR's three tests pass on Windows with dxil.dll validation. Two notes from the port, in case they help here too: - On that fork, mesh shaders starting with `v_mbcnt_lo_u32_b32 v1, -1, 0` declared `WaveOps` without emitting a wave op (the fork treats mesh masks as host masks), so the new tests failed validation with "Flags must match usage". Setting the flag only where `waveGetLaneIndex` is emitted fixed it. Upstream may not hit this, since mesh masks are not host masks there. - When `translate_linked` returns `None` for a mesh still over 32 KiB, the standalone over-budget mesh went on to PSO creation. Refusing the pipeline in that case keeps the previous clean refusal.
Author
Owner

@⁠Texbirds on GitHub · 2026-11-25 16:17 UTC · original

Thanks @⁠steven-seagull27 for testing 35ae33b on RTX 5080 and WARP (including the extra depth-only readback)!

Two quick notes on the minor points from triage:

  1. "first bind" log size: bound() in crates/victory-gpu/src/pipeline.rs logs p.shaders (the original unlinked Pipeline::shaders), whereas linked Shaders only live in HostPipeline::stages with translated already initialized, so "first bind" still reports the original container size and nothing reads .container on linked stages.
  2. WARP depth-only draw: Since depth_ms passes DXIL validation and produced 256/256 exact depths (and exact scissor bounds) on RTX 5080, if @⁠steven-seagull27 still has the WARP HRESULT / debug-layer message handy I'd be happy to check whether it's a WARP quirk or anything in the emitted positions-only DXIL.

Leaving 35ae33b untouched for now so the verified head stays intact unless a maintainer wants changes.

**@⁠Texbirds** on GitHub · 2026-11-25 16:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7167759605) Thanks @⁠steven-seagull27 for testing `35ae33b` on RTX 5080 and WARP (including the extra depth-only readback)! Two quick notes on the minor points from triage: 1. **`"first bind"` log size:** `bound()` in `crates/victory-gpu/src/pipeline.rs` logs `p.shaders` (the original unlinked `Pipeline::shaders`), whereas linked `Shader`s only live in `HostPipeline::stages` with `translated` already initialized, so `"first bind"` still reports the original container size and nothing reads `.container` on linked stages. 2. **WARP depth-only draw:** Since `depth_ms` passes DXIL validation and produced 256/256 exact depths (and exact scissor bounds) on RTX 5080, if @⁠steven-seagull27 still has the WARP `HRESULT` / debug-layer message handy I'd be happy to check whether it's a WARP quirk or anything in the emitted positions-only DXIL. Leaving `35ae33b` untouched for now so the verified head stays intact unless a maintainer wants changes.
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 19:03 UTC · original

Tested 35ae33b merged onto current main (13f91ca, merges cleanly) on a laptop with an RTX 4060 Laptop (driver 610.47), an Intel UHD Graphics iGPU (8086:a78b, driver 31.0.101.5445, 16 lanes, no FP64) and WARP (10.0.26100.9818), Windows 11 26200.9974, rustc 1.98.1. Validation used the Windows SDK dxil.dll (10.0.26100.0). main has no way to pick an adapter by name, so a local patch (not pushed) selects NVIDIA or Intel for both emit::host::Host and victory-gpu's host device and logs which adapter each test process used. Intel is new coverage for this PR.

cargo test -p victory-shader --lib --locked --no-fail-fast and cargo test -p victory-gpu --lib --locked --no-fail-fast, run on main and on the merge, per adapter. WARP: VICTORY_WARP=1, and for victory-gpu VICTORY_D3D12_WARP=1 with --features diagnostics, since that switch only exists there. On the RTX I skipped emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index on both sides, because it crashes the test process with an access violation on main too.

Adapter victory-shader (passed/failed) main → merge victory-gpu main → merge
RTX 4060 Laptop 266/3 → 270/3, same 3 192/3 → 193/2 *
WARP 267/3 → 271/3, same 3 198/0 → 198/0
Intel UHD (a78b) 261/9 → 265/9, same 9 192/3 → 192/3, same 3

The +4 in victory-shader are this PR's 3 tests plus the ported test below. Every failure also fails on main on the same adapter, and none is in mesh or linking code (stride/gather/permute/BVH/fspx/64-bit image atomics, already known per adapter). * descriptor::host::tests::a_slot_rewritten_while_its_view_is_prepared_views_the_new_record failed once on main and passed 3 of 3 reruns, so it is flaky, not a difference.

All 3 tests from this PR pass on every adapter. With --nocapture, both linked draws read back 256/256 on the RTX and on WARP. The Intel UHD reports no mesh shader support (D3D12_OPTIONS7), so there the draw parts skip themselves ("no mesh shaders on the hardware device"). Translation, the byte counts and dxil.dll validation still pass, and the WARP leg of the same process still draws 256/256. In practice an iGPU of this generation never reaches the linked path in the game. The PR's 16-lane coverage is that nothing regresses there.

Test that could be cherry-picked. I ported the test I had written for the closed #1563 to this PR's emit_pruned / pixel_input_reads (commit 194e921, on top of 35ae33b, test only). It covers what linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw does not:

  • dxil.dll must refuse the unlinked 128-lane / 68-component mesh with "greater than 32768". The existing test checks only the byte count.
  • The pixel program reads TEXCOORD1.x and .w, with two unread channels between them, and TEXCOORD15.y alone. It declares TEXCOORD16 and never reads it.
  • Exact linked signatures on both stages: mesh OSG1 = SV_Position, TEXCOORD1 (col 0, 4 cols), TEXCOORD15 (col 1, 1 col). Pixel ISG1 = the same two, with TEXCOORD16 gone. The footprint is 4,608 bytes, and both modules validate.
  • Every exported component has a different value, so a column shifted by the trimming shows up in the readback. It reads back (1.0, 1.75, 15.25, 1.0) on 256/256 texels on the RTX and on WARP. Intel skips the draw as above.

It passes on all three adapters, both on the PR head and merged onto main. cargo clippy -p victory-shader --all-targets with --features host and with --all-features, -D warnings: clean. rustfmt: clean.

git fetch https://github.com/KainanP/VIctory.git test/linked-mesh-pixel-2398
git cherry-pick 194e921c9463a7effba9063b792c9f83a048b697

A small note: cargo clippy -p victory-shader --all-targets without the host feature now warns that emit::lower::lower is never used, since only emit::host and the tests call it after this change. CI builds the workspace with host on, so CI doesn't see the warning.

This supersedes #1563 (claude-GTA6's earlier mesh+pixel linking, closed without a reason). We had asked there whether it would come back before reviving it from a fork. With this PR covering it, we won't revive it, and I've left a note there.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.

**@⁠KainanP** on GitHub · 2026-11-25 19:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7171757645) Tested `35ae33b` merged onto current `main` (`13f91ca`, merges cleanly) on a laptop with an **RTX 4060 Laptop** (driver 610.47), an **Intel UHD Graphics** iGPU (`8086:a78b`, driver 31.0.101.5445, 16 lanes, no FP64) and **WARP** (10.0.26100.9818), Windows 11 26200.9974, rustc 1.98.1. Validation used the Windows SDK `dxil.dll` (10.0.26100.0). `main` has no way to pick an adapter by name, so a local patch (not pushed) selects NVIDIA or Intel for both `emit::host::Host` and `victory-gpu`'s host device and logs which adapter each test process used. Intel is new coverage for this PR. `cargo test -p victory-shader --lib --locked --no-fail-fast` and `cargo test -p victory-gpu --lib --locked --no-fail-fast`, run on `main` and on the merge, per adapter. WARP: `VICTORY_WARP=1`, and for victory-gpu `VICTORY_D3D12_WARP=1` with `--features diagnostics`, since that switch only exists there. On the RTX I skipped `emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index` on both sides, because it crashes the test process with an access violation on `main` too. | Adapter | victory-shader (passed/failed) `main` → merge | victory-gpu `main` → merge | |---|---|---| | RTX 4060 Laptop | 266/3 → 270/3, same 3 | 192/3 → 193/2 * | | WARP | 267/3 → 271/3, same 3 | 198/0 → 198/0 | | Intel UHD (a78b) | 261/9 → 265/9, same 9 | 192/3 → 192/3, same 3 | The +4 in victory-shader are this PR's 3 tests plus the ported test below. Every failure also fails on `main` on the same adapter, and none is in mesh or linking code (stride/gather/permute/BVH/fspx/64-bit image atomics, already known per adapter). \* `descriptor::host::tests::a_slot_rewritten_while_its_view_is_prepared_views_the_new_record` failed once on `main` and passed 3 of 3 reruns, so it is flaky, not a difference. All 3 tests from this PR pass on every adapter. With `--nocapture`, both linked draws read back 256/256 on the RTX and on WARP. **The Intel UHD reports no mesh shader support** (`D3D12_OPTIONS7`), so there the draw parts skip themselves ("no mesh shaders on the hardware device"). Translation, the byte counts and `dxil.dll` validation still pass, and the WARP leg of the same process still draws 256/256. In practice an iGPU of this generation never reaches the linked path in the game. The PR's 16-lane coverage is that nothing regresses there. **Test that could be cherry-picked.** I ported the test I had written for the closed #1563 to this PR's `emit_pruned` / `pixel_input_reads` (commit `194e921`, on top of `35ae33b`, test only). It covers what `linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw` does not: - `dxil.dll` must **refuse** the unlinked 128-lane / 68-component mesh with "greater than 32768". The existing test checks only the byte count. - The pixel program reads `TEXCOORD1.x` and `.w`, with two unread channels between them, and `TEXCOORD15.y` alone. It declares `TEXCOORD16` and never reads it. - Exact linked signatures on **both** stages: mesh `OSG1` = `SV_Position`, `TEXCOORD1` (col 0, 4 cols), `TEXCOORD15` (col 1, 1 col). Pixel `ISG1` = the same two, with `TEXCOORD16` gone. The footprint is 4,608 bytes, and both modules validate. - Every exported component has a different value, so a column shifted by the trimming shows up in the readback. It reads back (1.0, 1.75, 15.25, 1.0) on 256/256 texels on the RTX and on WARP. Intel skips the draw as above. It passes on all three adapters, both on the PR head and merged onto `main`. `cargo clippy -p victory-shader --all-targets` with `--features host` and with `--all-features`, `-D warnings`: clean. rustfmt: clean. ``` git fetch https://github.com/KainanP/VIctory.git test/linked-mesh-pixel-2398 git cherry-pick 194e921c9463a7effba9063b792c9f83a048b697 ``` A small note: `cargo clippy -p victory-shader --all-targets` **without** the `host` feature now warns that `emit::lower::lower` is never used, since only `emit::host` and the tests call it after this change. CI builds the workspace with `host` on, so CI doesn't see the warning. This supersedes #1563 (claude-GTA6's earlier mesh+pixel linking, closed without a reason). We had asked there whether it would come back before reviving it from a fork. With this PR covering it, we won't revive it, and I've left a note there. _AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this._
Author
Owner

@⁠brainbudt on GitHub · 2026-11-25 21:10 UTC · original

Note

🤖 Gemini 4 Neon (with GPT-6.2 Astra, Mistral Large 4, and DeepSeek V4.1 Flash) responding on behalf of brainbudt

Independently tested 35ae33b merged onto 13f91ca. Windows MSVC workspace cargo check --tests passed, and the sparse linked draw produced the expected RGBA output on all 256/256 pixels on Windows WARP (10.0.26100.9818). Two issues found before merge:

  1. Blocker — translate_linked returns Ok for still-over-budget output (crates/victory-shader/src/emit/mod.rs:530, crates/victory-gpu/src/pipeline/host.rs:353): With 128 lanes, 60 live components + position produces 32,768 bytes and validates, but 61 or 64 live components returns Ok at 33,280 B / 34,816 B. Microsoft DXIL Validator 1.9.2609.5 (and dxv) rejects both (vertex plus primitive output size is greater than 32768), yet the GPU path caches the pair as a success—and on link error it can still pass the known-over-budget standalone mesh to pipeline creation. Please enforce <= 32,768 bytes on both return paths and refuse pipeline creation when an over-budget mesh fails to link.
  2. Primitive count tightening reversed under sparse linking (crates/victory-shader/src/emit/lower.rs:594): In a 128-thread fixture declaring 256 primitives, standalone DXIL emits setMeshOutputCounts(128, 128), whereas sparse linked DXIL restores (128, 256) while both emitIndices calls still index by thread ID, leaving primitives 128–255 without indices. Preserving the pre-pruning count decision avoids this mismatch.
**@⁠brainbudt** on GitHub · 2026-11-25 21:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7174706327) > [!NOTE] > 🤖 **Gemini 4 Neon (with GPT-6.2 Astra, Mistral Large 4, and DeepSeek V4.1 Flash) responding on behalf of brainbudt** Independently tested `35ae33b` merged onto `13f91ca`. Windows MSVC workspace `cargo check --tests` passed, and the sparse linked draw produced the expected RGBA output on all 256/256 pixels on Windows WARP (`10.0.26100.9818`). Two issues found before merge: 1. **Blocker — `translate_linked` returns `Ok` for still-over-budget output (`crates/victory-shader/src/emit/mod.rs:530`, `crates/victory-gpu/src/pipeline/host.rs:353`):** With 128 lanes, 60 live components + position produces 32,768 bytes and validates, but 61 or 64 live components returns `Ok` at **33,280 B** / **34,816 B**. Microsoft DXIL Validator `1.9.2609.5` (and `dxv`) rejects both (`vertex plus primitive output size is greater than 32768`), yet the GPU path caches the pair as a success—and on link error it can still pass the known-over-budget standalone mesh to pipeline creation. Please enforce `<= 32,768` bytes on both return paths and refuse pipeline creation when an over-budget mesh fails to link. 2. **Primitive count tightening reversed under sparse linking (`crates/victory-shader/src/emit/lower.rs:594`):** In a 128-thread fixture declaring 256 primitives, standalone DXIL emits `setMeshOutputCounts(128, 128)`, whereas sparse linked DXIL restores `(128, 256)` while both `emitIndices` calls still index by thread ID, leaving primitives 128–255 without indices. Preserving the pre-pruning count decision avoids this mismatch.
Author
Owner

@⁠Texbirds on GitHub · 2026-11-25 21:54 UTC · original

Note

🤖 Gemini 4 Neon (with GPT-6.2 Astra, Mistral Large 4, and DeepSeek V4.1 Flash) responding on behalf of brainbudt

Independently tested 35ae33b merged onto 13f91ca. Windows MSVC workspace cargo check --tests passed, and the sparse linked draw produced the expected RGBA output on all 256/256 pixels on Windows WARP (10.0.26100.9818). Two issues found before merge:

  1. Blocker — translate_linked returns Ok for still-over-budget output (crates/victory-shader/src/emit/mod.rs:530, crates/victory-gpu/src/pipeline/host.rs:353): With 128 lanes, 60 live components + position produces 32,768 bytes and validates, but 61 or 64 live components returns Ok at 33,280 B / 34,816 B. Microsoft DXIL Validator 1.9.2609.5 (and dxv) rejects both (vertex plus primitive output size is greater than 32768), yet the GPU path caches the pair as a success—and on link error it can still pass the known-over-budget standalone mesh to pipeline creation. Please enforce <= 32,768 bytes on both return paths and refuse pipeline creation when an over-budget mesh fails to link.
  2. Primitive count tightening reversed under sparse linking (crates/victory-shader/src/emit/lower.rs:594): In a 128-thread fixture declaring 256 primitives, standalone DXIL emits setMeshOutputCounts(128, 128), whereas sparse linked DXIL restores (128, 256) while both emitIndices calls still index by thread ID, leaving primitives 128–255 without indices. Preserving the pre-pruning count decision avoids this mismatch.

Thanks for the boundary cases. I addressed both findings in 40290dc:

  • translate_linked checks the final mesh output size in both the paired and depth-only paths. It accepts exactly 32 KiB and rejects anything larger. If a known-over-budget standalone mesh fails to link, pipeline creation stops instead of falling back to it.
  • Count tightening now uses the original signatures, so pruning can’t restore the declared 256 primitives for the 128-thread mesh.

I extended the existing regression test to cover the exact limit, one retained component over it, and preservation of the 128-primitive count in both linked modes. git diff --check passed. Windows blocked Cargo’s build scripts locally, so the revised test still needs a Windows run.

**@⁠Texbirds** on GitHub · 2026-11-25 21:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7175683392) > Note > > 🤖 **Gemini 4 Neon (with GPT-6.2 Astra, Mistral Large 4, and DeepSeek V4.1 Flash) responding on behalf of brainbudt** > > Independently tested `35ae33b` merged onto `13f91ca`. Windows MSVC workspace `cargo check --tests` passed, and the sparse linked draw produced the expected RGBA output on all 256/256 pixels on Windows WARP (`10.0.26100.9818`). Two issues found before merge: > > 1. **Blocker — `translate_linked` returns `Ok` for still-over-budget output (`crates/victory-shader/src/emit/mod.rs:530`, `crates/victory-gpu/src/pipeline/host.rs:353`):** With 128 lanes, 60 live components + position produces 32,768 bytes and validates, but 61 or 64 live components returns `Ok` at **33,280 B** / **34,816 B**. Microsoft DXIL Validator `1.9.2609.5` (and `dxv`) rejects both (`vertex plus primitive output size is greater than 32768`), yet the GPU path caches the pair as a success—and on link error it can still pass the known-over-budget standalone mesh to pipeline creation. Please enforce `<= 32,768` bytes on both return paths and refuse pipeline creation when an over-budget mesh fails to link. > 2. **Primitive count tightening reversed under sparse linking (`crates/victory-shader/src/emit/lower.rs:594`):** In a 128-thread fixture declaring 256 primitives, standalone DXIL emits `setMeshOutputCounts(128, 128)`, whereas sparse linked DXIL restores `(128, 256)` while both `emitIndices` calls still index by thread ID, leaving primitives 128–255 without indices. Preserving the pre-pruning count decision avoids this mismatch. Thanks for the boundary cases. I addressed both findings in `40290dc`: - `translate_linked` checks the final mesh output size in both the paired and depth-only paths. It accepts exactly 32 KiB and rejects anything larger. If a known-over-budget standalone mesh fails to link, pipeline creation stops instead of falling back to it. - Count tightening now uses the original signatures, so pruning can’t restore the declared 256 primitives for the 128-thread mesh. I extended the existing regression test to cover the exact limit, one retained component over it, and preservation of the 128-primitive count in both linked modes. `git diff --check` passed. Windows blocked Cargo’s build scripts locally, so the revised test still needs a Windows run.
Author
Owner

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

Pushed the fixes rebased onto main (f3578e3) at 13ac07b (the earlier 40290dc hadn't been pushed yet):

  • emit_linked_mesh in crates/victory-shader/src/emit/mod.rs now enforces <= MESH_OUTPUT_LIMIT (32 KiB) on both the paired and depth-only paths, and HostPipeline::new (crates/victory-gpu/src/pipeline/host.rs) refuses the pipeline if an over-budget mesh fails to link instead of falling back to the standalone over-budget mesh (also addressing @⁠eIBart0's note).
  • Count tightening in Lower::new (crates/victory-shader/src/emit/lower.rs) checks the original unpruned x.outputs / x.prims signatures so sparse linking cannot restore max_primitives = 256 on a 128-thread mesh.
  • emit_pruned dispatches to lower::lower when keep is None, clearing the dead_code warning on victory-shader builds without --features host noted by @⁠KainanP.
  • Extended linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw to cover the exact 32 KiB boundary, one component over the limit, and preservation of max_primitives = 128 across standalone, depth-only, and linked modes.
**@⁠Texbirds** on GitHub · 2026-11-25 22:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7176650887) Pushed the fixes rebased onto `main` (`f3578e3`) at `13ac07b` (the earlier `40290dc` hadn't been pushed yet): - `emit_linked_mesh` in `crates/victory-shader/src/emit/mod.rs` now enforces `<= MESH_OUTPUT_LIMIT` (32 KiB) on both the paired and depth-only paths, and `HostPipeline::new` (`crates/victory-gpu/src/pipeline/host.rs`) refuses the pipeline if an over-budget mesh fails to link instead of falling back to the standalone over-budget mesh (also addressing @⁠eIBart0's note). - Count tightening in `Lower::new` (`crates/victory-shader/src/emit/lower.rs`) checks the original unpruned `x.outputs` / `x.prims` signatures so sparse linking cannot restore `max_primitives = 256` on a 128-thread mesh. - `emit_pruned` dispatches to `lower::lower` when `keep` is `None`, clearing the `dead_code` warning on `victory-shader` builds without `--features host` noted by @⁠KainanP. - Extended `linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw` to cover the exact 32 KiB boundary, one component over the limit, and preservation of `max_primitives = 128` across standalone, depth-only, and linked modes.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:38 UTC · original

Code review and native RTX 5090 Mesh Shader + WARP + DXIL verification at head 13ac07b570b8 merged cleanly onto main (63bcca43c6a0):

  • Code review: pipeline/host.rs:436-450 triggers pipeline::translate_linked only when standalone mesh_output_bytes > MESH_OUTPUT_LIMIT (32 KiB), passes empty KeptOutputs for depth-only passes, and rejects the pipeline cleanly if pruned outputs still exceed 32 KiB. emit/mod.rs:459-490, 520-571 reads PS ISG1 +25 (ReadWriteMask), prune_signature (lower.rs:595-601, 657-677) drops unread kind == 0 outputs/inputs and tightens max_vertices/max_primitives to .min(ms.threads), while lowering (lower.rs:8199, 10010, 10200) continues indexing register slots against the unpruned self.x signature so slot alignment stays intact.
  • File-size heads-up: After merging onto main (63bcca43), crates/victory-shader/src/emit/lower.rs is 522,975 B (1,313 B under the 512 KiB xtask policy cap). Worth noting if merged alongside other lower.rs-growing PRs (e.g. #2776 / #2920).
  • Verified (Windows 11, NVIDIA RTX 5090 native Mesh Shaders + WARP, VICTORY_D3D12_DEBUG=1, dxil.dll 10.0.26100.0, Rust 1.98.1):
    • RTX 5090: victory-shader (emit::tests emit::lower::tests) 52/52 passed (including linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw and mesh_exceeding_32k_tightens_counts_to_group_threads executing on native Blackwell mesh pipelines); victory-gpu (pipeline) 28/28 passed
    • WARP: victory-shader 52/52 passed; victory-gpu --features diagnostics (pipeline) 28/28 passed
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-shader -p victory-gpu --tests -- -D warnings (default + --all-features): 0 warnings.

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7178968433) Code review and native RTX 5090 Mesh Shader + WARP + DXIL verification at head `13ac07b570b8` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review**: `pipeline/host.rs:436-450` triggers `pipeline::translate_linked` only when standalone `mesh_output_bytes > MESH_OUTPUT_LIMIT` (32 KiB), passes empty `KeptOutputs` for depth-only passes, and rejects the pipeline cleanly if pruned outputs still exceed 32 KiB. `emit/mod.rs:459-490, 520-571` reads PS `ISG1` `+25` (`ReadWriteMask`), `prune_signature` (`lower.rs:595-601, 657-677`) drops unread `kind == 0` outputs/inputs and tightens `max_vertices`/`max_primitives` to `.min(ms.threads)`, while lowering (`lower.rs:8199, 10010, 10200`) continues indexing register slots against the unpruned `self.x` signature so slot alignment stays intact. - **File-size heads-up**: After merging onto `main` (`63bcca43`), `crates/victory-shader/src/emit/lower.rs` is `522,975` B (`1,313` B under the 512 KiB `xtask policy` cap). Worth noting if merged alongside other `lower.rs`-growing PRs (e.g. `#2776` / `#2920`). - **Verified (Windows 11, NVIDIA RTX 5090 native Mesh Shaders + WARP, `VICTORY_D3D12_DEBUG=1`, `dxil.dll` 10.0.26100.0, Rust 1.98.1)**: - RTX 5090: `victory-shader` (`emit::tests emit::lower::tests`) **52/52 passed** (including `linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw` and `mesh_exceeding_32k_tightens_counts_to_group_threads` executing on native Blackwell mesh pipelines); `victory-gpu` (`pipeline`) **28/28 passed** - WARP: `victory-shader` **52/52 passed**; `victory-gpu --features diagnostics` (`pipeline`) **28/28 passed** - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-shader -p victory-gpu --tests -- -D warnings` (default + `--all-features`): 0 warnings. LGTM.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 01:22 UTC · original · edited 2026-11-26 01:42 UTC

@⁠Texbirds I reran the depth-only case on 13ac07b. On built-in WARP 10.0.26100.10068 the positions-only mesh PSO was created. The first D32 draw then returned 0x887A0005 (DXGI_ERROR_DEVICE_REMOVED), and GetDeviceRemovedReason returned the same HRESULT. The D3D12 info queue reported message 234, ID3D12Device::RemoveDevice, with “Plug-and-play stop has been exercised on this adapter.” I saw no preceding validation error in the queue. The draw also failed with the debug layer off.

I compiled a separate native ms_6_6 mesh in DXC with 128 threads, 128 vertices, 128 copies of triangle (0, 1, 2), and positions generated from SV_GroupIndex. I used the same depth buffer, root signature, viewport, command recording and readback. Each cell below ran in a separate process with the debug layer.

D32 draw at 16 × 16 RTX 5080, driver 621.40 Built-in WARP
VIctory mesh, no PS exact 0x887A0005
Native mesh, no PS exact 0x887A0005
VIctory mesh + PS passing SV_Position.z to SV_Depth exact exact
Native mesh + same PS exact exact

“Exact” means all 256 pixels read 0.5 in the full draw. With a half-width scissor, 128 read 0.5 and 128 kept the clear depth of 1.0, at the expected positions. The ordinary linked color draw matched 256/256 on the RTX and built-in WARP. The updated assertions for exactly 32 KiB, one component over budget, and the 128-primitive limit also passed. The native control narrows the built-in WARP failure to something reproducible without VIctory’s mesh translation. It has not identified the cause in the D3D12 stack.

App-local Microsoft WARP 1.0.22 behaved differently on this PC. Its native control produced exact depth with and without a PS. The translated draw left all 256 depths at the clear value in both cases, and the ordinary linked color check matched 0/256. I would track that software runtime separately from the built-in WARP HRESULT above.

Follow-up on portable WARP 1.0.22. The translated mesh writes degenerate primitive indices before the guest exp prim writes its actual indices. A native DXC mesh reproduced the discrepancy with just two assignments to one primitive. Each thread used its own SV_GroupIndex, in bounds, and a depth pixel shader was present throughout. Here's how many of the 256 pixels received depth 0.5:

Indices written by each thread, in order RTX 5080 Built-in WARP WARP 1.0.22
Only (0,1,2) 256 256 256
Only (0,0,0) 0 0 0
(0,0,0) then (0,1,2) 256 256 0
(0,1,2) then (0,0,0) 0 0 256

Both DXC -Od and -O3 retained the two emitIndices calls and produced the same table. The D3D12 mesh specification says the last write to the same primitive supplies its indices. The portable runtime behaved as if the first write won on this fixture. DirectX mesh shader specification, Vertex Indices

As a diagnostic on this one shader, every lane exports a primitive, so I omitted the initial degenerate write. The actual translated linked draw then produced 256/256 correct color pixels on portable WARP. Full-frame depth was correct at 256/256 and the scissored depth was correct at 128 written + 128 clear, three runs on all three adapters. General guest shaders can leave primitives unwritten and still need initialization. This explains the portable result separately from the built-in WARP no-pixel-shader device removal.

AI-assisted with Codex. Synthetic draws only.

**@⁠steven-seagull27** on GitHub · 2026-11-26 01:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7179716789) · edited 2026-11-26 01:42 UTC @⁠Texbirds I reran the depth-only case on `13ac07b`. On built-in WARP 10.0.26100.10068 the positions-only mesh PSO was created. The first D32 draw then returned **`0x887A0005` (`DXGI_ERROR_DEVICE_REMOVED`)**, and `GetDeviceRemovedReason` returned the same HRESULT. The D3D12 info queue reported message **234**, `ID3D12Device::RemoveDevice`, with “Plug-and-play stop has been exercised on this adapter.” I saw no preceding validation error in the queue. The draw also failed with the debug layer off. I compiled a separate native `ms_6_6` mesh in DXC with 128 threads, 128 vertices, 128 copies of triangle (0, 1, 2), and positions generated from `SV_GroupIndex`. I used the same depth buffer, root signature, viewport, command recording and readback. Each cell below ran in a separate process with the debug layer. | D32 draw at 16 × 16 | RTX 5080, driver 621.40 | Built-in WARP | |---|---|---| | VIctory mesh, no PS | exact | `0x887A0005` | | Native mesh, no PS | exact | `0x887A0005` | | VIctory mesh + PS passing `SV_Position.z` to `SV_Depth` | exact | exact | | Native mesh + same PS | exact | exact | “Exact” means all 256 pixels read 0.5 in the full draw. With a half-width scissor, 128 read 0.5 and 128 kept the clear depth of 1.0, at the expected positions. The ordinary linked color draw matched 256/256 on the RTX and built-in WARP. The updated assertions for exactly 32 KiB, one component over budget, and the 128-primitive limit also passed. The native control narrows the built-in WARP failure to something reproducible without VIctory’s mesh translation. It has not identified the cause in the D3D12 stack. App-local Microsoft WARP 1.0.22 behaved differently on this PC. Its native control produced exact depth with and without a PS. The translated draw left all 256 depths at the clear value in both cases, and the ordinary linked color check matched 0/256. I would track that software runtime separately from the built-in WARP HRESULT above. **Follow-up on portable WARP 1.0.22.** The translated mesh writes degenerate primitive indices before the guest `exp prim` writes its actual indices. A native DXC mesh reproduced the discrepancy with just two assignments to one primitive. Each thread used its own `SV_GroupIndex`, in bounds, and a depth pixel shader was present throughout. Here's how many of the 256 pixels received depth 0.5: | Indices written by each thread, in order | RTX 5080 | Built-in WARP | WARP 1.0.22 | |---|---:|---:|---:| | Only `(0,1,2)` | 256 | 256 | 256 | | Only `(0,0,0)` | 0 | 0 | 0 | | `(0,0,0)` then `(0,1,2)` | 256 | 256 | 0 | | `(0,1,2)` then `(0,0,0)` | 0 | 0 | 256 | Both DXC `-Od` and `-O3` retained the two `emitIndices` calls and produced the same table. The D3D12 mesh specification says the **last** write to the same primitive supplies its indices. The portable runtime behaved as if the **first** write won on this fixture. [DirectX mesh shader specification, Vertex Indices](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html#vertex-indices) As a diagnostic on this one shader, every lane exports a primitive, so I omitted the initial degenerate write. The actual translated linked draw then produced **256/256 correct color pixels** on portable WARP. Full-frame depth was correct at 256/256 and the scissored depth was correct at 128 written + 128 clear, three runs on all three adapters. General guest shaders can leave primitives unwritten and still need initialization. This explains the portable result separately from the built-in WARP no-pixel-shader device removal. AI-assisted with Codex. Synthetic draws only.
Author
Owner

@⁠r4tedx on GitHub · 2026-11-26 07:07 UTC · original

Tested 13ac07b5 merged onto current main (842b0cb). It merges cleanly.

The new commit (13ac07b5) looks right to me. The count tightening now measures the original signatures, so pruning cannot bring the declared counts back. A linked mesh that still exceeds 32 KiB is refused by name, and the pipeline is refused rather than silently falling back to the standalone mesh. The unpruned path calls lower::lower again, which also clears the clippy finding I reported earlier (function `lower` is never used). cargo clippy -p victory-shader --all-targets -- -D warnings is now clean with and without --features diagnostics. So are victory-gpu (both) and victory.

Offline census over the title's shader pack:

  • Per stage (the census translates each stage alone): 0 programs lost and 0 gained. The 71 meshes still report vertex plus primitive output size is greater than 32768 when translated alone. That is expected, because the fix is in the linked path.
  • Linked depth-only (translate_linked(mesh, None, ..), through a small local census aid that is not part of this PR): 71 of 71 validate, 68 at 2,048 B and 3 at 2,560 B.
  • One real draw, taken from a run log: a mesh that a run created with an over-budget signature, and the pixel shader it was drawn with. The census links each of its 8 mesh variants with each of the 8 pixel variants, 64 combinations. All 64 link and both stages validate, with the linked mesh between 20,480 B and 28,672 B. (My earlier comment said "8 pairs". It was 64 combinations then too, with the same sizes.)

Tests (WARP), main + this PR: victory-shader lib 300 passed, 4 failed, the same 4 that fail on main on this machine's WARP. The PR's tests pass, including the 32 KiB boundary case in linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw. victory-gpu pipeline tests: 28 passed, 0 failed.

The unit tests are synthetic. Local title data was used offline for the census: a translation of the title's shader pack, with only counts and refusal reasons reported.

AI-assisted

**@⁠r4tedx** on GitHub · 2026-11-26 07:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#issuecomment-7185119329) Tested `13ac07b5` merged onto current `main` (`842b0cb`). It merges cleanly. The new commit (`13ac07b5`) looks right to me. The count tightening now measures the original signatures, so pruning cannot bring the declared counts back. A linked mesh that still exceeds 32 KiB is refused by name, and the pipeline is refused rather than silently falling back to the standalone mesh. The unpruned path calls `lower::lower` again, which also clears the clippy finding I reported earlier (``function `lower` is never used``). `cargo clippy -p victory-shader --all-targets -- -D warnings` is now clean with and without `--features diagnostics`. So are `victory-gpu` (both) and `victory`. **Offline census over the title's shader pack:** - Per stage (the census translates each stage alone): 0 programs lost and 0 gained. The 71 meshes still report `vertex plus primitive output size is greater than 32768` when translated alone. That is expected, because the fix is in the linked path. - Linked depth-only (`translate_linked(mesh, None, ..)`, through a small local census aid that is not part of this PR): **71 of 71** validate, 68 at 2,048 B and 3 at 2,560 B. - One real draw, taken from a run log: a mesh that a run created with an over-budget signature, and the pixel shader it was drawn with. The census links each of its 8 mesh variants with each of the 8 pixel variants, 64 combinations. **All 64 link and both stages validate**, with the linked mesh between 20,480 B and 28,672 B. (My earlier comment said "8 pairs". It was 64 combinations then too, with the same sizes.) Tests (WARP), `main` + this PR: `victory-shader` lib 300 passed, 4 failed, the same 4 that fail on `main` on this machine's WARP. The PR's tests pass, including the 32 KiB boundary case in `linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw`. `victory-gpu` `pipeline` tests: 28 passed, 0 failed. The unit tests are synthetic. Local title data was used offline for the census: a translation of the title's shader pack, with only counts and refusal reasons reported. AI-assisted
Author
Owner

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

Link over-budget mesh+pixel shader pairs (LinkedPair/LinkedKey, +761). 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. Large; needs hardware validation.

**@⁠catminou4** on GitHub · 2026-11-25 13:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#pullrequestreview-6058345305) · **reviewed** Link over-budget mesh+pixel shader pairs (LinkedPair/LinkedKey, +761). 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. Large; needs hardware validation.
Author
Owner

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

Reviewed 13ac07b570b806fbe77434a6240b6f6d190b063e merged cleanly onto main (63bcca43c6a0) and verified on Windows 11 x64 with native NVIDIA GeForce RTX 5090 mesh shaders, Microsoft WARP, the D3D12 Debug Layer, and Windows SDK dxil.dll (10.0.26100.0).

Code Review

  • Budget & tightening (crates/victory-shader/src/emit/container.rs:8,13, emit/mod.rs:383, emit/lower.rs:675): mesh_output_bytes matches PSV0 v2 header offsets (+12 max_vertices, +14 max_primitives, +24 stage 13) and the 32-vertex/32-primitive alignment rule. Checking the original unpruned x.outputs / x.prims ensures sparse linking cannot inflate max_primitives back past ms.threads, and mesh_prologue drives both setMeshOutputCounts and the emitIndices guard directly from the tightened counts.
  • Linked signature pruning (crates/victory-shader/src/emit/lower.rs:105,131,8202,10013,10193, emit/mod.rs:459,520,555): pixel_input_reads reads PS ISG1 +25 read masks cleanly, prune_signature trims leading/trailing unread channels consistently across MS outputs/prims and PS inputs, and packed_half / unnamed_row stay anchored to the unpruned self.x signatures so packed 16-bit slot indices stay intact.
  • GPU pipeline integration (crates/victory-gpu/src/pipeline.rs:220,236,255, pipeline/host.rs:412-435): Under-budget mesh pipelines bypass translate_linked with zero overhead and unchanged pipeline library cache keys; translate_linked uses the same Options { view_marks: true } as shader_cache, and an over-budget mesh that still exceeds 32 KiB after linking is cleanly refused rather than falling back to the invalid standalone DXIL.
  • File-size note: Merged onto main (63bcca43), crates/victory-shader/src/emit/lower.rs is 522,975 bytes (1,313 bytes below the 512 KiB xtask policy cap)—worth keeping in mind if other lower.rs-growing PRs land alongside it.

Verification (RTX 5090 + WARP + VICTORY_D3D12_DEBUG=1 + SDK dxil.dll 10.0.26100.0, Rust 1.98.1)

  • cargo run --locked -p xtask -- policy: 191 files ok.
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (without host), plus -p victory-shader -p victory-gpu --all-targets (default and --all-features): 0 warnings.
  • victory-shader (emit::container::tests emit::tests emit::lower::tests, --features host): 54/54 passed on RTX 5090 and 54/54 passed on WARP (--nocapture confirmed both adapters executed the linked draw and validated with dxil.dll without skipping).
  • victory-gpu (pipeline::, VICTORY_D3D12_DEBUG=1): 23/23 passed on RTX 5090; 26/26 passed on WARP (--features diagnostics).
  • Additional negative-control and channel-gap probe: confirmed dxil.dll rejects the unlinked 34,816 B mesh with vertex plus primitive output size is greater than 32768, and accepts a linked mesh retaining a non-contiguous read (TEXCOORD1.x/.w kept as cols=4 plus TEXCOORD15.y trimmed to col=1, cols=1, 4,608 B).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 14:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2398#pullrequestreview-6075832806) · **approved these changes** Reviewed `13ac07b570b806fbe77434a6240b6f6d190b063e` merged cleanly onto `main` (`63bcca43c6a0`) and verified on Windows 11 x64 with native NVIDIA GeForce RTX 5090 mesh shaders, Microsoft WARP, the D3D12 Debug Layer, and Windows SDK `dxil.dll` (`10.0.26100.0`). ### Code Review - **Budget & tightening (`crates/victory-shader/src/emit/container.rs:8,13`, `emit/mod.rs:383`, `emit/lower.rs:675`)**: `mesh_output_bytes` matches `PSV0` v2 header offsets (`+12` `max_vertices`, `+14` `max_primitives`, `+24` stage `13`) and the 32-vertex/32-primitive alignment rule. Checking the original unpruned `x.outputs` / `x.prims` ensures sparse linking cannot inflate `max_primitives` back past `ms.threads`, and `mesh_prologue` drives both `setMeshOutputCounts` and the `emitIndices` guard directly from the tightened counts. - **Linked signature pruning (`crates/victory-shader/src/emit/lower.rs:105,131,8202,10013,10193`, `emit/mod.rs:459,520,555`)**: `pixel_input_reads` reads PS `ISG1` `+25` read masks cleanly, `prune_signature` trims leading/trailing unread channels consistently across MS `outputs`/`prims` and PS `inputs`, and `packed_half` / `unnamed_row` stay anchored to the unpruned `self.x` signatures so packed 16-bit slot indices stay intact. - **GPU pipeline integration (`crates/victory-gpu/src/pipeline.rs:220,236,255`, `pipeline/host.rs:412-435`)**: Under-budget mesh pipelines bypass `translate_linked` with zero overhead and unchanged pipeline library cache keys; `translate_linked` uses the same `Options { view_marks: true }` as `shader_cache`, and an over-budget mesh that still exceeds 32 KiB after linking is cleanly refused rather than falling back to the invalid standalone DXIL. - **File-size note**: Merged onto `main` (`63bcca43`), `crates/victory-shader/src/emit/lower.rs` is `522,975` bytes (`1,313` bytes below the 512 KiB `xtask policy` cap)—worth keeping in mind if other `lower.rs`-growing PRs land alongside it. ### Verification (RTX 5090 + WARP + `VICTORY_D3D12_DEBUG=1` + SDK `dxil.dll` `10.0.26100.0`, Rust `1.98.1`) - `cargo run --locked -p xtask -- policy`: `191 files ok`. - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (without `host`), plus `-p victory-shader -p victory-gpu --all-targets` (default and `--all-features`): 0 warnings. - `victory-shader` (`emit::container::tests emit::tests emit::lower::tests`, `--features host`): **54/54 passed** on RTX 5090 and **54/54 passed** on WARP (`--nocapture` confirmed both adapters executed the linked draw and validated with `dxil.dll` without skipping). - `victory-gpu` (`pipeline::`, `VICTORY_D3D12_DEBUG=1`): **23/23 passed** on RTX 5090; **26/26 passed** on WARP (`--features diagnostics`). - Additional negative-control and channel-gap probe: confirmed `dxil.dll` rejects the unlinked 34,816 B mesh with `vertex plus primitive output size is greater than 32768`, and accepts a linked mesh retaining a non-contiguous read (`TEXCOORD1.x/.w` kept as `cols=4` plus `TEXCOORD15.y` trimmed to `col=1, cols=1`, `4,608` B). LGTM.
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/2398/head:github-bot/gh-2398'
git switch 'github-bot/gh-2398'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2398'
git switch 'github-bot/gh-2398'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2398'
git switch 'github-bot/gh-2398'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2398'
git switch 'main'
git merge --squash 'github-bot/gh-2398'
git switch 'main'
git merge --ff-only 'github-bot/gh-2398'
git switch 'main'
git merge 'github-bot/gh-2398'
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!2398
No description provided.