gpu(native): trim unused mesh outputs to paired pixel shader reads #572

Open
github-bot wants to merge 1 commit from github-bot/gh-568 into main AGit
Owner

@⁠tarcisioads on GitHub · 2026-11-28 05:28 UTC · original
tarcisioads:vibe/mesh-output-limit-528 → main · +170 −10 · 7 files · 1 commits · open

Refs #532

Summary

  • Add Options::trim_outputs: Option<(u32, u64)> in victory-shader so mesh shaders paired with a pixel shader drop TEXCOORD (< 32) and HALF (< 64) outputs from OSG1 that the pixel shader's ISG1 does not read.
  • Add trim_mesh_if_needed in victory-gpu/src/native/glue.rs for both described (pipe) and guessed (guess) mesh+pixel pipelines when OSG1 exceeds 12 elements and has unread generic outputs.
  • Add oversized_mesh_outputs_fit_when_trimmed_to_pixel_reads in victory-gpu/src/native/mesh_tests.rs, confirming Metal rejects 17 rows (34,816 bytes at 128 vertices) with Total mesh size exceeds the maximum mesh size allowed (32768) and accepts + renders the pipeline once trimmed to the pixel shader's reads.

How it was tested

  • tools/macos/test-native.sh -j6 -p victory-shader -p victory-gpu -p victory -p xtask (420 victory-shader, 5 sweep, 449 victory-gpu, 16 victory, 6 xtask passed, 0 failed)
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings (passed, 0 warnings)
  • cargo xtask policy (404 files ok)

Checklist

  • Nothing from the game is in the diff (cargo xtask policy passes)
  • Unit test added that fails without the fix
  • Windows clippy gate (x86_64-pc-windows-gnullvm)
**@⁠tarcisioads** on GitHub · 2026-11-28 05:28 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/568) `tarcisioads:vibe/mesh-output-limit-528` → `main` · +170 −10 · 7 files · 1 commits · open Refs #532 ### Summary - Add `Options::trim_outputs: Option<(u32, u64)>` in `victory-shader` so mesh shaders paired with a pixel shader drop `TEXCOORD` (`< 32`) and `HALF` (`< 64`) outputs from `OSG1` that the pixel shader's `ISG1` does not read. - Add `trim_mesh_if_needed` in `victory-gpu/src/native/glue.rs` for both described (`pipe`) and guessed (`guess`) mesh+pixel pipelines when `OSG1` exceeds 12 elements and has unread generic outputs. - Add `oversized_mesh_outputs_fit_when_trimmed_to_pixel_reads` in `victory-gpu/src/native/mesh_tests.rs`, confirming Metal rejects 17 rows (34,816 bytes at 128 vertices) with `Total mesh size exceeds the maximum mesh size allowed (32768)` and accepts + renders the pipeline once trimmed to the pixel shader's reads. ### How it was tested - `tools/macos/test-native.sh -j6 -p victory-shader -p victory-gpu -p victory -p xtask` (420 `victory-shader`, 5 `sweep`, 449 `victory-gpu`, 16 `victory`, 6 `xtask` passed, 0 failed) - `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` (passed, 0 warnings) - `cargo xtask policy` (404 files ok) ### Checklist - [x] Nothing from the game is in the diff (`cargo xtask policy` passes) - [x] Unit test added that fails without the fix - [x] Windows clippy gate (`x86_64-pc-windows-gnullvm`)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 05:31:50 +00:00
Author
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 17:49 UTC · original · approved these changes

Read the diff: Options::trim_outputs in victory-shader plus trim_mesh_if_needed in glue.rs drop mesh OSG1 outputs (TEXCOORD <32 / HALF <64) the paired pixel shader's ISG1 never reads, for both described and guessed mesh+pixel pipelines, with the option in the cache key (shader_cache.rs). Verified on the head b3b75cd4: darwin victory-gpu mesh tests 28/28 (incl. the new mesh_tests), host victory-shader 420/420, workspace windows clippy -D warnings clean. Approving.

**@⁠AnastasisKon** on GitHub · 2026-11-28 17:49 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/568#pullrequestreview-6099416926) · **approved these changes** Read the diff: `Options::trim_outputs` in victory-shader plus `trim_mesh_if_needed` in glue.rs drop mesh `OSG1` outputs (TEXCOORD <32 / HALF <64) the paired pixel shader's `ISG1` never reads, for both described and guessed mesh+pixel pipelines, with the option in the cache key (shader_cache.rs). Verified on the head b3b75cd4: darwin `victory-gpu` mesh tests 28/28 (incl. the new mesh_tests), host `victory-shader` 420/420, workspace windows clippy `-D warnings` clean. Approving.
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/572/head:github-bot/gh-568'
git switch 'github-bot/gh-568'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-568'
git switch 'github-bot/gh-568'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-568'
git switch 'github-bot/gh-568'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-568'
git switch 'main'
git merge --squash 'github-bot/gh-568'
git switch 'main'
git merge --ff-only 'github-bot/gh-568'
git switch 'main'
git merge 'github-bot/gh-568'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.