gallium/u_vbuf: support NULL-resources
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 6 Mar 2019 12:29:35 +0000 (13:29 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 29 Apr 2019 10:28:38 +0000 (10:28 +0000)
It's legal for a buffer-object to have a NULL-resource, but let's just
skip over it, as there's nothing to do.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/auxiliary/util/u_vbuf.c

index 02a59bc057570254627dcd09d840585b296cb2ef..200bfffbd392e55758e1dc54508ecca6bcb26334 100644 (file)
@@ -418,6 +418,9 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
          unsigned size = vb->stride ? num_vertices * vb->stride
                                     : sizeof(double)*4;
 
+         if (!vb->buffer.resource)
+            continue;
+
          if (offset + size > vb->buffer.resource->width0) {
             /* Don't try to map past end of buffer.  This often happens when
              * we're translating an attribute that's at offset > 0 from the