Commit Graph

2 Commits

Author SHA1 Message Date
d1b14075a4 spirv_interp: handle GLSL IEEE edge domains, FMA sign/overflow, and OpFNegate NaNs 2026-11-26 19:49:58 +08:00
70154750b2 tests/spirv_interp: hold integers as 32-bit patterns; signed ops convert themselves
The interpreter kept a value of a signed type as a negative Python int and a
value of an unsigned type as a non-negative one, and used both raw. SPIR-V
defines its signed and unsigned instructions on the bits, so wherever the
instruction and the type disagreed the result was wrong:

  OpSLessThanEqual 0x80000000u 1u      false (true)
  OpShiftRightLogical (int -8) 1       0xfffffffc (0x7ffffffc)
  OpULessThan (int -8) 1u              true (false)
  OpConvertUToF (int -8)               -8.0 (2^32)
  SMin / SMax of uint values           unsigned order

Integers are now always the unsigned 32-bit pattern, and OpS* compares, SMin
and SMax read them through s32(). Also x / -0.0 gave +inf for a positive x.
The 297 tests that run translator output through this interpreter give the
same results.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 20:39:15 +00:00