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>
Acked-by: Karol Herbst <kherbst@redhat.com>
const struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i];
const uint8_t *data;
- if (unlikely(!vb->is_user_buffer))
+ if (unlikely(!vb->is_user_buffer)) {
+ if (!vb->buffer.resource)
+ continue;
+
data = nouveau_resource_map_offset(&nv50->base,
nv04_resource(vb->buffer.resource), vb->buffer_offset, NOUVEAU_BO_RD);
- else
+ } else
data = vb->buffer.user;
if (apply_bias && likely(!(nv50->vertex->instance_bufs & (1 << i))))
if (likely(vb->is_user_buffer))
map = (const uint8_t *)vb->buffer.user;
- else
+ else {
+ if (!vb->buffer.resource)
+ continue;
+
map = nouveau_resource_map_offset(&nvc0->base,
nv04_resource(vb->buffer.resource), vb->buffer_offset, NOUVEAU_BO_RD);
+ }
if (index_bias && !unlikely(nvc0->vertex->instance_bufs & (1 << i)))
map += (intptr_t)index_bias * vb->stride;