When a geometry shader translated with --pc-tail-ubo reads the heap base or code base, rdna2spirv.py binds %pc_tail as a Uniform block at (DescriptorSet 1, Binding 0). Lowering that module to compute with tools/spirv_gs_to_compute.py previously hardcoded %gsc_in, %gsc_rec, and %gsc_meta at (DescriptorSet 1, Bindings 0..2), leaving both %pc_tail (Uniform) and %gsc_in (StorageBuffer) at (set 1, binding 0) in violation of VUID-VkPipelineLayoutCreateInfo-descriptorType-07990.
Inspect existing DescriptorSet 1 bindings in the input module, place %gsc_in, %gsc_rec, and %gsc_meta starting after the highest used binding (recording base_binding in the layout dict when nonzero), and add synthetic and end-to-end rdna2spirv --pc-tail-ubo regression tests.
# Conflicts:
# tests/test_spirv_gs_to_compute_bounds.py
rdna2spirv.py (two .spvasm writes), saves.py (index.json, header.json) and spirv_gs_to_compute.py (layout json) opened text files for writing with no encoding, so they used the locale code page (cp1252 on most Windows installs). CONTRIBUTING.md asks for encoding="utf-8". tests/test_text_encoding.py scans tools/, scripts/, make_game.py and runtime/test/shaders/ with ast, like test_text_write_line_endings.py, and runs directly with python -I.
The tool preserves the module version on assembly. Its generated buffer declarations and entry-point interface must follow that version as well or legacy Vulkan validation rejects the output.
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.
AI-assisted (Claude), on behalf of dev-ewann.
Help now answers both spellings and both test files end with a newline.
spirv_gs_to_compute prints the usage from its docstring for help and the
arity error, so the text cannot drift; the docstring also shows the
SPIRV-Tools requirement, as mesh_compute_vs does.
spirv_gs_to_compute.py and spirv_metal_set0.py parse argv by hand, so
--help fell into the arity check and printed the usage line to stderr
with exit 2. Answer it with the usage on stdout and return 0, before
reading vulkan_bindless.h in spirv_metal_set0, and pin both with a test.
Review of #1331 (kotorvr):
- the primitive-count check splits main's entry block, so an OpPhi naming the
entry label as a predecessor now names %gsc_body. New test with a
hand-built GS that branches in its entry block (spirv-val failed before).
- the tests that translate gs_tri.asm are marked @requires_tools, like the
other make_shader tests, so they skip instead of erroring without llvm-mc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").
tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apple GPUs have no geometry stage. The tool rewrites a translated geometry
module into a GLCompute module, one invocation per input primitive: the
per-vertex inputs are read from a buffer, every OpEmitVertex copies the
outputs to a record buffer, and a meta buffer holds each primitive's vertex
count and strip ends, for an ordinary draw afterwards. --layout writes the
slot order and sizes.
gs_tri lowered this way, converted with SPIRV-Cross and run natively on an
Apple A18 Pro: 195/195 records exact for 65 random triangles, and the
captured fullscreen triangle drawn from the records matches all 4096
gradient pixels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>