nv50: zero out unbound samplers
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 30 Aug 2014 17:35:47 +0000 (13:35 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Mon, 1 Sep 2014 22:38:02 +0000 (18:38 -0400)
Samplers are only defined up to num_samplers, so set all samplers above
nr to NULL so that we don't try to read them again later.

Tested-by: Christian Ruppert <idl0r@qasl.de>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2 10.3" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/nv50/nv50_state.c

index 48bc07974a239a81ca33810414597b9b5f064784..cf84f88666221be636f5e22b49472d1b9fc5bf41 100644 (file)
@@ -585,9 +585,12 @@ nv50_stage_sampler_states_bind(struct nv50_context *nv50, int s,
          nv50_screen_tsc_unlock(nv50->screen, old);
    }
    assert(nv50->num_samplers[s] <= PIPE_MAX_SAMPLERS);
-   for (; i < nv50->num_samplers[s]; ++i)
-      if (nv50->samplers[s][i])
+   for (; i < nv50->num_samplers[s]; ++i) {
+      if (nv50->samplers[s][i]) {
          nv50_screen_tsc_unlock(nv50->screen, nv50->samplers[s][i]);
+         nv50->samplers[s][i] = NULL;
+      }
+   }
 
    nv50->num_samplers[s] = nr;