Commit Graph

2 Commits

Author SHA1 Message Date
4407f9f8db perf(translator): share normalization in fixed-format buffer loads
Repeated normalized tbuffer loads emit the same integer quotient for every channel. Generate one helper per magnitude width without changing the dynamic format decoder.
2026-11-22 06:56:37 +01:00
178a4b47ff SHADER-86 follow-up: correctly rounded UNORM/SNORM decode with integer ops; add 8_SNORM, 16_SNORM, 8_8_SNORM
OpFDiv is allowed 2.5 ULP, and on an RX 6700 (AMD Windows 26.11.2) and an
RTX 5090 it returns the reciprocal-multiply bits, so #599's decode was only
correctly rounded in the CPU model (8_UNORM 130/256 exact on the RX 6700).

x/(2^n-1) in binary is x's n bits repeated, so a 64-bit multiply by the repeat
pattern, FindUMsb and the round bit give the correctly rounded f32 with integer
ops only; the tail never ends, so there are no ties. SNORM uses the same on the
magnitude with n-1 bits; the most negative code is -1.0.

Formats 2 (8_SNORM), 8 (16_SNORM) and 15 (8_8_SNORM) were missing from
FORMATS and decoded to 0.

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