shader/gpu: link mesh+pixel shaders to prune outputs under DXIL 32 KiB limit #278

Closed
github-bot wants to merge 0 commits from github-bot/gh-278 into main AGit
Owner

@⁠Texbirds on GitHub · 2026-12-01 08:37 UTC · original
Texbirds:pr/mesh-link-32k → main · +346 −46 · 4 files · 68 commits · closed without merging

Supersedes #239 (rebased onto rewritten main 297f58a, port of Marvisak/VIctory#2398 adapted for FoxHound).

Summary

  • When a mesh shader's standalone output footprint still exceeds D3D12's 32 KiB limit (MESH_OUTPUT_LIMIT) even after tightening max_vertices/max_primitives to the thread-group count, HostPipeline re-translates the mesh shader paired with its pixel shader (or depth-only when no pixel shader is bound) via emit::translate_linked, cached by (mesh_hash, pixel_hash).
  • Prunes arbitrary (kind == 0) vertex/primitive outputs and unread leading/trailing channels that the pixel shader never reads while keeping both stages' signatures linked for D3D12.
  • Refuses the pipeline cleanly if retained outputs still exceed 32 KiB instead of emitting over-budget DXIL.
  • Preserves FoxHound's existing FIRST_HALF retry, EARLY_DEPTH_COUNTS, loops_wave, TablePlan, and Shader::ambient without touching standalone translation for shaders that already fit under 32 KiB.
  • No title shader names in code or comments.

Testing

  • cargo run --locked -p xtask -- policy (293 files ok)
  • cargo clippy --locked -p victory-shader -p victory-gpu --tests -- -D warnings (0 warnings)
  • cargo test --locked -p victory-shader -- mesh_link_tests mesh_output_bytes_matches_dxil_budget: 3/3 passed (hardware RTX 3080 Ti + D3D12 WARP mesh PSO creation and exact pixel readback)
  • cargo test --locked -p victory-gpu -- pipeline::: 27/27 passed on RTX 3080 Ti

Checklist from #239

  • Rebased cleanly onto current main (297f58a)
  • Translator census + pipeline replay before/after (happy to leave on hold for the next translator batch; don't have a local title shader corpus here to run the full census/replay)
  • In-game check of a draw using a linked mesh+pixel pair
**@⁠Texbirds** on GitHub · 2026-12-01 08:37 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278) `Texbirds:pr/mesh-link-32k` → `main` · +346 −46 · 4 files · 68 commits · closed without merging Supersedes #239 (rebased onto rewritten `main` `297f58a`, port of `Marvisak/VIctory#2398` adapted for FoxHound). ### Summary - When a mesh shader's standalone output footprint still exceeds D3D12's 32 KiB limit (`MESH_OUTPUT_LIMIT`) even after tightening `max_vertices`/`max_primitives` to the thread-group count, `HostPipeline` re-translates the mesh shader paired with its pixel shader (or depth-only when no pixel shader is bound) via `emit::translate_linked`, cached by `(mesh_hash, pixel_hash)`. - Prunes arbitrary (`kind == 0`) vertex/primitive outputs and unread leading/trailing channels that the pixel shader never reads while keeping both stages' signatures linked for D3D12. - Refuses the pipeline cleanly if retained outputs still exceed 32 KiB instead of emitting over-budget DXIL. - Preserves FoxHound's existing `FIRST_HALF` retry, `EARLY_DEPTH_COUNTS`, `loops_wave`, `TablePlan`, and `Shader::ambient` without touching standalone translation for shaders that already fit under 32 KiB. - No title shader names in code or comments. ### Testing - `cargo run --locked -p xtask -- policy` (`293 files ok`) - `cargo clippy --locked -p victory-shader -p victory-gpu --tests -- -D warnings` (0 warnings) - `cargo test --locked -p victory-shader -- mesh_link_tests mesh_output_bytes_matches_dxil_budget`: **3/3 passed** (hardware RTX 3080 Ti + D3D12 WARP mesh PSO creation and exact pixel readback) - `cargo test --locked -p victory-gpu -- pipeline::`: **27/27 passed** on RTX 3080 Ti ### Checklist from #239 - [x] Rebased cleanly onto current `main` (`297f58a`) - [ ] Translator census + pipeline replay before/after (happy to leave on hold for the next translator batch; don't have a local title shader corpus here to run the full census/replay) - [ ] In-game check of a draw using a linked mesh+pixel pair
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 08:42:21 +00:00
Author
Owner

