Commit Graph

7 Commits

Author SHA1 Message Date
92c18ff4d9 rdna2spirv: emit OpBeginInvocationInterlockEXT for straight-line POPS pixel shaders (SHADER-350) 2026-11-22 21:00:13 +05:30
3de090756a Merge pull request #1781 from qerdavo-dot 2026-11-22 09:15:18 -05:00
5bf70ece68 translator: refuse a .s with no tab-indented instructions
parse_file reads tab-indented instruction lines only, so a hand-written or
re-indented .s parses to an empty shader. That used to translate to a module
that passes spirv-val, lands in index.json and does no work at all: the CLI
printed "1 shaders: 1 translated, 1 pass spirv-val" for a file whose only
line was a comment.

Refuse it in translate() with "no instructions (nothing tab-indented?)", so
it is reported like any other unsupported shader and no .spv is published.
Found while writing a fixture with spaces instead of tabs; the new test uses
that exact shape.
2026-11-22 15:04:19 +01:00
03ed39c88b rdna2spirv: drop a failed retried shader's stale .spv and index entry
A shader that raises Unsupported or a translator error on a retried partial
run kept the .spv and index.json entry an earlier successful run published:
only spirv-as/val rejections went through the invalid set that the index
merge pops. The stale entry masks the regression from make_game.py, which
takes index.json as proof the translation finished, and the stale module
stays loadable by the runtime.

Route all three failure paths through one drop_stale helper: unlink the old
.spv and mark the name for the index merge to drop. The .spvasm text stays
for diagnosis, as it does on a rejection. Shard and --limit runs write their
index fresh from this run's metadata, so they only gain the unlink.

Tests: two synthetic CLI tests (s_barrier in a PS is Unsupported before any
SPIR-V tool runs; a mocked ValueError covers the translator-error path).
Both fail without the change. Standard library only, no game data.

AI-assisted. Tested on CPU (Windows 11, Python 3.12): tests/test_rdna2spirv_cli.py
(14 tests), unittest discover tests/semantic, and pytest tests/test_rdna2spirv_cli.py
tests/test_translate.py with llvm-mc 23.1.5 (AMDGPU) and SPIRV-Tools v2026.4.
No GPU was used.
2026-11-22 16:46:48 +03:00
bfafe94bc2 test(rdna2spirv): cover invalid src and .s directories in CLI 2026-11-22 15:38:56 +05:30
60e4e904b7 Publish SPIR-V only after validation succeeds 2026-11-22 00:41:51 -03:00
96ec04967a rdna2spirv.py: check --limit and --shard before translating anything
`files[: a.limit] if a.limit else files` read --limit 0 as "no limit"
and translated the whole corpus, and a negative --limit dropped the
last shaders instead of being refused. --shard was split and used
unchecked: 0/0 ended in "slice step cannot be zero", 9/8 translated
nothing and wrote an empty index.part9.json that --merge then reads,
and anything that isn't i/n was a traceback.

Both are now argparse types: --limit must be at least 1, and --shard
must be i/n with n >= 1 and 0 <= i < n. A bad value is a usage error
(exit 2) before --out is created. The translation itself is unchanged,
and make_game.py's own "--shard i/jobs" values are all valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:00:01 +01:00