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

Author: Ilia Mirkin <[email protected]>
Date:   Sat Nov 15 15:43:22 2014 -0500

nv50,nvc0: buffer resources can be bound as other things down the line

res->bind is not an indicator of how the resource is currently bound.
buffers can be rebound across different binding points without changing
underlying storage.

Signed-off-by: Ilia Mirkin <[email protected]>
Cc: "10.4 10.3" <[email protected]>
(cherry picked from commit fecae4625cf9a132bb3fbfeaadbbf3db68be6024)

---

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

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_context.c 
b/src/gallium/drivers/nouveau/nv50/nv50_context.c
index 6f69bc3..91298e3 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_context.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_context.c
@@ -188,7 +188,12 @@ nv50_invalidate_resource_storage(struct nouveau_context 
*ctx,
       }
    }
 
-   if (res->bind & PIPE_BIND_VERTEX_BUFFER) {
+   if (res->bind & (PIPE_BIND_VERTEX_BUFFER |
+                    PIPE_BIND_INDEX_BUFFER |
+                    PIPE_BIND_CONSTANT_BUFFER |
+                    PIPE_BIND_STREAM_OUTPUT |
+                    PIPE_BIND_SAMPLER_VIEW)) {
+
       assert(nv50->num_vtxbufs <= PIPE_MAX_ATTRIBS);
       for (i = 0; i < nv50->num_vtxbufs; ++i) {
          if (nv50->vtxbuf[i].buffer == res) {
@@ -198,14 +203,11 @@ nv50_invalidate_resource_storage(struct nouveau_context 
*ctx,
                return ref;
          }
       }
-   }
-   if (res->bind & PIPE_BIND_INDEX_BUFFER) {
+
       if (nv50->idxbuf.buffer == res)
          if (!--ref)
             return ref;
-   }
 
-   if (res->bind & PIPE_BIND_SAMPLER_VIEW) {
       for (s = 0; s < 3; ++s) {
       assert(nv50->num_textures[s] <= PIPE_MAX_SAMPLERS);
       for (i = 0; i < nv50->num_textures[s]; ++i) {
@@ -218,9 +220,7 @@ nv50_invalidate_resource_storage(struct nouveau_context 
*ctx,
          }
       }
       }
-   }
 
-   if (res->bind & PIPE_BIND_CONSTANT_BUFFER) {
       for (s = 0; s < 3; ++s) {
       for (i = 0; i < NV50_MAX_PIPE_CONSTBUFS; ++i) {
          if (!(nv50->constbuf_valid[s] & (1 << i)))
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
index c68e5f1..5816cf9 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
@@ -204,7 +204,12 @@ nvc0_invalidate_resource_storage(struct nouveau_context 
*ctx,
       }
    }
 
-   if (res->bind & PIPE_BIND_VERTEX_BUFFER) {
+   if (res->bind & (PIPE_BIND_VERTEX_BUFFER |
+                    PIPE_BIND_INDEX_BUFFER |
+                    PIPE_BIND_CONSTANT_BUFFER |
+                    PIPE_BIND_STREAM_OUTPUT |
+                    PIPE_BIND_COMMAND_ARGS_BUFFER |
+                    PIPE_BIND_SAMPLER_VIEW)) {
       for (i = 0; i < nvc0->num_vtxbufs; ++i) {
          if (nvc0->vtxbuf[i].buffer == res) {
             nvc0->dirty |= NVC0_NEW_ARRAYS;
@@ -213,17 +218,14 @@ nvc0_invalidate_resource_storage(struct nouveau_context 
*ctx,
                return ref;
          }
       }
-   }
-   if (res->bind & PIPE_BIND_INDEX_BUFFER) {
+
       if (nvc0->idxbuf.buffer == res) {
          nvc0->dirty |= NVC0_NEW_IDXBUF;
          nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_IDX);
          if (!--ref)
             return ref;
       }
-   }
 
-   if (res->bind & PIPE_BIND_SAMPLER_VIEW) {
       for (s = 0; s < 5; ++s) {
       for (i = 0; i < nvc0->num_textures[s]; ++i) {
          if (nvc0->textures[s][i] &&
@@ -236,9 +238,7 @@ 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_MAX_PIPE_CONSTBUFS; ++i) {
          if (!(nvc0->constbuf_valid[s] & (1 << i)))

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to