Mesa (master): nv50: zero out unbound samplers

Ilia Mirkin imirkin at kemper.freedesktop.org
Mon Sep 1 22:44:24 UTC 2014


Module: Mesa
Branch: master
Commit: 362cd26960aff2e997584064443dcc0418516ae6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=362cd26960aff2e997584064443dcc0418516ae6

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sat Aug 30 13:35:47 2014 -0400

nv50: zero out unbound samplers

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 at qasl.de>
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: "10.2 10.3" <mesa-stable at lists.freedesktop.org>

---

 src/gallium/drivers/nouveau/nv50/nv50_state.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c
index 48bc079..cf84f88 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
@@ -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;
 




More information about the mesa-commit mailing list