nv2a: Handle invalid w in fixed function pipeline

This commit is contained in:
Erik Abair 2022-05-19 11:22:20 -07:00 committed by mborgerson
parent 482b2ea31d
commit f54b207812
1 changed files with 6 additions and 1 deletions

View File

@ -693,8 +693,13 @@ GLSL_DEFINE(materialEmissionColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_CM_COL) ".xyz
state->surface_scale_factor);
}
mstring_append(body, " vtx.inv_w = 1.0 / oPos.w;\n");
mstring_append(body,
" if (oPos.w == 0.0 || isinf(oPos.w)) {\n"
" vtx.inv_w = 1.0;\n"
" } else {\n"
" vtx.inv_w = 1.0 / oPos.w;\n"
" }\n");
}
static MString *generate_vertex_shader(const ShaderState *state,