Interior walls missing: wall meshes are over the 32 KiB mesh output limit #528
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 LakshanSivakumar on 2026-11-28T01:02:26Z.
What you see
Pieces of the interior walls are missing. In one shot a small bright patch high on the wall shows the sky through a hole.
What I know
The wall meshes are refused because their mesh shader output is larger than 32 KiB. In a 420 s run, 13 mesh programs were refused for this, and about 7,000 mesh draws were dropped by frame 1984. One frame's trace shows 31 wall draws dropped for mesh
1c451759;a9184e59is another wall.VICTORY_MESH_OVER_LIMIT=1does not let them through. It skips one copy of the check, butmake_renderinshaders.rshas a second copy with no switch, and that one refuses the pipeline.What would help
VICTORY_TRACE_GPU_FAILS=1, on a spare run. derz92 reported 300 s clean on an M5 Max with the first check off.An untested first commit that reorders outputs to cut padding exists and I can push it if someone wants to build on it.
How to see it
Branch
lit-world/base-3(commit9a0d811d). It is #437 with fixes on top: #518, the cross-page loads, texture fixes, the page table for described pipelines and the image null-view test. It is not main, and one upstream test fails on it by design (wave32_tests::a_branch_on_a_first_lane_read_is_not_uniform_across_the_halves).Apple Silicon Mac with 48 GB, Series S profile. The world shows about 4.5 minutes after start on a cold shader cache.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-28T01:11:15Z.
Evidence that Metal accepts these. On #437's tree (
b998bb65+ #437), where there was only the one copy of the check,VICTORY_MESH_OVER_LIMIT=1let all four oversized mesh programs through on an M5 Max, macOS 26.5. The declared outputs were 33,792, 36,864 and 38,400 bytes, the same sizes as here. They went through the converter and Metal's pipeline creation with no error, and a 300 s world run had 0 failed command buffers. Visibly, the hair came back (the dark spikes on the player's head were skipped hair/head meshes) and more of the yard drew. Details on #437.So at least on M5 with macOS 26.5, the 32,768-byte figure isn't a hard limit for these pipelines. Ketan is testing synthetic sizes on an M4 Pro.
/claim
Plan for a first, small PR: make the second check in
make_renderhonour the sameVICTORY_MESH_OVER_LIMITswitch, with a test. Then report what a run onlit-world/base-3shows with it on (walls, errors). Whether the guard should go entirely, or become a pipeline-creation check that only refuses if Metal actually fails, can follow once Ketan's M4 Pro results are in.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-28T01:11:28Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T01:11:40Z.
Claimed by @derz92. Open a draft pull request with
Refs #528in its description within 24 hours, or the claim expires.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T01:29:04Z.
@derz92 a question so we don't overlap. #536 makes
VICTORY_MESH_OVER_LIMIT=1pass both checks, which is great for testing. Are you also planning the default fix the issue asks for, a size check after trimming outputs to what the pixel shader reads, or dropping the duplicate clip-distance copy? If not, we'd like to take that part as a separate PR on top of yours, with a unit test and no over-limit pipelines run by default. If you're already on it, we'll stay off.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-28T01:35:08Z.
Correction to my comment above: I was wrong. On #437's tree,
VICTORY_MESH_OVER_LIMIT=1did not get these programs through. That tree's second check (make_render) still refused them: the run's counters showmesh_refused_over_limit=10753, and its log has "mesh outputs exceed Metal's limit; pipeline refused" for1c451759,a9184e59andb6837618. I'd searched for the first check's wording, saw none, and wrongly concluded they compiled. The visual differences I credited to it (hair, the yard) must have come from something else in that run.On
lit-world/base-3with all three checks bypassed (#536), Metal itself refuses them at pipeline creation: "Total mesh size (36864) exceeds the maximum mesh size allowed (32768)", and the same for 38400 and 33792 (M5 Max, macOS 26.5). So 32 KiB is a real Metal limit for these pipelines, and bypassing the guards can't draw the walls. Trimming outputs to what the paired pixel shader reads, as Ketan is doing on #437, is the fix.I'm closing #536 and releasing this.
/release
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-28T01:41:00Z.
@Olima34 no. Please see my correction above: with every check bypassed, Metal itself refuses these pipelines ("Total mesh size (36864) exceeds the maximum mesh size allowed (32768)"), so #536 couldn't help and I closed it. The real fix is the one you name, a size check after trimming outputs to what the pixel shader reads (Ketan is doing the trimming on #437). I'm releasing this so whoever takes that has it.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by derz92 on 2026-11-28T01:41:01Z.
/release
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T01:41:17Z.
Released. This issue is free to claim.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T01:52:40Z.
Thanks @derz92, that's a useful result: 32 KiB is Metal's own hard limit for these pipelines ("Total mesh size … exceeds the maximum mesh size allowed (32768)"), so the only way to draw the walls is to make their outputs fit. Closing #536 was the right call.
@Ketan-Kapse since the output trimming lives on #437: do you plan to send it as its own PR? If you'd rather not, we can take that part: trim each mesh program's outputs to what its paired pixel shader reads, check the size after trimming, and if still needed drop the duplicate 16-byte clip-distance copy (248 bytes a vertex would fit). It would come with unit tests and no over-limit pipeline ever created. We'll wait for your answer before claiming, so we don't duplicate your work.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by tarcisioads on 2026-11-28T05:22:38Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T05:22:47Z.
Claimed by @tarcisioads. Open a draft pull request with
Refs #528in its description within 24 hours, or the claim expires.