From: Brian Paul Date: Wed, 19 Mar 2008 22:41:54 +0000 (-0600) Subject: gallium: fix bug in cso_single_sampler_done() in computation of nr_samplers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b45669283fe4b9af9f2e78ac3c0c84207cf63775;p=mesa.git gallium: fix bug in cso_single_sampler_done() in computation of nr_samplers Need to find highest used sampler so search from end toward beginning. --- diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 53d05ae6ce0..01fe2164478 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -217,9 +217,11 @@ void cso_single_sampler_done( struct cso_context *ctx ) { unsigned i; - for (i = 0; i < 8; i++) - if (ctx->samplers[i] == NULL) + /* find highest non-null sampler */ + for (i = PIPE_MAX_SAMPLERS; i > 0; i--) { + if (ctx->samplers[i - 1] != NULL) break; + } ctx->nr_samplers = i;