gpu(native), metal: VICTORY_MESH_OVER_LIMIT lets an over-32-KiB mesh program through all three size checks (#528) #536
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/536"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-28T01:15:28Z.
Refs #528
Base:
lit-world/base-3, notmain. The mesh path and both size checks exist only on that branch (from #437).What this changes
VICTORY_MESH_OVER_LIMIT=1now lets a mesh program with more than 32 KiB of declared outputs through all three size checks:refuse_mesh, before conversion, already honoured the switch;make_render, when the pipeline is made, refused on size whatever the switch said, as #528 found;mesh_pipeline(victory-metal) had a third copy, also with no switch. A first run with only the second check fixed still refused1c451759anda9184e59there.All three now ask one rule in the shader crate,
mesh_over_limit(bytes, mesh_guard_on()). The default is unchanged: the guard stays on. That matters because the limit's own note records a 34,816-byte layout that hung the GPU queue on the Wine route, and Ketan saw a hang the same way. Turning it off is an experiment that can hang the GPU.Why
On #437's tree, which had only the first check, the switch let all four oversized programs through on an M5 Max with macOS 26.5. Their declared outputs were 33,792, 36,864 and 38,400 bytes, the same sizes #528 reports. They compiled through the converter and Metal with no error, and a 300 s world run had 0 failed command buffers. The player's hair came back (the dark spikes were the skipped hair and head meshes). Details on #437 and #528.
How it was tested
cargo test -p victory-gpu --lib(native arm64): 506 passed;victory-shadermesh tests 18 passed;victory-metal --lib61 passed. New tests:mesh_tests::the_mesh_size_guard_refuses_over_32_kib_only_while_it_is_on,emit::mesh::tests::the_mesh_output_guard_refuses_over_32_kib_only_while_on.cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings: passes.cargo xtask policy: ok.Not in this PR
Whether the guard should be dropped, or turned into a pipeline-creation check that refuses only when Metal actually fails, waits for Ketan's synthetic tests on the M4 Pro (#437).
Checklist
VICTORY_*variable and documentedImported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-28T01:35:11Z.
Closing: with all three checks bypassed, Metal itself refuses these pipelines ("Total mesh size (36864) exceeds the maximum mesh size allowed (32768)"), so the switch can't draw the walls. The fix is trimming outputs (Ketan, #437). Details and my correction on #528.
Pull request closed