@⁠Aniseto on GitHub · 2026-12-01 08:58 UTC · original

Ran the mesh_link_tests / mesh_output_bytes_matches_dxil_budget selections and the pipeline:: group at 4efa188 on an NVIDIA Blackwell desktop part with 16 GB of VRAM.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own CARGO_TARGET_DIR, no local patches.

cargo test -q --locked -p victory-shader -- mesh_link_tests mesh_output_bytes_matches_dxil_budget -- --test-threads=1
3 passed; 0 failed; 0 ignored; 295 filtered out      (exit 0)

cargo test -q --locked -p victory-gpu --lib -- pipeline:: --test-threads=1
27 passed; 0 failed; 0 ignored; 484 filtered out      (exit 0)

Both counts match the description's groups, including linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw and mesh_exceeding_32k_tightens_counts_to_group_threads. This adapter reports mesh-shader support and a 32-lane wave; the description's hardware checks were on an RTX 3080 Ti and WARP, so these are a second host for the synthetic cases, not a title draw.

Not tested: clippy, the full workspace suite, a retail title, a mesh draw that actually exceeds 32 KiB in a scene, depth-only linked pipelines, AMD adapters, Wine, release profile, game data.

AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-12-01 08:58 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278#issuecomment-7306045193) Ran the `mesh_link_tests` / `mesh_output_bytes_matches_dxil_budget` selections and the `pipeline::` group at `4efa188` on an NVIDIA Blackwell desktop part with 16 GB of VRAM. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own `CARGO_TARGET_DIR`, no local patches. ``` cargo test -q --locked -p victory-shader -- mesh_link_tests mesh_output_bytes_matches_dxil_budget -- --test-threads=1 3 passed; 0 failed; 0 ignored; 295 filtered out (exit 0) cargo test -q --locked -p victory-gpu --lib -- pipeline:: --test-threads=1 27 passed; 0 failed; 0 ignored; 484 filtered out (exit 0) ``` Both counts match the description's groups, including `linked_mesh_and_pixel_prune_unused_outputs_under_32k_and_draw` and `mesh_exceeding_32k_tightens_counts_to_group_threads`. This adapter reports mesh-shader support and a 32-lane wave; the description's hardware checks were on an RTX 3080 Ti and WARP, so these are a second host for the synthetic cases, not a title draw. Not tested: clippy, the full workspace suite, a retail title, a mesh draw that actually exceeds 32 KiB in a scene, depth-only linked pipelines, AMD adapters, Wine, release profile, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Author
Owner

@⁠bannnned on GitHub · 2026-12-01 10:25 UTC · original · reviewed

I found two cases where a mesh/pixel pair can still lose its draw. The first is reproduced on a hardware D3D12 device. The second is specific to the existing strict-output switch.

