Commit Graph

32 Commits

Author SHA1 Message Date
9eb60cc054 spirv_gs_to_compute: preserve implied Shader cap, fix 64-bit indices, output loads, comments, and helper guards (SHADER-GSC-LOWERING) 2026-11-24 12:22:47 +01:00
c9485def3b Merge pull request #255 from kotekompotek/contribution/gs-to-compute-pc-tail-bindings
rdna2spirv: preserve push-constant tail bindings in GS-to-compute lowering
2026-11-23 22:28:12 -05:00
2f9fd8ff83 spirv_gs_to_compute: a pointer derived from a captured input or output keeps the new storage class 2026-11-24 08:38:20 +05:30
0ca859bec0 spirv_gs_to_compute: keep Unicode separators inside quoted names 2026-11-24 03:53:02 +08:00
c7a74414fc spirv_gs_to_compute: document base_binding in module docstring 2026-11-23 21:14:23 +05:00
094e36f5f9 spirv_gs_to_compute: shift capture bindings past existing set 1 bindings (--pc-tail-ubo)
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
2026-11-23 21:14:23 +05:00
05b8a67a96 spirv_gs_to_compute: reject OpEmitVertex in a loop header before OpLoopMerge (SHADER-617) (#3319)
Squash-merged after diff review of PR #3319
2026-11-23 09:52:12 -06:00
7cd3c337b6 Merge pull request #4384 from leather147
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:14 -05:00
a1f944dc59 Merge pull request #4271 from leather147
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:13:00 -05:00
fa81765779 Merge pull request #4171 from leather147
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:12:00 -05:00
ad2a10b2d9 spirv_gs_to_compute: prune removed decoration group targets
AI-assisted (Codex).
2026-11-23 04:09:34 +03:00
8cb05ea34e spirv_gs_to_compute: keep local variables before capture setup 2026-11-23 03:27:32 +03:00
8b84c92c7b spirv_gs_to_compute: carry float controls into compute capture 2026-11-23 02:45:13 +03:00
8dd81f94ec Merge pull request #3319 from Tim Elery
# Conflicts:
#	docs/design.md
2026-11-22 17:01:22 -05:00
8e88cfd257 Merge pull request #2755 from Vonsek 2026-11-22 16:59:41 -05:00
bff06eacbb spirv_gs_to_compute: guard OpEmitVertex on n < OutputVertices (SHADER-617) 2026-11-22 13:04:45 -08:00
77d686db1e chore: merge upstream geometry capture changes
Keep the upstream in-bounds access-chain case alongside validation of the source module versions.
2026-11-22 21:15:50 +01:00
640817c1a3 Merge pull request #3062 from Leo Leahy 2026-11-22 15:14:29 -05:00
5b45c99f87 Merge pull request #2853 from kapitche 2026-11-22 15:12:36 -05:00
cebd579640 spirv_gs_to_compute: accept memory operands on built-in OpLoad and output OpStore 2026-11-22 16:15:17 -03:00
f9a1be760a tools: pin encoding=utf-8 on five text writes, and test that no text-mode open omits it
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.
2026-11-22 13:33:46 -05:00
c8e6b95150 fix(tools): honor the source SPIR-V version in geometry capture
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.
2026-11-22 19:10:30 +01:00
eeb768ad4e fix(tools): lower in-bounds geometry shader access chains
The geometry capture rewrite rejected valid pointers to input vertices and output components when they used the in-bounds opcode.
2026-11-22 18:02:39 +01:00
bf57cecc10 Merge pull request #1915 from lumenpearson 2026-11-22 10:39:25 -05:00
d4d486aaf2 spirv_gs_to_compute: reject overlapping file paths 2026-11-22 17:59:52 +03:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
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.
2026-11-22 14:20:30 +00:00
d426f78596 spirv tools: cover -h and reuse the docstring usage
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.
2026-11-22 21:17:35 +08:00
92f8b7c0c5 spirv tools: answer -h/--help with exit 0
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.
2026-11-22 21:10:18 +08:00
89cf18645e Merge pull request #1428 from Dominik 2026-11-22 06:38:01 -05:00
8a79601b74 spirv_gs_to_compute: fix OpPhi from the split entry block; skip tests without llvm-mc
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>
2026-11-22 14:35:05 +03:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
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>
2026-11-22 11:27:00 +00:00
d1474ee1d7 tools: spirv_gs_to_compute.py runs a translated GS as a compute capture pass (SHADER-159)
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>
2026-11-22 13:04:42 +03:00