From c90335801c26a0196fd4d29c9a90c2aa9aa2b258 Mon Sep 17 00:00:00 2001 From: Voxel9 <16278868+Voxel9@users.noreply.github.com> Date: Sat, 27 Jun 2020 21:21:50 +0100 Subject: [PATCH] nv2a: Fix FFP texgen assertions Should compare against channel index instead of texture stage index --- hw/xbox/nv2a/nv2a_shaders.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/xbox/nv2a/nv2a_shaders.c b/hw/xbox/nv2a/nv2a_shaders.c index 5ef0bcafcf..eb4192e7ff 100644 --- a/hw/xbox/nv2a/nv2a_shaders.c +++ b/hw/xbox/nv2a/nv2a_shaders.c @@ -430,7 +430,7 @@ GLSL_DEFINE(sceneAmbientColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_FR_AMB) ".xyz") assert(false); /* Untested */ break; case TEXGEN_SPHERE_MAP: - assert(i < 2); /* Channels S,T only! */ + assert(j < 2); /* Channels S,T only! */ qstring_append(body, "{\n"); /* FIXME: u, r and m only have to be calculated once */ qstring_append(body, " vec3 u = normalize(tPosition.xyz);\n"); @@ -450,7 +450,7 @@ GLSL_DEFINE(sceneAmbientColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_FR_AMB) ".xyz") qstring_append(body, "}\n"); break; case TEXGEN_REFLECTION_MAP: - assert(i < 3); /* Channels S,T,R only! */ + assert(j < 3); /* Channels S,T,R only! */ qstring_append(body, "{\n"); /* FIXME: u and r only have to be calculated once, can share the one from SPHERE_MAP */ qstring_append(body, " vec3 u = normalize(tPosition.xyz);\n"); @@ -460,7 +460,7 @@ GLSL_DEFINE(sceneAmbientColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_FR_AMB) ".xyz") qstring_append(body, "}\n"); break; case TEXGEN_NORMAL_MAP: - assert(i < 3); /* Channels S,T,R only! */ + assert(j < 3); /* Channels S,T,R only! */ qstring_append_fmt(body, "oT%d.%c = tNormal.%c;\n", i, c, c); break;