shader: translate gfx1013 mesh programs with run-time geometry for the startup runtime #1760
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#1760
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?
@denn0x on GitHub · 2026-11-24 18:10 UTC · original
Question
tools/mesh_entry_aot.pyspecializes a bounded gfx1013 mesh entry for desktop D3D12:MSG_GS_ALLOC_REQ,prim,pos0andparam0;The startup runtime needs something different: a mesh program whose vertex and primitive counts, geometry reads and control flow depend on GPU data at run time. It has to be translated ahead of time to an HLSL or DXIL mesh shader, keyed like the pixel and vertex translations in
tools/startup/gfx2hlsl.py.Which gfx1013 mesh ABI has to be modelled for that? Specifically:
GS_ALLOC_REQvertex and primitive counts taken fromm0, as a run-time value;Evidence so far
main, the mesh path is verified only through static specialization: #491, #498, #606, #682, #1203 and #730.tools/startup/gfx2hlsl.pyhas vertex and pixel stages only.s_sendmsgand export encodings). The project has not checked how far gfx1013 matches them.Completion condition
Run-time counts. A source-built gfx1013 mesh program, assembled with the LLVM 15 chain like the existing mesh fixtures:
GS_ALLOC_REQwith those counts inm0;The translator produces a mesh shader that draws it via
DispatchMesh. Compare pixel by pixel with an independent CPU reference on WARP and one hardware adapter.Controls: a count of zero (nothing drawn); counts above the declared maximum (refused at translation, or clamped as documented); a swapped primitive index.
Run-time control flow. The same program with a data-dependent branch and loop around the exports, with a control that flips the branch input.
Wave width. The same program as wave64, on an adapter that runs 64-lane waves, or with a documented refusal otherwise.
Refusals. Reported by instruction and form, as for the pixel stage, so a census over a local shader set can be posted as counts only.
Out of scope: amplification/task stages, and executing mesh draws from ExecuteIndirect (separate issue).
Required environment
Checklist
@avt0m4t48 on GitHub · 2026-11-24 20:17 UTC · original
I have a source-built fixture for the runtime allocation-and-export slice. One gfx1013 mesh program reads its allocation and primitive data from buffer words, and the test verifies six inputs through the existing CPU model. I will submit the reusable fixture and its verification independently of runtime lowering.
@R0Y00 on GitHub · 2026-11-24 21:22 UTC · original
The bounded runtime-geometry fixture in #1913 is on main at
e4697f3a. I reran Release on the exact head: mesh_dynamic_aot_cpu plus both D3D12 draw backends passed, with zero skips. The translator enumerates bounded equality partitions for the two-wave64 triangular profile. This validates the source-built model and readback. Please keep the wider native runtime shader path and its binding cases in #1779 and this issue.@R0Y00 on GitHub · 2026-11-24 21:40 UTC · original
#1779 has merged. I ran the exact candidate and then reran after integrating current main with #1913. The combined Release run passed 7/7, including both multi-primitive GPU paths and both runtime-geometry draw paths, with zero skips. These are source-built pipeline checks. They establish multi-primitive native mesh lowering and its coexistence with the bounded runtime geometry profile. Wider console dispatch and binding remain tracked here.
@akimfomin on GitHub · 2026-11-25 01:45 UTC · original
PortBridge used the bounded runtime geometry work in #1913 and #1779 to check one source of repeated code in #1760. The candidate shares identical emitted vertex and primitive exports while keeping every partition predicate and allocation count. Thanks to avt0m4t48 for the original geometry fixture.
On a source-built gfx1013 shader with 32 partitions and two distinct outputs, optimized DXIL went from 26,556 to 5,736 bytes. The CPU differential matched dispatch counts, attributes and indices over 65 inputs. On an RTX 4070 Ti SUPER with driver
32.0.16.1714, both variants matched every one of the 1,024 reference pixels for a triangle and again for a quad. A stale-pixel control produced the expected 528 mismatches. The D3D12 debug layer was unavailable. These are shader-size and correctness results on this fixture. Execution time remains unmeasured.The patch, synthetic source and logs are pinned to
4c1b27dd. They cover the bounded runtime path used in #1760. If this case is useful, the portable verifier can be run as-is during review.AI assistance: OpenAI Codex (GPT-6 family) assisted with the patch, independent fixture and verification.