**@⁠bannnned** on GitHub · 2026-12-01 10:25 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278#pullrequestreview-6129358336) · **reviewed** I found two cases where a mesh/pixel pair can still lose its draw. The first is reproduced on a hardware D3D12 device. The second is specific to the existing strict-output switch.
@ -571,0 +661,4 @@
.ok_or(ShaderError::Malformed("truncated"))?;
if rw != 0 {
let key = (String::from_utf8_lossy(name).to_ascii_uppercase(), index);
*reads.entry(key).or_insert(0) |= rw;
Author
Owner

@⁠bannnned on GitHub · 2026-12-01 10:25 UTC · original

[P2] Track reads relative to the semantic's first component

The read mask here uses packed PS register columns. D3D12 links mesh and pixel stages by semantic name and index, so the same float2 TEXCOORD15 can be packed in PS xy and MS zw. Passing 0b0011 unchanged into prune_signature drops the mesh output in that case, even though the PS reads both components.

I adapted the synthetic draw to use exactly that packing on an RTX 5070 Ti. The driver refused PSO creation with the current mask. Translating the mask to the MS columns in the same fixture produced the expected pixel values. Could we store the reads relative to the semantic's own first column, then apply them in each stage's packing? The mixed-column pair would make a regression test.

**@⁠bannnned** on GitHub · 2026-12-01 10:25 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278#discussion_r4752614207) **[P2] Track reads relative to the semantic's first component** The read mask here uses packed PS register columns. D3D12 links mesh and pixel stages by semantic name and index, so the same `float2 TEXCOORD15` can be packed in PS `xy` and MS `zw`. Passing `0b0011` unchanged into `prune_signature` drops the mesh output in that case, even though the PS reads both components. I adapted the synthetic draw to use exactly that packing on an RTX 5070 Ti. The driver refused PSO creation with the current mask. Translating the mask to the MS columns in the same fixture produced the expected pixel values. Could we store the reads relative to the semantic's own first column, then apply them in each stage's packing? The mixed-column pair would make a regression test.
@ -455,0 +455,4 @@
// Mesh shaders whose standalone output footprint exceeds D3D12's 32 KiB
// limit are re-translated together with their paired pixel shader,
// pruning outputs the pixel shader never reads.
let linked = if let Some(ms) = mesh
Author
Owner

@⁠bannnned on GitHub · 2026-12-01 10:25 UTC · original

[P3] Try linking after the standalone mesh output-limit refusal

With VICTORY_MESH_OUTPUT_STRICT=1, the standalone 34,816-byte fixture fails in mesh_prologue before HostPipeline::new reaches this branch. That same fixture fits under 32 KiB after linking.

Could we route the standalone output-budget failure through linking and enforce the strict budget on the linked result? pipeline::translate_linked also calls ms.translated() for metadata, so that part would need to read the metadata independently of a successful standalone translation.

**@⁠bannnned** on GitHub · 2026-12-01 10:25 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278#discussion_r4752614223) **[P3] Try linking after the standalone mesh output-limit refusal** With `VICTORY_MESH_OUTPUT_STRICT=1`, the standalone 34,816-byte fixture fails in `mesh_prologue` before `HostPipeline::new` reaches this branch. That same fixture fits under 32 KiB after linking. Could we route the standalone output-budget failure through linking and enforce the strict budget on the linked result? `pipeline::translate_linked` also calls `ms.translated()` for metadata, so that part would need to read the metadata independently of a successful standalone translation.
Author
Owner

@⁠readmet3xt-lab on GitHub · 2026-12-01 11:38 UTC · original

Checked: nothing harmful in it, it merges and passes the lint check. Because it changes a run at default settings (or code on the submission path), it is not merged to main directly: it is on the batch being tested for the next release, as one commit with you as its author. Nothing is needed from you now; the result of the run will be posted here.

**@⁠readmet3xt-lab** on GitHub · 2026-12-01 11:38 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278#issuecomment-7309923354) Checked: nothing harmful in it, it merges and passes the lint check. Because it changes a run at default settings (or code on the submission path), it is not merged to main directly: it is on the batch being tested for the next release, as one commit with you as its author. Nothing is needed from you now; the result of the run will be posted here.
Author
Owner

@⁠Texbirds on GitHub · 2026-12-01 12:00 UTC · original

Thanks @⁠readmet3xt-lab, @⁠Aniseto, and @⁠bannnned!

Pushed b7f6eef addressing both of @⁠bannnned's findings:

  1. Mixed-column packing (P2): pixel_input_reads now records reads relative to each semantic's first declared component ((rw & mask) >> mask.trailing_zeros()), and prune_signature applies them in each stage's own packing. Added linked_mesh_and_pixel_preserve_mixed_column_packing (MS TEXCOORD15 in zw, PS in xy) — passes on RTX 3080 Ti and WARP.
  2. VICTORY_MESH_OUTPUT_STRICT=1 (P3): HostPipeline::new now routes standalone mesh translation refusal into translate_linked, and translate_linked reads shader metadata via shader_meta directly from the container instead of requiring ms.translated() to have succeeded.
**@⁠Texbirds** on GitHub · 2026-12-01 12:00 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278#issuecomment-7310509154) Thanks @⁠readmet3xt-lab, @⁠Aniseto, and @⁠bannnned! Pushed `b7f6eef` addressing both of @⁠bannnned's findings: 1. **Mixed-column packing (P2):** `pixel_input_reads` now records reads relative to each semantic's first declared component (`(rw & mask) >> mask.trailing_zeros()`), and `prune_signature` applies them in each stage's own packing. Added `linked_mesh_and_pixel_preserve_mixed_column_packing` (MS `TEXCOORD15` in `zw`, PS in `xy`) — passes on RTX 3080 Ti and WARP. 2. **`VICTORY_MESH_OUTPUT_STRICT=1` (P3):** `HostPipeline::new` now routes standalone mesh translation refusal into `translate_linked`, and `translate_linked` reads shader metadata via `shader_meta` directly from the container instead of requiring `ms.translated()` to have succeeded.
Author
Owner

@⁠Aniseto on GitHub · 2026-12-01 12:15 UTC · original

This is a new response on the same thread as my report at 4efa188 (#278); the head moved to b7f6eef (semantic-relative PS reads and strict-MS link retry), so I am not editing that comment.

Ran the mesh_link_tests module and the pipeline:: group at b7f6eef on an NVIDIA Blackwell desktop part with 16 GB of VRAM.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own CARGO_TARGET_DIR, no local patches.

cargo test -q --locked -p victory-shader --lib mesh_link_tests -- --test-threads=1
3 passed; 0 failed; 0 ignored; 296 filtered out      (exit 0)

cargo test -q --locked -p victory-gpu --lib -- pipeline:: --test-threads=1
27 passed; 0 failed; 0 ignored; 484 filtered out      (exit 0)

Both groups still pass at the new head; the mesh module now includes the mixed-column packing case named in the new commit. The description's RTX 3080 Ti and WARP readback checks were not repeated here, and no title was run.

Not tested: the full workspace suite, a retail title, WARP as a separate device, AMD adapters, Wine, release profile, game data.

AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-12-01 12:15 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278#issuecomment-7310884816) This is a new response on the same thread as my report at `4efa188` (https://git.gtahub.st/github/readmet3xt-lab--foxhound/pulls/278); the head moved to `b7f6eef` (semantic-relative PS reads and strict-MS link retry), so I am not editing that comment. Ran the `mesh_link_tests` module and the `pipeline::` group at `b7f6eef` on an NVIDIA Blackwell desktop part with 16 GB of VRAM. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own `CARGO_TARGET_DIR`, no local patches. ``` cargo test -q --locked -p victory-shader --lib mesh_link_tests -- --test-threads=1 3 passed; 0 failed; 0 ignored; 296 filtered out (exit 0) cargo test -q --locked -p victory-gpu --lib -- pipeline:: --test-threads=1 27 passed; 0 failed; 0 ignored; 484 filtered out (exit 0) ``` Both groups still pass at the new head; the mesh module now includes the mixed-column packing case named in the new commit. The description's RTX 3080 Ti and WARP readback checks were not repeated here, and no title was run. Not tested: the full workspace suite, a retail title, WARP as a separate device, AMD adapters, Wine, release profile, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
github-bot force-pushed github-bot/gh-278 from b7f6eef0fd to 6600f08be1 2026-12-01 19:11:12 +00:00 Compare
Author
Owner

@⁠readmet3xt-lab on GitHub · 2026-12-01 21:09 UTC · original

Thank you for the update. The new commits are being retested together with the version already in the build.

**@⁠readmet3xt-lab** on GitHub · 2026-12-01 21:09 UTC · [original](https://github.com/readmet3xt-lab/foxhound/pull/278#issuecomment-7325829303) Thank you for the update. The new commits are being retested together with the version already in the build.
github-bot closed this pull request 2026-12-02 07:54:53 +00:00

Pull request closed

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