@ -2953,16 +2953,12 @@ static void vrend_draw_bind_vertex_binding(struct vrend_context *ctx,
}
}
}
}
static void vrend_draw_bind_samplers ( struct vrend_context * ctx )
static void vrend_draw_bind_samplers_shader ( struct vrend_context * ctx ,
int shader_type ,
int * sampler_id )
{
{
int sampler_id ;
int i ;
int shader_type ;
sampler_id = 0 ;
for ( shader_type = PIPE_SHADER_VERTEX ; shader_type < = ctx - > sub - > last_shader_idx ; shader_type + + ) {
int index = 0 ;
int index = 0 ;
for ( i = 0 ; i < ctx - > sub - > views [ shader_type ] . num_views ; i + + ) {
for ( int i = 0 ; i < ctx - > sub - > views [ shader_type ] . num_views ; i + + ) {
struct vrend_resource * texture = NULL ;
struct vrend_resource * texture = NULL ;
if ( ctx - > sub - > views [ shader_type ] . views [ i ] ) {
if ( ctx - > sub - > views [ shader_type ] . views [ i ] ) {
@ -2973,7 +2969,7 @@ static void vrend_draw_bind_samplers(struct vrend_context *ctx)
continue ;
continue ;
if ( ctx - > sub - > prog - > samp_locs [ shader_type ] )
if ( ctx - > sub - > prog - > samp_locs [ shader_type ] )
glUniform1i ( ctx - > sub - > prog - > samp_locs [ shader_type ] [ index ] , sampler_id ) ;
glUniform1i ( ctx - > sub - > prog - > samp_locs [ shader_type ] [ index ] , * sampler_id ) ;
if ( ctx - > sub - > prog - > shadow_samp_mask [ shader_type ] & ( 1 < < i ) ) {
if ( ctx - > sub - > prog - > shadow_samp_mask [ shader_type ] & ( 1 < < i ) ) {
struct vrend_sampler_view * tview = ctx - > sub - > views [ shader_type ] . views [ i ] ;
struct vrend_sampler_view * tview = ctx - > sub - > views [ shader_type ] . views [ i ] ;
@ -2989,7 +2985,7 @@ static void vrend_draw_bind_samplers(struct vrend_context *ctx)
tview - > gl_swizzle_a = = GL_ONE ? 1.0 : 0.0 ) ;
tview - > gl_swizzle_a = = GL_ONE ? 1.0 : 0.0 ) ;
}
}
glActiveTexture ( GL_TEXTURE0 + sampler_id ) ;
glActiveTexture ( GL_TEXTURE0 + * sampler_id ) ;
if ( texture ) {
if ( texture ) {
GLuint id ;
GLuint id ;
GLenum target = texture - > target ;
GLenum target = texture - > target ;
@ -3002,7 +2998,7 @@ static void vrend_draw_bind_samplers(struct vrend_context *ctx)
glBindTexture ( target , id ) ;
glBindTexture ( target , id ) ;
if ( ctx - > sub - > views [ shader_type ] . old_ids [ i ] ! = id | | ctx - > sub - > sampler_state_dirty ) {
if ( ctx - > sub - > views [ shader_type ] . old_ids [ i ] ! = id | | ctx - > sub - > sampler_state_dirty ) {
vrend_apply_sampler_state ( ctx , texture , shader_type , i , sampler_id , ctx - > sub - > views [ shader_type ] . views [ i ] - > srgb_decode ) ;
vrend_apply_sampler_state ( ctx , texture , shader_type , i , * sampler_id , ctx - > sub - > views [ shader_type ] . views [ i ] - > srgb_decode ) ;
ctx - > sub - > views [ shader_type ] . old_ids [ i ] = id ;
ctx - > sub - > views [ shader_type ] . old_ids [ i ] = id ;
}
}
if ( ctx - > sub - > rs_state . point_quad_rasterization ) {
if ( ctx - > sub - > rs_state . point_quad_rasterization ) {
@ -3013,10 +3009,20 @@ static void vrend_draw_bind_samplers(struct vrend_context *ctx)
glTexEnvi ( GL_POINT_SPRITE_ARB , GL_COORD_REPLACE_ARB , GL_FALSE ) ;
glTexEnvi ( GL_POINT_SPRITE_ARB , GL_COORD_REPLACE_ARB , GL_FALSE ) ;
}
}
}
}
sampler_id + + ;
( * sampler_id ) + + ;
}
}
index + + ;
index + + ;
}
}
}
static void vrend_draw_bind_samplers ( struct vrend_context * ctx )
{
int sampler_id ;
int shader_type ;
sampler_id = 0 ;
for ( shader_type = PIPE_SHADER_VERTEX ; shader_type < = ctx - > sub - > last_shader_idx ; shader_type + + ) {
vrend_draw_bind_samplers_shader ( ctx , shader_type , & sampler_id ) ;
}
}
if ( vrend_state . use_core_profile & & ctx - > sub - > prog - > fs_stipple_loc ! = - 1 ) {
if ( vrend_state . use_core_profile & & ctx - > sub - > prog - > fs_stipple_loc ! = - 1 ) {