Skip to content

fix(gpu): refuse mesh pipelines over Metal's 32 KiB under Wine, by the aligned layout too (#172) - #282

Merged
pragyaangaur merged 4 commits into
pragyaangaur:mainfrom
derz92:fix/mesh-over-limit
Nov 26, 2026
Merged

pragyaangaur merged 4 commits into
pragyaangaur:mainfrom
derz92:fix/mesh-over-limit

Conversation

@derz92

@derz92 derz92 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Fixes the world-entry hang of #172 on current main with D3DMetal 4.0 beta 3.

What happens. Right after the "Vice City, two years ago" card a submission holding the title's indirect mesh draws never completes, and the run waits on the host GPU for good. Linking mesh and pixel outputs (#161) is off unless VICTORY_LINK_MESH_OUTPUTS is set, and nothing refuses a mesh pipeline that is still over Metal's 32 KiB, so the oversized pipelines are made. With a log line naming the hung submission's pipelines, two independent hangs shared the same mesh pipelines, among them mesh b68376181e9c8b2f.

Why it was not caught. Two counts of a mesh shader's outputs disagree. MeshOutputs::bytes counts 4 bytes per declared component. The layout Metal allocates (the older metal_mesh_bytes, which #172's report used) puts clip and cull distances first, then the position, then each other output aligned to its own size, and the same for primitives, times the declared maxima. For 1.0.2.1 the packed count puts every world mesh shader at or under 32,768 bytes, while the aligned layout puts about 20 of them at 34,816 to 38,400 bytes. b68376181e9c8b2f is 34,816.

Change (only under Wine; Windows is unchanged):

  • Linking is on by default. VICTORY_LINK_MESH_OUTPUTS=0 turns it off.
  • A mesh pipeline whose outputs are still over 32 KiB after linking, by the larger of the two counts, is refused. Its draws are dropped and the queue keeps running. VICTORY_MESH_OVER_LIMIT=1 makes it anyway.
  • docs/macos.md has a section on this, and a row in the switch table.

Tested on an M5 Max, macOS 26, D3DMetal 4.0 beta 3, Series X profile, with fault tracking on (and #262):

  • Before: four runs hung at that point.
  • After: three runs went past the card into the world, with 18 to 25 pipelines refused per run and no GPU hang. One stayed in the opening scene for over 25 minutes.

🤖 Generated with Claude Code

…e aligned layout too (pragyaangaur#172)

Under D3DMetal an over-limit mesh pipeline is made, draws nothing and its
submission never completes: the world-entry hang after the "Vice City, two
years ago" card. Linking mesh outputs (pragyaangaur#161) is now on by default under
Wine, and a pipeline still over 32 KiB after it is refused. The size is the
larger of MeshOutputs::bytes and the aligned layout Metal allocates, which
puts ~20 world mesh shaders of 1.0.2.1 at 34,816-38,400 bytes where the
packed count puts them under the limit.
@pragyaangaur
pragyaangaur merged commit 9da4b9e into pragyaangaur:main Nov 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants