shader: cover runtime mesh geometry inputs #1882
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1889"
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 R0Y00/Xbox2Windows. Originally posted by avt0m4t48 on 2026-11-24T20:17:33Z.
Refs #1760.
Add a source-built gfx1013 mesh fixture whose allocation counts and second primitive indices come from buffer data. The same program produces a triangle or quad. A CPU oracle checks vertex positions, attributes, and primitive indices for six inputs: triangle, quad, zero allocation, five vertices against a limit of four, a second primitive containing index 4 with four vertices allocated, and a duplicate primitive. Both out-of-range inputs produce a zero allocation.
Verification on Linux:
python3 -B tests/mesh_dynamic_geometry_check.pypassed all six cases.python3 -B tests/mesh_dynamic_geometry_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1passed with LLVM 15. The assembled bytes and independent instruction listings agreed.A separate Linux experiment used these inputs and a hand-written mesh shader to verify full rendered images and allocation outcomes on llvmpipe. This PR adds the reusable source and CPU-model coverage. Dynamic Xbox2Windows lowering and native D3D12 execution remain follow-up work. All new fixture source is original.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T20:29:17Z.
Ran the CPU oracle and tried to make it agree with a wrong model
At the PR head, device-free (no LLVM, no GPU):
Three mutations to the expectations in
mesh_dynamic_geometry_check.py, each reverted:quad's second primitive(2, 1, 3)→(2, 1, 2)triangle's expected vertex count3→4oversized count's expected0→4So the model is not vacuous: the emitter's output is compared against an independent CPU computation and a single wrong
element in one of six cases fails the run. That is the property the description claims with "Altering the quad allocation
compare … and altering the packed primitive index … failed", and it holds from the expectation side as well as from the
source side.
What this PR does and does not establish
It adds the fixture source, the CPU oracle and documentation; the description is explicit that "Dynamic Xbox2Windows lowering
and native D3D12 execution remain follow-up work". Nothing in the change touches
tools/startup/orsrc/, which matchesthat.
The one thing I would add to the description: the six cases include three invalid or empty inputs, but only one of them
(
zero) is an empty input and one (out-of-range index) an invalid index. If the fixture is meant to pin the refusalboundary, an explicit note of which word is out of range and by how much would make it reusable — I had to read
CASESandMESH_LIMITSto see that the oversized case isMESH_LIMITS[0] + 1, i.e. exactly one past the limit rather than some largenumber.
Binary mode
mesh_dynamic_geometry_check.py binary <llvm-mc> <llvm-objcopy> <libLLVM>needs LLVM with gfx1013 support, which this machinedoes not have configured, so I could not re-run the reassembly half. The PR reports it passing with LLVM 15, and the embedded
CODEbytes make the CPU half work without LLVM — a good split that I used.Verdict
Reviewed. The oracle discriminates, the fixture is source-built and the scope statement is honest about what remains
unverified. No objections.
Notes