From 90c2eca5a8cc3c26f06f92dc0056882c3701c44f Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Tue, 25 Aug 2015 08:23:58 +0200 Subject: [PATCH] Fix bug with duplicate uniform --- hw/xbox/nv2a_shaders.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/xbox/nv2a_shaders.c b/hw/xbox/nv2a_shaders.c index 254678a6af..012611b8f6 100644 --- a/hw/xbox/nv2a_shaders.c +++ b/hw/xbox/nv2a_shaders.c @@ -310,6 +310,11 @@ static QString* generate_fixed_function(const ShaderState state, qstring_append_fmt(h, "uniform vec3 sceneAmbientColor;\n"); qstring_append(s, "vec4 tD0 = vec4(sceneAmbientColor, diffuse.a);\n"); qstring_append(s, "vec4 tD1 = vec4(0.0, 0.0, 0.0, specular.a);\n"); + + /* FIXME: Only add if necessary */ + qstring_append(h, + "uniform vec4 eyePosition;\n"); + for (i = 0; i < NV2A_MAX_LIGHTS; i++) { if (state.light[i] == LIGHT_OFF) { continue; @@ -335,9 +340,6 @@ static QString* generate_fixed_function(const ShaderState state, if (state.light[i] == LIGHT_LOCAL || state.light[i] == LIGHT_SPOT) { - qstring_append(h, - "uniform vec4 eyePosition;\n"); - qstring_append_fmt(h, "uniform vec3 lightLocalPosition%d;\n" "uniform vec3 lightLocalAttenuation%d;\n",