update_shader_samplers(struct st_context *st,
enum pipe_shader_type shader_stage,
const struct gl_program *prog,
- unsigned max_units,
struct pipe_sampler_state *samplers,
unsigned *num_samplers)
{
*num_samplers = 0;
/* loop over sampler units (aka tex image units) */
- for (unit = 0; unit < max_units; unit++, samplers_used >>= 1) {
+ for (unit = 0; samplers_used; unit++, samplers_used >>= 1) {
struct pipe_sampler_state *sampler = samplers + unit;
if (samplers_used & 1) {
update_shader_samplers(st,
PIPE_SHADER_VERTEX,
ctx->VertexProgram._Current,
- ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_VERTEX],
&st->state.num_samplers[PIPE_SHADER_VERTEX]);
}
update_shader_samplers(st,
PIPE_SHADER_TESS_CTRL,
ctx->TessCtrlProgram._Current,
- ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_TESS_CTRL],
&st->state.num_samplers[PIPE_SHADER_TESS_CTRL]);
}
update_shader_samplers(st,
PIPE_SHADER_TESS_EVAL,
ctx->TessEvalProgram._Current,
- ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_TESS_EVAL],
&st->state.num_samplers[PIPE_SHADER_TESS_EVAL]);
}
update_shader_samplers(st,
PIPE_SHADER_GEOMETRY,
ctx->GeometryProgram._Current,
- ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_GEOMETRY],
&st->state.num_samplers[PIPE_SHADER_GEOMETRY]);
}
update_shader_samplers(st,
PIPE_SHADER_FRAGMENT,
ctx->FragmentProgram._Current,
- ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_FRAGMENT],
&st->state.num_samplers[PIPE_SHADER_FRAGMENT]);
}
update_shader_samplers(st,
PIPE_SHADER_COMPUTE,
ctx->ComputeProgram._Current,
- ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits,
st->state.samplers[PIPE_SHADER_COMPUTE],
&st->state.num_samplers[PIPE_SHADER_COMPUTE]);
}