diff options
author | Eric Anholt <eric@anholt.net> | 2013-02-13 21:21:45 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2013-02-17 14:12:47 -0800 |
commit | c785315f3d6b957c6124ce9efafdd47c8d8526a6 (patch) | |
tree | 8c52783962d89cf2cb825561b1398d23f1bb2def | |
parent | 0e3c755ca3b0bcb1fa83fa82165f008f4d1dfafd (diff) | |
download | mesa-c785315f3d6b957c6124ce9efafdd47c8d8526a6.tar.gz |
i965/gen7: Set up all samplers even if samplers are sparsely used.
In GLSL, sampler indices are allocated contiguously from 0. But in the
case of ARB_fragment_program (and possibly fixed function), an app that
uses texture 0 and 2 will use sampler indices 0 and 2, so we were only
allocating space for samplers 0 and 1 and setting up sampler 0. We
would read garbage for sampler 2, resulting in flickering textures and
an angry simulator.
Fixes bad rendering in 0 A.D. and ETQW. This was fixed for pre-gen7 by
28f4be9eb91b12a2c6b1db6660cca71a98c486ec
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25201
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58680
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
NOTE: This is a candidate for stable branches.
(cherry picked from commit 5bb05c6e6d596d66c177e42a36128d2ca2e300aa)
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_sampler_state.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c index 6f0a757380b..1fb947f80c8 100644 --- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c @@ -196,7 +196,7 @@ gen7_upload_samplers(struct brw_context *brw) GLbitfield SamplersUsed = vs->SamplersUsed | fs->SamplersUsed; - brw->sampler.count = _mesa_bitcount(SamplersUsed); + brw->sampler.count = _mesa_fls(SamplersUsed); if (brw->sampler.count == 0) return; |