i915: support NULL-resources
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 6 Mar 2019 12:28:24 +0000 (13:28 +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>
src/gallium/drivers/i915/i915_context.c

index 8ea944003f24687d4d219ce9e09b62715bafe81b..f5116b80043ac10134bf5e5174ad0e74ac85195a 100644 (file)
@@ -75,8 +75,11 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
    for (i = 0; i < i915->nr_vertex_buffers; i++) {
       const void *buf = i915->vertex_buffers[i].is_user_buffer ?
                            i915->vertex_buffers[i].buffer.user : NULL;
-      if (!buf)
-            buf = i915_buffer(i915->vertex_buffers[i].buffer.resource)->data;
+      if (!buf) {
+         if (!i915->vertex_buffers[i].buffer.resource)
+            continue;
+         buf = i915_buffer(i915->vertex_buffers[i].buffer.resource)->data;
+      }
       draw_set_mapped_vertex_buffer(draw, i, buf, ~0);
    }