gallium: fix bug in cso_single_sampler_done() in computation of nr_samplers
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 19 Mar 2008 22:41:54 +0000 (16:41 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 19 Mar 2008 23:15:14 +0000 (17:15 -0600)
Need to find highest used sampler so search from end toward beginning.

src/gallium/auxiliary/cso_cache/cso_context.c

index 53d05ae..01fe216 100644 (file)
@@ -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;