summaryrefslogtreecommitdiff
path: root/src/mesa/vbo/vbo_rebase.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/vbo/vbo_rebase.c')
-rw-r--r--src/mesa/vbo/vbo_rebase.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c
index dae778e741..799a25fc1c 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;
@@ -161,7 +174,7 @@ void vbo_rebase_prims( GLcontext *ctx,
GL_ELEMENT_ARRAY_BUFFER,
ib->obj);
- tmp_ib.obj = ctx->Array.NullBufferObj;
+ tmp_ib.obj = ctx->Shared->NullBufferObj;
tmp_ib.ptr = tmp_indices;
tmp_ib.count = ib->count;
tmp_ib.type = ib->type;
@@ -208,6 +221,7 @@ void vbo_rebase_prims( GLcontext *ctx,
prim,
nr_prims,
ib,
+ GL_TRUE,
0,
max_index - min_index );