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

Author: Charmaine Lee <charmai...@vmware.com>
Date:   Fri May 11 11:21:52 2018 -0700

svga: fix incompatible bind flags at buffer validation time

At buffer resource validation time, if the resource handle is not yet
created and if the initial buffer bind flags and the tobind flags are
incompatible, just use the tobind flags to create the resource handle.
On the other hand, if the bind flags are compatible, we can combine
the bind flags for the resource handle creation.

Fixes piglit gl-3.1-buffer-bindings crash.

Reviewed-by: Brian Paul <bri...@vmware.com>

---

 src/gallium/drivers/svga/svga_resource_buffer_upload.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_resource_buffer_upload.c 
b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
index 104cb6dbd2..9daae9c0f4 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer_upload.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer_upload.c
@@ -1003,9 +1003,14 @@ svga_buffer_handle(struct svga_context *svga, struct 
pipe_resource *buf,
             return NULL;
       }
    } else {
-      if (!sbuf->bind_flags) {
+      /* If there is no resource handle yet, then combine the buffer bind
+       * flags and the tobind_flags if they are compatible.
+       * If not, just use the tobind_flags for creating the resource handle.
+       */
+      if (compatible_bind_flags(sbuf->bind_flags, tobind_flags))
+         sbuf->bind_flags = sbuf->bind_flags | tobind_flags;
+      else
          sbuf->bind_flags = tobind_flags;
-      }
 
       assert((sbuf->bind_flags & tobind_flags) == tobind_flags);
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to