@@ -133,6 +133,7 @@ static void update_shader_constant_locations(ShaderBinding *binding)
133
133
}
134
134
}
135
135
binding -> alpha_ref_loc = glGetUniformLocation (binding -> gl_program , "alphaRef" );
136
+
136
137
for (int i = 1 ; i < NV2A_MAX_TEXTURES ; i ++ ) {
137
138
snprintf (tmp , sizeof (tmp ), "bumpMat%d" , i );
138
139
binding -> bump_mat_loc [i ] = glGetUniformLocation (binding -> gl_program , tmp );
@@ -203,6 +204,16 @@ static void update_shader_constant_locations(ShaderBinding *binding)
203
204
binding -> material_alpha_loc = -1 ;
204
205
binding -> specular_power_loc = -1 ;
205
206
}
207
+
208
+ for (int i = 0 ; i < 4 ; ++ i ) {
209
+ snprintf (tmp , sizeof (tmp ), "colorKey[%d]" , i );
210
+ binding -> color_key_loc [i ] =
211
+ glGetUniformLocation (binding -> gl_program , tmp );
212
+
213
+ snprintf (tmp , sizeof (tmp ), "colorKeyMask[%d]" , i );
214
+ binding -> color_key_mask_loc [i ] =
215
+ glGetUniformLocation (binding -> gl_program , tmp );
216
+ }
206
217
}
207
218
208
219
static void generate_shaders (ShaderBinding * binding )
@@ -696,6 +707,7 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding,
696
707
bool binding_changed )
697
708
{
698
709
PGRAPHGLState * r = pg -> gl_renderer_state ;
710
+ ShaderState * state = & binding -> state ;
699
711
int i , j ;
700
712
701
713
/* update combiner constants */
@@ -725,7 +737,6 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding,
725
737
glUniform1i (binding -> alpha_ref_loc , alpha_ref );
726
738
}
727
739
728
-
729
740
/* For each texture stage */
730
741
for (i = 0 ; i < NV2A_MAX_TEXTURES ; i ++ ) {
731
742
GLint loc ;
@@ -765,6 +776,15 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding,
765
776
assert (r -> texture_binding [i ] != NULL );
766
777
glUniform1f (loc , (float )r -> texture_binding [i ]-> scale );
767
778
}
779
+
780
+ if (binding -> color_key_loc [i ] != -1 ) {
781
+ glUniform1ui (binding -> color_key_loc [i ],
782
+ pgraph_reg_r (pg , NV_PGRAPH_COLORKEYCOLOR0 + i * 4 ));
783
+ }
784
+ if (binding -> color_key_mask_loc [i ] != -1 ) {
785
+ glUniform1ui (binding -> color_key_mask_loc [i ],
786
+ state -> psh .colorkey_mask [i ]);
787
+ }
768
788
}
769
789
770
790
if (binding -> fog_color_loc != -1 ) {
@@ -794,7 +814,7 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding,
794
814
assert (0 );
795
815
}
796
816
797
- if (binding -> state . fixed_function ) {
817
+ if (state -> fixed_function ) {
798
818
/* update lighting constants */
799
819
struct {
800
820
uint32_t * v ;
@@ -990,7 +1010,8 @@ static bool test_shaders_dirty(PGRAPHState *pg)
990
1010
CF(pg->primitive_mode, primitive_mode) \
991
1011
CF(pg->surface_scale_factor, surface_scale_factor) \
992
1012
CF(pg->compressed_attrs, compressed_attrs) \
993
- CFA(pg->texture_matrix_enable, texture_matrix_enable)
1013
+ CFA(pg->texture_matrix_enable, texture_matrix_enable) \
1014
+ CR_4(NV_PGRAPH_COLORKEYCOLOR0)
994
1015
995
1016
#define CR_x (reg , x ) CR_x__define(reg, x)
996
1017
#define CF_x (type , src , name , x ) CF_x__define(type, src, name, x)
0 commit comments