st/mesa: use cso_set_samplers
This commit is contained in:
@@ -245,6 +245,7 @@ update_shader_samplers(struct st_context *st,
|
||||
GLuint unit;
|
||||
GLbitfield samplers_used;
|
||||
const GLuint old_max = *num_samplers;
|
||||
const struct pipe_sampler_state *states[PIPE_MAX_SAMPLERS];
|
||||
|
||||
samplers_used = prog->SamplersUsed;
|
||||
|
||||
@@ -261,13 +262,11 @@ update_shader_samplers(struct st_context *st,
|
||||
const GLuint texUnit = prog->SamplerUnits[unit];
|
||||
|
||||
convert_sampler(st, sampler, texUnit);
|
||||
|
||||
states[unit] = sampler;
|
||||
*num_samplers = unit + 1;
|
||||
|
||||
cso_single_sampler(st->cso_context, shader_stage, unit, sampler);
|
||||
}
|
||||
else if (samplers_used != 0 || unit < old_max) {
|
||||
cso_single_sampler(st->cso_context, shader_stage, unit, NULL);
|
||||
states[unit] = NULL;
|
||||
}
|
||||
else {
|
||||
/* if we've reset all the old samplers and we have no more new ones */
|
||||
@@ -275,7 +274,7 @@ update_shader_samplers(struct st_context *st,
|
||||
}
|
||||
}
|
||||
|
||||
cso_single_sampler_done(st->cso_context, shader_stage);
|
||||
cso_set_samplers(st->cso_context, shader_stage, *num_samplers, states);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -757,6 +757,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
||||
/* texture sampling state: */
|
||||
{
|
||||
struct pipe_sampler_state sampler;
|
||||
const struct pipe_sampler_state *states[2] = {&sampler, &sampler};
|
||||
|
||||
memset(&sampler, 0, sizeof(sampler));
|
||||
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP;
|
||||
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP;
|
||||
@@ -766,11 +768,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.normalized_coords = normalized;
|
||||
|
||||
cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 0, &sampler);
|
||||
if (num_sampler_view > 1) {
|
||||
cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 1, &sampler);
|
||||
}
|
||||
cso_single_sampler_done(cso, PIPE_SHADER_FRAGMENT);
|
||||
cso_set_samplers(cso, PIPE_SHADER_FRAGMENT,
|
||||
num_sampler_view > 1 ? 2 : 1, states);
|
||||
}
|
||||
|
||||
/* viewport state: viewport matching window dims */
|
||||
|
Reference in New Issue
Block a user