Mesa (master): vc4: Add support for ARB_draw_elements_base_vertex.

Eric Anholt anholt at kemper.freedesktop.org
Tue Jul 28 05:54:34 UTC 2015


Module: Mesa
Branch: master
Commit: 7850774f2118ae87c7e6a4f6c17751e405edfb34
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7850774f2118ae87c7e6a4f6c17751e405edfb34

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jul 22 12:14:40 2015 -0700

vc4: Add support for ARB_draw_elements_base_vertex.

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 |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index fc3c232..1c7f3b1 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -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);




More information about the mesa-commit mailing list