[Mesa-dev] [PATCH] i965/gen7: Set up all samplers even if samplers are sparsely used.
Kenneth Graunke
kenneth at whitecape.org
Thu Feb 14 14:05:32 PST 2013
On 02/14/2013 09:08 AM, Eric Anholt wrote:
> 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
> NOTE: This is a candidate for stable branches.
> ---
>
> OK, since we've screwed this up twice in our driver (and we've screwed
> it up in other drivers too, long ago), I'm going to make sure we've
> got a piglit test before I push this.
>
>
> src/mesa/drivers/dri/i965/gen7_sampler_state.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
> index 6f0a757..1fb947f 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;
Damn. Forgot to fix this in the Gen7 code.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list