vc4: Add support for ARB_draw_elements_base_vertex.
authorEric Anholt <eric@anholt.net>
Wed, 22 Jul 2015 19:14:40 +0000 (12:14 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 28 Jul 2015 05:48:20 +0000 (22:48 -0700)
Gallium exposes it unconditionally, so do our best to support it.  It
fails on the negative index cases, but those seem unlikely to be used in
the wild.

src/gallium/drivers/vc4/vc4_draw.c

index fc3c2321abbb1671e8c035479814cde3f6de8ff6..1c7f3b16be30c9a2ea34c00ff7a9ff6ed81eedae 100644 (file)
@@ -201,7 +201,9 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
                 struct pipe_vertex_buffer *vb =
                         &vertexbuf->vb[elem->vertex_buffer_index];
                 struct vc4_resource *rsc = vc4_resource(vb->buffer);
-                uint32_t offset = vb->buffer_offset + elem->src_offset;
+                uint32_t offset = (vb->buffer_offset +
+                                   elem->src_offset +
+                                   vb->stride * info->index_bias);
                 uint32_t vb_size = rsc->bo->size - offset;
                 uint32_t elem_size =
                         util_format_get_blocksize(elem->src_format);