summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 610ef345f42..e51381b855f 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -341,7 +341,10 @@ brw_upload_samplers(struct brw_context *brw)
GLbitfield SamplersUsed = vs->SamplersUsed | fs->SamplersUsed;
- brw->sampler.count = _mesa_bitcount(SamplersUsed);
+ /* ARB programs use the texture unit number as the sampler index, so we
+ * need to find the highest unit used. A bit-count will not work.
+ */
+ brw->sampler.count = _mesa_fls(SamplersUsed);
if (brw->sampler.count == 0)
return;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index eefa427f1a5..582e2399a15 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -1250,7 +1250,7 @@ brw_update_texture_surfaces(struct brw_context *brw)
struct gl_program *vs = (struct gl_program *) brw->vertex_program;
struct gl_program *fs = (struct gl_program *) brw->fragment_program;
- unsigned num_samplers = _mesa_bitcount(vs->SamplersUsed | fs->SamplersUsed);
+ unsigned num_samplers = _mesa_fls(vs->SamplersUsed | fs->SamplersUsed);
for (unsigned s = 0; s < num_samplers; s++) {
brw->vs.surf_offset[SURF_INDEX_VS_TEXTURE(s)] = 0;