Commit Graph

35 Commits

Author SHA1 Message Date
9569d18065 spirv_asm: validate --out upfront, accept UTF-8 BOM, and write atomically 2026-11-26 19:44:40 +08:00
4458c2a8b1 spirv_asm: refuse an output that aliases the source
(cherry picked from commit 8e33f7866a)
2026-11-24 10:04:06 -05:00
f8a88299e1 Support named SPIR-V shader debug instructions
Carry forward old Leonida PR #4744 for BUILD-SPIRV-DEBUGINFO.
2026-11-24 11:28:30 +08:00
c389dbc95e spirv_asm: OpExtInst takes DebugPrintf by name from the NonSemantic.DebugPrintf set, as spirv-dis writes it 2026-11-24 08:26:53 +05:30
3d0664ab90 spirv_asm: a BFloat16KHR constant is encoded as bfloat16, not as an IEEE half 2026-11-24 08:26:53 +05:30
1f11a0fd5c spirv_asm: a decimal float constant that overflows its type, or spells inf or nan, is refused as spirv-as refuses it 2026-11-24 08:26:53 +05:30
4e8aa910fe spirv_asm: a decimal f32 constant is rounded once, and an f16 one is that f32 cut toward zero, as spirv-as reads them 2026-11-24 08:26:53 +05:30
ba49ba26a1 spirv_asm: a hex-float constant is truncated toward zero, as spirv-as reads it 2026-11-24 08:26:53 +05:30
1e9c86358d Merge remote-tracking branch 'origin/pr/9739' 2026-11-23 17:24:46 -05:00
ff9ef0456f spirv_asm: support SPIR-V 1.4 under Vulkan 1.1 2026-11-24 06:02:26 +08:00
3b7bc76e06 spirv_asm: keep prefixed specialization mnemonics in operands 2026-11-24 05:24:22 +08:00
8854cf35ba spirv_asm: allow whitespace between instruction tokens 2026-11-24 05:19:07 +08:00
d6caba650f spirv_asm: preserve physical newlines inside quoted operands 2026-11-24 04:54:17 +08:00
e69767913f spirv_asm: preserve Unicode separators inside quoted strings 2026-11-24 02:47:18 +08:00
f875cda2d7 docs: point spirv_asm at its --help usage line (#6634)
Squash-merged after diff review of PR #6634
2026-11-23 11:10:29 -06:00
6596542368 SHADER-1089: spirv_asm refuses an OpSwitch whose selector has no known type instead of guessing 32 bits (#6923)
Squash-merged after diff review of PR #6923 - spirv_asm: refuse an OpSwitch whose selector has no known type, instead of guessing 32 bits (SHADER-1089)
2026-11-23 09:42:47 -06:00
2ee2be2fc1 Merge pull request #4463 from TG0000
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:56 -05:00
60bc78e5a9 Merge pull request #4029 from lumenpearson
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:10:32 -05:00
45b8c4764e Merge pull request #3931 from May
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:09:39 -05:00
6c3a9bd18e Merge pull request #3848 from lumenpearson
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:52 -05:00
62986c9201 Skip switch result-type bookkeeping when unused 2026-11-23 02:34:37 +01:00
May
071c192e5f spirv_asm: a signed hex literal is a value, not a bit pattern (BUILD-1012 review)
SPIRV-Tools reads a hex literal as a bit pattern only when it has no sign:
`OpConstant %short +0xFFFF` is 65535 and is refused for a 16-bit signed type,
while `0xFFFF` is still -1. _int_literal took `+0x...` as a bit pattern too, so
it assembled +0xFFFF (i16), +0x8000 (i16), +0x80 (i8), +0xFFFFFFFF (i32),
+0xFFFFFFFFFFFFFFFF (i64) and the same OpSwitch arms where spirv-as refuses
them. Found by @mrbean56.

Twelve more cases in IntegerLiteralRangeTests (77 in all, 40 refused),
measured with the Vulkan SDK 1.4.363.1 spirv-as; seven of them fail on the
previous commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:03:03 -03:00
5f8eeafbfd spirv_asm: reject malformed textual IDs (BUILD-1150) 2026-11-23 01:58:08 +03:00
May
83dfdc737a spirv_asm: refuse integer literals that don't fit their type, as spirv-as does (BUILD-1012)
The Python assembler masked every integer literal to its word size, so
`OpConstant %uint 4294967296` assembled as 0, `OpConstant %uint -1` as
0xffffffff, and `OpDecorate %x Location 4294967296` as 0, where spirv-as
refuses all three. It also wrote a hex literal for a signed type narrower
than 32 bits without sign-extending it (`OpConstant %short 0xFFFF` gave
0x0000ffff where spirv-as gives 0xffffffff, as the spec requires).

_int_literal now reads a literal for a given width and signedness the way
SPIRV-Tools does: unsigned takes 0..2^w-1 and no minus sign; signed takes
-2^(w-1)..2^(w-1)-1 or a hex bit pattern up to 2^w-1; narrow types are
zero- or sign-extended into their word. It is used for OpConstant /
OpSpecConstant, OpSwitch case literals (by the selector's type, which now
carries its signedness), LiteralInteger and PairIdRefLiteralInteger operands,
and the numeric fallbacks for enum values, masks and OpExtInst numbers.

IntegerLiteralRangeTests pins 65 cases (33 refused) measured with the Vulkan SDK
1.4.363.1 spirv-as, and compares each with spirv-as when it is installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:31:35 -03:00
7f1313c859 Merge latest upstream main 2026-11-23 01:01:34 +03:00
31632a036f Merge pull request #2776 from Vonsek 2026-11-22 16:59:44 -05:00
5bd2c85608 spirv_asm: reject duplicate type definitions (BUILD-1088) 2026-11-23 00:59:27 +03:00
78f8b8a9ac chore: merge upstream SPIR-V assembler changes
Keep the upstream floating-point and string parity tests alongside signed integer literal validation.
2026-11-22 21:17:23 +01:00
e936b4a79f Merge pull request #3277 from kapitche 2026-11-22 15:16:25 -05:00
3fa4574a61 spirv_asm: a source file that is not UTF-8 is one error line, exit 1 2026-11-22 14:58:24 -05:00
ccd52ba94e fix(tools): sign-extend subword SPIR-V integer literals
Signed narrow hexadecimal constants and case labels require sign extension to the SPIR-V word width. Emitting the unextended words produces binaries rejected by Vulkan validation.
2026-11-22 19:15:08 +01:00
0a9874a2f7 Merge pull request #2251 from SweatierKey 2026-11-22 13:13:29 -05:00
45a7cbbac3 spirv_asm: support width-aware hex-float Inf/NaN and SPIRV-Tools string escapes
Addresses standalone compatibility review findings on PR #2251 (@FreddyxS):
- Encode width-aware IEEE-754 hex-float literals (16/32/64-bit) directly into bit
  patterns, including SPIRV-Tools Inf and NaN payload spellings (0x1p+128 -> 0x7f800000,
  0x1.8p+128 -> 0x7fc00000, and f16/f64 equivalents) without OverflowError.
- Match SPIRV-Tools literal string decoding in _unquote_string: \<ch> yields <ch>
  verbatim (e.g. \n -> 'n', not LF).
- Add regression test comparing assembled words against spirv-as in tests/test_spirv_asm.py.
2026-11-22 19:02:58 +01:00
ec8ec4c9a4 Fix what the round-40 merges broke
- docs: one row per topic again in design.md (59 topics merged sentence by sentence, keeping every
  number) and README.md (the current models/character rows); one Other languages line.
- docs/i18n: the two Spanish quickstarts had been concatenated; keep #1912's, drop #2277's row.
- make_game: the shader fingerprint covers spirv_asm.py and its tables; LF settings write.
- tools: pe_shader_containers, gamedata_maps and anim_rigs use report_paths.same_report_path (BUILD-589);
  stdout guard on five tools; LF text writes in three; user_sgpr_census tolerates an unreachable --json.
- tests: fspx stage fakes write real carve/unpack indexes (c7408a1f); typed f16 stores round toward zero
  (SHADER-358); test_ci_registration's helper is no longer collected as a test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:55:07 -05:00
5a35326e15 spirv_asm: pure-Python Vulkan 1.2 SPIR-V binary assembler 2026-11-22 17:28:50 +01:00