Fixes crash in piglit's gl-3.1-vao-broken-attrib.

Signed-off-by: Rhys Perry <pendingchao...@gmail.com>
---
 src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index f2393cb27b..86a8bebc25 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -972,7 +972,13 @@ nvc0_set_vertex_buffers(struct pipe_context *pipe,
     for (i = 0; i < count; ++i) {
        unsigned dst_index = start_slot + i;
 
-       if (vb[i].is_user_buffer) {
+       /* user buffers without any data are treated as resource buffers
+        * without a resource
+        */
+       if (vb[i].is_user_buffer && !vb[i].buffer.user)
+          nvc0->vtxbuf[i].is_user_buffer = false;
+
+       if (nvc0->vtxbuf[i].is_user_buffer) {
           nvc0->vbo_user |= 1 << dst_index;
           if (!vb[i].stride && nvc0->screen->eng3d->oclass < GM107_3D_CLASS)
              nvc0->constant_vbos |= 1 << dst_index;
-- 
2.17.1

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

Reply via email to