i965: make more effective use of SamplersUsed
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
This commit is contained in:
parent
51f912786f
commit
8f1ca0ee3f
|
@ -198,8 +198,7 @@ brw_cs_populate_key(struct brw_context *brw, struct brw_cs_prog_key *key)
|
|||
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;
|
||||
|
|
|
@ -207,7 +207,6 @@ brw_gs_populate_key(struct brw_context *brw,
|
|||
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;
|
||||
|
@ -217,8 +216,7 @@ brw_gs_populate_key(struct brw_context *brw,
|
|||
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
|
||||
|
|
|
@ -44,7 +44,6 @@ void brw_setup_tex_for_precompile(struct brw_context *brw,
|
|||
|
||||
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,
|
||||
|
|
|
@ -351,8 +351,7 @@ brw_upload_tcs_prog(struct brw_context *brw,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -263,8 +263,7 @@ brw_upload_tes_prog(struct brw_context *brw,
|
|||
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),
|
||||
|
|
|
@ -345,8 +345,7 @@ brw_vs_populate_key(struct brw_context *brw,
|
|||
}
|
||||
|
||||
/* _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,
|
||||
|
|
|
@ -306,17 +306,16 @@ gen6_gather_workaround(GLenum internalformat)
|
|||
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;
|
||||
|
||||
while (mask) {
|
||||
const int s = u_bit_scan(&mask);
|
||||
|
||||
for (int s = 0; s < sampler_count; s++) {
|
||||
key->swizzles[s] = SWIZZLE_NOOP;
|
||||
|
||||
if (!(prog->SamplersUsed & (1 << s)))
|
||||
continue;
|
||||
|
||||
int unit_id = prog->SamplerUnits[s];
|
||||
const struct gl_texture_unit *unit = &ctx->Texture.Unit[unit_id];
|
||||
|
||||
|
@ -506,8 +505,7 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key)
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue