nv2a: Explicit float representation for RCC and vertex shader W range

This commit is contained in:
coldhex 2025-03-08 19:54:45 +02:00 committed by mborgerson
parent 63cb75ce84
commit 3eb22b6b81
1 changed files with 3 additions and 2 deletions

View File

@ -74,11 +74,12 @@ MString *pgraph_gen_vsh_glsl(const ShaderState *state, bool prefix_outputs)
" return vec4(x, y, z, 1);\n"
"}\n"
"\n"
// Clamp to range [2^(-64), 2^64] or [-2^64, -2^(-64)].
"float clampAwayZeroInf(float t) {\n"
" if (t > 0.0 || floatBitsToUint(t) == 0) {\n"
" t = clamp(t, 5.421011e-20, 1.8446744e19);\n"
" t = clamp(t, uintBitsToFloat(0x1F800000), uintBitsToFloat(0x5F800000));\n"
" } else {\n"
" t = clamp(t, -1.8446744e19, -5.421011e-20);\n"
" t = clamp(t, uintBitsToFloat(0xDF800000), uintBitsToFloat(0x9F800000));\n"
" }\n"
" return t;\n"
"}\n");