Repository navigation
Translator: copy mesh clip/cull distances one float at a time (SHADER-155) - #1329
Conversation
|
I checked the Vulkan output on RTX 5080 and integrated Radeon at
For each draw I compared all 4,096 pixels, including the clear color outside coverage and the interpolated RGBA gradient inside. All seven modules passed |
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51, llvm-mc 23.1.6): pass. |
|
Tested
No game files. AI-assisted (Claude Code). |
|
Heads-up on the red and nothing else failed. That is the test that made Everything else on this PR passes, including both |
…-155)
SPIRV-Cross 1.4.363.0 turns the whole-array OpStore of ClipDistance into the
mesh per-vertex output into a C array assignment, which Metal rejects
("array type 'threadgroup float[1]' is not assignable"). Copying each element
gives the same result on Vulkan and compiles on Metal: ms_clip draws its
expected 2048/4096 pixels in a native Metal mesh draw on an Apple A18 Pro.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
471d1d4 to
b46bdc4
Compare
|
Tested b46bdc4 on Windows 11 build 26200, RTX 4070 SUPER (616.92): pass. The CMake/Ninja MSVC build of the GPU harness ran the mesh fixtures with llvm-mc 23.1.5.
This verifies the Vulkan path on NVIDIA. Synthetic fixtures only. AI-assisted testing. |
|
Tested b46bdc4 on RTX 4090 (driver 621.14, 32-wide subgroups), Windows 11 26200: pass
No game files used. AI-assisted run (Claude Code). |
What and why
@fruvs found that
ms_clipdoesn't compile for native Metal: SPIRV-Cross 1.4.363.0 turns the translator's whole-arrayOpStoreofClipDistanceinto the mesh per-vertex output into a C array assignment, and Metal rejects it (array type 'threadgroup float[1]' is not assignable). The SPIR-V is valid (spirv-val passes), so it's a SPIRV-Cross limitation. The translator can avoid it, though:tools/rdna2spirv.py: the clip and cull distances are copied to the per-vertex block one float at a time (OpAccessChain ... %ms_out_vtx %mli <member> <i>), not as one array. Vulkan gets the same result. The unused whole-array Output pointer types are gone.tests/test_translate.py:test_ms_clip_distance_pos1checks the per-element copies and that no whole array is loaded.docs/design.md: one sentence in the "Mesh shaders" row.Tested
Apple A18 Pro (MacBook Neo), macOS 26.6.2, MoltenVK 1.4.2, SPIRV-Cross 1.4.363.0, Homebrew llvm-mc 23.1.6.
--msl --msl-version 30100 --msl-argument-buffers --msl-argument-buffer-tier 1 --msl-device-argument-buffer 0) plus the system Metal compiler (MSL 3.1): onmain,ms_clipfails as reported. With this PR, all 5ms_*fixtures compile.ms_clipcovers the right half exactly (2048/2048) and none of the left half (0/2048). As a control,ms_tricovers 4096/4096.run_gpu_tests.py: 77/126 passed, 48 skipped, the same asmain. WithLEONIDA_W64_EMULATE=1: 104/126 passed, 21 skipped, also the same. The one failure,ps_interp_f16_high, fails onmaintoo (MoltenVK:PerVertexKHR decoration is not supported in MSL).pytest tests/test_translate.py: 365 passed, 2 skipped.unittest discover -s tests/semantic: OK.Checklist
docs/design.md, with how it was confirmed.AI-assisted (Claude Code): it reproduced the issue, wrote the change and the tests, and ran everything above on the A18 Pro.
🤖 Generated with Claude Code