xshader: count components, not elements, in a mesh's output budget #612

Merged
NickStallman merged 2 commits from upstream-pr/612 into main 2026-12-01 20:31:52 +00:00
NickStallman commented 2026-12-01 08:02:31 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T08:02:31Z.


A translated mesh program declares as many vertices as its outputs fit in the 32 KiB a mesh shader may write, and drops a group with more. The budget charged 16 bytes for each signature element, but DXC charges four bytes for each component, for vertices and primitives rounded up to a multiple of 32. A program with many narrow outputs was capped below what DXC accepts, so a meshlet with more vertices was dropped whole, silently: holes in the surface, the same in every target.

Refs #533.

What it fixes

In a title we traced, characters' surfaces had polygonal holes, identical in albedo, normals and material targets, at the same places in every run and camera; the position-only pass of the same mesh, which has no such cap (128), was complete in depth. Its G-buffer programs declare 96, 101 or 119 vertices. In one run of an integration build with this change (and other open PRs), the main character's face, which had these holes, was complete; I don't claim it for this change alone.

Measured

  • Recorded mesh programs (6,680 distinct, one request each; linked requests not surveyed separately): 1,101 were capped below 128 vertices, 50 still are (they write 65 to 68 components, which don't fit for 128); 1,051 are now complete. The text of all 1,101 changes: 1,065 in the budget lines, and 36 that stay capped at 96 gain only the comment naming the dropped outputs. All 1,065 with changed budgets compile with DXC 1.9.2609 and pass dxv (with -O3, HV 2021 and 16-bit types, not the launcher's exact command line).
  • The rule matches DXC's largest accepted vertex count in 60 of 60 random signatures.
  • New GPU case wide-128 in the translated-mesh check (128 vertices, position and eighteen float3): on an RTX 5090 the old translator draws 0 of 64 words and the check fails; with this it passes (2,560 words). On the AMD iGPU (1002:13c0, RADV) it passes; the old translator wasn't run there.
  • New GPU case widest-128 (position and twenty float3 = 64 components, exactly 32,768 bytes with no primitive outputs), at the limit itself: it passes on both cards (translated-mesh: 42 mesh draws, 2,688 words).
  • Unit tests (the new one fails with the old charge); 5 mutations, 4 caught. The fifth (the cull flag not counted) can't change a result, by reasoning: the cull rule only allows small signatures.
  • Full python tuxbox.py check of cc3604fb (GE-Proton11-15): RTX 5090 (10de:2b85, 620.70.10) 208 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 207 pass, 0 fail.

Evidence: TuxBox check of cc3604fb7a, no uncommitted changes, GPU 10de:2b85: 17 passed, 0 failed, 0 not run
Evidence: TuxBox check of cc3604fb7a, no uncommitted changes, GPU 1002:13c0: 17 passed, 0 failed, 0 not run

Not covered

  • 23 of the 128-vertex outputs are near 32 KiB in packed rows; only the two GPUs above were tested, so a driver that accounts differently is a risk for signatures over 16 rows.
  • The 50 programs that stay capped still drop large meshlets; their translation says so in a comment. The launcher doesn't count them.

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5581552844 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/612). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-12-01T08:02:31Z. --- A translated mesh program declares as many vertices as its outputs fit in the 32 KiB a mesh shader may write, and drops a group with more. The budget charged 16 bytes for each signature element, but DXC charges four bytes for each component, for vertices and primitives rounded up to a multiple of 32. A program with many narrow outputs was capped below what DXC accepts, so a meshlet with more vertices was dropped whole, silently: holes in the surface, the same in every target. Refs #533. ## What it fixes In a title we traced, characters' surfaces had polygonal holes, identical in albedo, normals and material targets, at the same places in every run and camera; the position-only pass of the same mesh, which has no such cap (128), was complete in depth. Its G-buffer programs declare 96, 101 or 119 vertices. In one run of an integration build with this change (and other open PRs), the main character's face, which had these holes, was complete; I don't claim it for this change alone. ## Measured - **Recorded mesh programs** (6,680 distinct, one request each; linked requests not surveyed separately): 1,101 were capped below 128 vertices, 50 still are (they write 65 to 68 components, which don't fit for 128); 1,051 are now complete. The text of all 1,101 changes: 1,065 in the budget lines, and 36 that stay capped at 96 gain only the comment naming the dropped outputs. All 1,065 with changed budgets compile with DXC 1.9.2609 and pass dxv (with -O3, HV 2021 and 16-bit types, not the launcher's exact command line). - **The rule** matches DXC's largest accepted vertex count in 60 of 60 random signatures. - **New GPU case `wide-128`** in the translated-mesh check (128 vertices, position and eighteen float3): on an RTX 5090 the old translator draws 0 of 64 words and the check fails; with this it passes (2,560 words). On the AMD iGPU (`1002:13c0`, RADV) it passes; the old translator wasn't run there. - **New GPU case `widest-128`** (position and twenty float3 = 64 components, exactly 32,768 bytes with no primitive outputs), at the limit itself: it passes on both cards (translated-mesh: 42 mesh draws, 2,688 words). - Unit tests (the new one fails with the old charge); 5 mutations, 4 caught. The fifth (the cull flag not counted) can't change a result, by reasoning: the cull rule only allows small signatures. - Full `python tuxbox.py check` of cc3604fb (GE-Proton11-15): RTX 5090 (`10de:2b85`, 620.70.10) 208 pass, 0 fail; AMD iGPU (`1002:13c0`, RADV) 207 pass, 0 fail. Evidence: TuxBox check of cc3604fb7aee, no uncommitted changes, GPU 10de:2b85: 17 passed, 0 failed, 0 not run Evidence: TuxBox check of cc3604fb7aee, no uncommitted changes, GPU 1002:13c0: 17 passed, 0 failed, 0 not run ## Not covered - 23 of the 128-vertex outputs are near 32 KiB in packed rows; only the two GPUs above were tested, so a driver that accounts differently is a risk for signatures over 16 rows. - The 50 programs that stay capped still drop large meshlets; their translation says so in a comment. The launcher doesn't count them. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!612
No description provided.