Mesa (10.3): nv50,nvc0: actually check constbufs for invalidation

Emil Velikov evelikov at kemper.freedesktop.org
Mon Nov 24 00:50:50 UTC 2014


Module: Mesa
Branch: 10.3
Commit: e9518d8f30bfbff7afcef743c452541e4eccb789
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e9518d8f30bfbff7afcef743c452541e4eccb789

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Mon Oct 13 23:50:17 2014 -0400

nv50,nvc0: actually check constbufs for invalidation

The number of vertex buffers has nothing to do with the number of bound
constbufs.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: "10.4 10.3" <mesa-stable at lists.freedesktop.org>
(cherry picked from commit e80a0a7d9a02fe12dedfb2e221358af620759c28)

---

 src/gallium/drivers/nouveau/nv50/nv50_context.c |    5 +++--
 src/gallium/drivers/nouveau/nvc0/nvc0_context.c |    4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index c2eb0c0..6f69bc3 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -222,8 +222,9 @@ nv50_invalidate_resource_storage(struct nouveau_context *ctx,
 
    if (res->bind & PIPE_BIND_CONSTANT_BUFFER) {
       for (s = 0; s < 3; ++s) {
-      assert(nv50->num_vtxbufs <= NV50_MAX_PIPE_CONSTBUFS);
-      for (i = 0; i < nv50->num_vtxbufs; ++i) {
+      for (i = 0; i < NV50_MAX_PIPE_CONSTBUFS; ++i) {
+         if (!(nv50->constbuf_valid[s] & (1 << i)))
+            continue;
          if (!nv50->constbuf[s][i].user &&
              nv50->constbuf[s][i].u.buf == res) {
             nv50->dirty |= NV50_NEW_CONSTBUF;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
index 5928c99..c68e5f1 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
@@ -240,7 +240,9 @@ nvc0_invalidate_resource_storage(struct nouveau_context *ctx,
 
    if (res->bind & PIPE_BIND_CONSTANT_BUFFER) {
       for (s = 0; s < 5; ++s) {
-      for (i = 0; i < nvc0->num_vtxbufs; ++i) {
+      for (i = 0; i < NVC0_MAX_PIPE_CONSTBUFS; ++i) {
+         if (!(nvc0->constbuf_valid[s] & (1 << i)))
+            continue;
          if (!nvc0->constbuf[s][i].user &&
              nvc0->constbuf[s][i].u.buf == res) {
             nvc0->dirty |= NVC0_NEW_CONSTBUF;




More information about the mesa-commit mailing list