mirror of https://github.com/xemu-project/xemu.git
nv2a: Clamp fog factor to valid float range
This commit is contained in:
parent
1343d5873f
commit
634577c753
|
@ -53,6 +53,8 @@ MString *pgraph_gen_vsh_glsl(const ShaderState *state, bool prefix_outputs)
|
||||||
GLSL_DEFINE(texMat2, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T2MAT))
|
GLSL_DEFINE(texMat2, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T2MAT))
|
||||||
GLSL_DEFINE(texMat3, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T3MAT))
|
GLSL_DEFINE(texMat3, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T3MAT))
|
||||||
|
|
||||||
|
"\n"
|
||||||
|
"#define FLOAT_MAX uintBitsToFloat(0x7F7FFFFFu)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"vec4 oPos = vec4(0.0,0.0,0.0,1.0);\n"
|
"vec4 oPos = vec4(0.0,0.0,0.0,1.0);\n"
|
||||||
"vec4 oD0 = vec4(0.0,0.0,0.0,1.0);\n"
|
"vec4 oD0 = vec4(0.0,0.0,0.0,1.0);\n"
|
||||||
|
@ -244,7 +246,13 @@ MString *pgraph_gen_vsh_glsl(const ShaderState *state, bool prefix_outputs)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mstring_append(body, " oFog = NaNToOne(vec4(fogFactor));\n");
|
/* Fog is clamped to min/max normal float values here to match HW
|
||||||
|
* interpolation. It is then clamped to [0,1] in the pixel shader.
|
||||||
|
*/
|
||||||
|
// clang-format off
|
||||||
|
mstring_append(body,
|
||||||
|
" oFog = clamp(NaNToOne(vec4(fogFactor)), -FLOAT_MAX, FLOAT_MAX);\n");
|
||||||
|
// clang-format on
|
||||||
} else {
|
} else {
|
||||||
/* FIXME: Is the fog still calculated / passed somehow?!
|
/* FIXME: Is the fog still calculated / passed somehow?!
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue