memset(key, 0, sizeof(*key));
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, brw->cs.base.sampler_count,
- &key->tex);
+ brw_populate_sampler_prog_key_data(ctx, prog, &key->tex);
/* The unique compute program ID */
key->program_string_id = cp->id;
struct brw_gs_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
- struct brw_stage_state *stage_state = &brw->gs.base;
struct brw_geometry_program *gp =
(struct brw_geometry_program *) brw->geometry_program;
struct gl_program *prog = &gp->program.Base;
key->program_string_id = gp->id;
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, stage_state->sampler_count,
- &key->tex);
+ brw_populate_sampler_prog_key_data(ctx, prog, &key->tex);
}
void
void brw_populate_sampler_prog_key_data(struct gl_context *ctx,
const struct gl_program *prog,
- unsigned sampler_count,
struct brw_sampler_prog_key_data *key);
bool brw_debug_recompile_sampler_key(struct brw_context *brw,
const struct brw_sampler_prog_key_data *old_key,
key.program_string_id = tcp->id;
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, stage_state->sampler_count,
- &key.tex);
+ brw_populate_sampler_prog_key_data(ctx, prog, &key.tex);
} else {
key.outputs_written = tep->program.Base.InputsRead;
}
key.patch_inputs_read = per_patch_slots;
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, stage_state->sampler_count,
- &key.tex);
+ brw_populate_sampler_prog_key_data(ctx, prog, &key.tex);
if (!brw_search_cache(&brw->cache, BRW_CACHE_TES_PROG,
&key, sizeof(key),
}
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, brw->vs.base.sampler_count,
- &key->tex);
+ brw_populate_sampler_prog_key_data(ctx, prog, &key->tex);
/* BRW_NEW_VS_ATTRIB_WORKAROUNDS */
memcpy(key->gl_attrib_wa_flags, brw->vb.attrib_wa_flags,
void
brw_populate_sampler_prog_key_data(struct gl_context *ctx,
const struct gl_program *prog,
- unsigned sampler_count,
struct brw_sampler_prog_key_data *key)
{
struct brw_context *brw = brw_context(ctx);
+ GLbitfield mask = prog->SamplersUsed;
- for (int s = 0; s < sampler_count; s++) {
- key->swizzles[s] = SWIZZLE_NOOP;
+ while (mask) {
+ const int s = u_bit_scan(&mask);
- if (!(prog->SamplersUsed & (1 << s)))
- continue;
+ key->swizzles[s] = SWIZZLE_NOOP;
int unit_id = prog->SamplerUnits[s];
const struct gl_texture_unit *unit = &ctx->Texture.Unit[unit_id];
key->clamp_fragment_color = ctx->Color._ClampFragmentColor;
/* _NEW_TEXTURE */
- brw_populate_sampler_prog_key_data(ctx, prog, brw->wm.base.sampler_count,
- &key->tex);
+ brw_populate_sampler_prog_key_data(ctx, prog, &key->tex);
/* _NEW_BUFFERS */
key->nr_color_regions = ctx->DrawBuffer->_NumColorDrawBuffers;