Apply published_mode(spv) to temporary staged SPV before atomic replacement,
and restore write permission (0o600) before directory cleanup in exception block
when replace fails, preventing Windows PermissionError [WinError 5] and
stranded temporary files.
agent: yes
AI-assisted: yes
When index.json's mesh_compute layout carries pc_tail_address_dwords (as
produced by rdna2spirv.py --mesh-compute --pc-tail-ubo), emit the vertex
shader's output-buffer address loads from the set-1 binding-0 Uniform block
%pc_tail (%PcTail) instead of a 152-byte PushConstant block, omitting
PushConstant completely so the vertex shader fits 128-byte push-constant
devices. Without pc_tail_address_dwords, the emitted SPIR-V assembly is
byte-identical to before.
Co-Authored-By: Gemini 4 Neon <noreply@google.com>
An assembler success can still produce a module that the validator rejects. Keep that binary private until it passes so the runtime cannot see it at the final shader path.
`mesh_compute_vs.py --help` took `--help` as the spirv dir, found no index.json and exited 0 with no output;
a path that does not exist did the same, so a typo looked like a successful run with nothing to do.
-h/--help now print the docstring and exit 0, and a path that is not a directory is one ERROR line and
exit 1, like the tool's other errors. build_for_index / write_for_index are unchanged. Same fix as #1379
for bary_fallback_gs.py.
build_for_index ran spirv-as/spirv-val straight through subprocess, so a PATH
without them gave "the system cannot find the file specified" with no tool name,
and a shader the assembler rejects raised RuntimeError out of main() as a
traceback. Resolve both tools up front with shutil.which, and have main() report
a build or write failure as one ERROR line, with a wrong argument count a usage
error (exit 2) instead of the whole docstring with exit 1.
Also adds tests/test_mesh_compute_vs.py: the vertex shader assembles and
validates across layouts through build_for_index, the interface follows the
mesh shader's locations, and the three CLI error paths.