fconst now emits one cached OpConstant %float per value (%fc<bits>) instead
of an OpConstant %uint bitcast at each use, so the v_cvt_f32_f64 omod check
looks for %fc<scale bits> = OpConstant %float and checks that its literal
gives back exactly the scale's 32 bits. The rest of the data flow is pinned
as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gen.clamp_mods applied the VOP3 clamp bit as a bare GLSL.std.450
FClamp, which is undefined for a NaN operand. The game's MODE has
DX10_CLAMP=1, under which the hardware turns a NaN result into +0
(measured on gfx1036: the v_rcp_iflag_f32 run and SHADER-186 for
v_fmac_f16 / v_fma_mix*). Select +0 for a NaN before FClamp, as the
div_fixup, cvt_pk_u8 and cvt_pknorm clamps already do. This covers
every f32/f16 op that applies clamp through clamp_mods/clamp_f16.
- tests/semantic/test_vop3_clamp_nan.py: NaN operands (quiet,
negative, signalling) and invalid operations (inf-inf, -inf*0)
under clamp give +0 for f32, f16 (low and high half), conversions,
legacy and mix ops; controls without a NaN are unchanged. It fails
33 subtests on the old translator.
- The two negative controls that expected the undefined FClamp
(test_alu_f32_min_max, test_alu_min3_max3) now expect +0, and the
f16 unary harness checks clamp of a NaN result instead of skipping.
- test_rcp_iflag_mods / test_f64_conversion match the new SPIR-V.
- docs/design.md and docs/shader_validation.md no longer list the
f32/f16 clamp of a NaN as unmodelled. Still a bare FClamp: the f64
clamp (open PR #475) and the packed v_pk_* clamp.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>