summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/cso_cache
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-03-19 16:41:54 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-03-19 17:15:14 -0600
commitb45669283fe4b9af9f2e78ac3c0c84207cf63775 (patch)
tree62662f550355d2ed789bd0f3bbe800ddc76e2d1e /src/gallium/auxiliary/cso_cache
parentdf5ba799fa929d4c739be9d11d3f1000afc265b2 (diff)
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.
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 53d05ae6ce..01fe216447 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;