summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-07-05 17:02:46 +1000
committerTimothy Arceri <[email protected]>2016-07-05 20:18:05 +1000
commit8f1ca0ee3ff9e192540325ae42df9577b1ccdf7f (patch)
tree35be50c54070fb0419a83d4d7a92cf8031bdb74c /src/mesa/drivers/dri/i965
parent51f912786f420fcfa50a3d3f1b36794cb2714be2 (diff)
i965: make more effective use of SamplersUsed
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_cs.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_tes.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c3
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c12
7 files changed, 10 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
index 45128bc439a..655adc14622 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -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;
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 1ce74d8b0ef..d9f18c46549 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -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
diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h
index 5874d931623..317fbe2b9f4 100644
--- a/src/mesa/drivers/dri/i965/brw_program.h
+++ b/src/mesa/drivers/dri/i965/brw_program.h
@@ -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,
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index acfd1e5770b..da94bf275c9 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -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;
}
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 001655df872..e14ae865a39 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -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),
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index ec913f0e96c..877bcb59e47 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -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,
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 46839bc526e..7b1b83914ad 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -306,16 +306,15 @@ 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;
- 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];
@@ -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;