From 366c0bbb503c09d570fac1a42e27800150ad4714 Mon Sep 17 00:00:00 2001 From: Jannik Vogel Date: Fri, 26 May 2017 15:21:52 +0200 Subject: [PATCH] Fix: all lights used same shader var since 9fd88f53 --- hw/xbox/nv2a.c | 8 ++++---- hw/xbox/nv2a_shaders.c | 8 ++++---- hw/xbox/nv2a_shaders.h | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/xbox/nv2a.c b/hw/xbox/nv2a.c index 4e6cd5ef10..ba68e0cea7 100644 --- a/hw/xbox/nv2a.c +++ b/hw/xbox/nv2a.c @@ -1921,20 +1921,20 @@ static void pgraph_shader_update_constants(PGRAPHState *pg, for (i = 0; i < NV2A_MAX_LIGHTS; i++) { GLint loc; - loc = binding->light_infinite_half_vector_loc; + loc = binding->light_infinite_half_vector_loc[i]; if (loc != -1) { glUniform3fv(loc, 1, pg->light_infinite_half_vector[i]); } - loc = binding->light_infinite_direction_loc; + loc = binding->light_infinite_direction_loc[i]; if (loc != -1) { glUniform3fv(loc, 1, pg->light_infinite_direction[i]); } - loc = binding->light_local_position_loc; + loc = binding->light_local_position_loc[i]; if (loc != -1) { glUniform3fv(loc, 1, pg->light_local_position[i]); } - loc = binding->light_local_attenuation_loc; + loc = binding->light_local_attenuation_loc[i]; if (loc != -1) { glUniform3fv(loc, 1, pg->light_local_attenuation[i]); } diff --git a/hw/xbox/nv2a_shaders.c b/hw/xbox/nv2a_shaders.c index ef1e9d3928..9eb37ec5ba 100644 --- a/hw/xbox/nv2a_shaders.c +++ b/hw/xbox/nv2a_shaders.c @@ -930,14 +930,14 @@ ShaderBinding* generate_shaders(const ShaderState state) } for (i = 0; i < NV2A_MAX_LIGHTS; i++) { snprintf(tmp, sizeof(tmp), "lightInfiniteHalfVector%d", i); - ret->light_infinite_half_vector_loc = glGetUniformLocation(program, tmp); + ret->light_infinite_half_vector_loc[i] = glGetUniformLocation(program, tmp); snprintf(tmp, sizeof(tmp), "lightInfiniteDirection%d", i); - ret->light_infinite_direction_loc = glGetUniformLocation(program, tmp); + ret->light_infinite_direction_loc[i] = glGetUniformLocation(program, tmp); snprintf(tmp, sizeof(tmp), "lightLocalPosition%d", i); - ret->light_local_position_loc = glGetUniformLocation(program, tmp); + ret->light_local_position_loc[i] = glGetUniformLocation(program, tmp); snprintf(tmp, sizeof(tmp), "lightLocalAttenuation%d", i); - ret->light_local_attenuation_loc = glGetUniformLocation(program, tmp); + ret->light_local_attenuation_loc[i] = glGetUniformLocation(program, tmp); } return ret; diff --git a/hw/xbox/nv2a_shaders.h b/hw/xbox/nv2a_shaders.h index fab6438529..b2a41aaf31 100644 --- a/hw/xbox/nv2a_shaders.h +++ b/hw/xbox/nv2a_shaders.h @@ -103,10 +103,10 @@ typedef struct ShaderBinding { GLint fog_color_loc; GLint fog_param_loc[2]; - GLint light_infinite_half_vector_loc; - GLint light_infinite_direction_loc; - GLint light_local_position_loc; - GLint light_local_attenuation_loc; + GLint light_infinite_half_vector_loc[NV2A_MAX_LIGHTS]; + GLint light_infinite_direction_loc[NV2A_MAX_LIGHTS]; + GLint light_local_position_loc[NV2A_MAX_LIGHTS]; + GLint light_local_attenuation_loc[NV2A_MAX_LIGHTS]; } ShaderBinding;