summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_rebase.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2009-08-27 10:09:24 -0700
committerEric Anholt <[email protected]>2009-09-08 15:12:20 -0700
commit92d7ed8a20d4a018ce5324e6537ae7b478b9e5bf (patch)
treedb04f9d7c60b1cd174c93fbe112f00058c85e092 /src/mesa/vbo/vbo_rebase.c
parentec9e7295800aff0f04815de736127101f770033f (diff)
mesa: Add support for ARB_draw_elements_base_vertex.
Diffstat (limited to 'src/mesa/vbo/vbo_rebase.c')
-rw-r--r--src/mesa/vbo/vbo_rebase.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c
index 3bf7ef580fc..799a25fc1cb 100644
--- a/src/mesa/vbo/vbo_rebase.c
+++ b/src/mesa/vbo/vbo_rebase.c
@@ -126,7 +126,20 @@ void vbo_rebase_prims( GLcontext *ctx,
if (0)
_mesa_printf("%s %d..%d\n", __FUNCTION__, min_index, max_index);
- if (ib) {
+
+ if (ib && ctx->Extensions.ARB_draw_elements_base_vertex) {
+ /* If we can just tell the hardware or the TNL to interpret our
+ * indices with a different base, do so.
+ */
+ tmp_prims = (struct _mesa_prim *)_mesa_malloc(sizeof(*prim) * nr_prims);
+
+ for (i = 0; i < nr_prims; i++) {
+ tmp_prims[i] = prim[i];
+ tmp_prims[i].basevertex -= min_index;
+ }
+
+ prim = tmp_prims;
+ } else if (ib) {
/* Unfortunately need to adjust each index individually.
*/
GLboolean map_ib = ib->obj->Name && !ib->obj->Pointer;