mesa: Implement CreateVertexArrays
[mesa.git] / src / mesa / vbo / vbo_exec_array.c
index 854dec8e7c815f6cc2f31cbde27a772ca97179fd..3ea775c0e4a5b092288863708dd1f88dd051e840 100644 (file)
@@ -26,6 +26,7 @@
  * 
  **************************************************************************/
 
+#include <stdio.h>
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/state.h"
@@ -36,6 +37,8 @@
 #include "main/enums.h"
 #include "main/macros.h"
 #include "main/transformfeedback.h"
+#include "main/sse_minmax.h"
+#include "x86/common_x86_asm.h"
 
 #include "vbo_context.h"
 
@@ -53,7 +56,7 @@ check_buffers_are_unmapped(const struct gl_client_array **inputs)
    for (i = 0; i < VERT_ATTRIB_MAX; i++) {
       if (inputs[i]) {
          struct gl_buffer_object *obj = inputs[i]->BufferObj;
-         assert(!_mesa_bufferobj_mapped(obj));
+         assert(!_mesa_check_disallowed_mapping(obj));
          (void) obj;
       }
    }
@@ -73,7 +76,7 @@ vbo_check_buffers_are_unmapped(struct gl_context *ctx)
    /* check the current vertex arrays */
    check_buffers_are_unmapped(exec->array.inputs);
    /* check the current glBegin/glVertex/glEnd-style VBO */
-   assert(!_mesa_bufferobj_mapped(exec->vtx.bufferobj));
+   assert(!_mesa_check_disallowed_mapping(exec->vtx.bufferobj));
 }
 
 
@@ -101,7 +104,8 @@ vbo_get_minmax_index(struct gl_context *ctx,
    if (_mesa_is_bufferobj(ib->obj)) {
       GLsizeiptr size = MIN2(count * index_size, ib->obj->Size);
       indices = ctx->Driver.MapBufferRange(ctx, (GLintptr) indices, size,
-                                           GL_MAP_READ_BIT, ib->obj);
+                                           GL_MAP_READ_BIT, ib->obj,
+                                           MAP_INTERNAL);
    }
 
    switch (ib->type) {
@@ -118,10 +122,16 @@ vbo_get_minmax_index(struct gl_context *ctx,
          }
       }
       else {
-         for (i = 0; i < count; i++) {
-            if (ui_indices[i] > max_ui) max_ui = ui_indices[i];
-            if (ui_indices[i] < min_ui) min_ui = ui_indices[i];
+#if defined(USE_SSE41)
+         if (cpu_has_sse4_1) {
+            _mesa_uint_array_min_max(ui_indices, &min_ui, &max_ui, count);
          }
+         else
+#endif
+            for (i = 0; i < count; i++) {
+               if (ui_indices[i] > max_ui) max_ui = ui_indices[i];
+               if (ui_indices[i] < min_ui) min_ui = ui_indices[i];
+            }
       }
       *min_index = min_ui;
       *max_index = max_ui;
@@ -172,12 +182,11 @@ vbo_get_minmax_index(struct gl_context *ctx,
       break;
    }
    default:
-      assert(0);
-      break;
+      unreachable("not reached");
    }
 
    if (_mesa_is_bufferobj(ib->obj)) {
-      ctx->Driver.UnmapBuffer(ctx, ib->obj);
+      ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
    }
 }
 
@@ -229,13 +238,15 @@ check_array_data(struct gl_context *ctx, struct gl_client_array *array,
    if (array->Enabled) {
       const void *data = array->Ptr;
       if (_mesa_is_bufferobj(array->BufferObj)) {
-         if (!array->BufferObj->Pointer) {
+         if (!array->BufferObj->Mappings[MAP_INTERNAL].Pointer) {
             /* need to map now */
-            array->BufferObj->Pointer =
+            array->BufferObj->Mappings[MAP_INTERNAL].Pointer =
                ctx->Driver.MapBufferRange(ctx, 0, array->BufferObj->Size,
-                                         GL_MAP_READ_BIT, array->BufferObj);
+                                         GL_MAP_READ_BIT, array->BufferObj,
+                                          MAP_INTERNAL);
          }
-         data = ADD_POINTERS(data, array->BufferObj->Pointer);
+         data = ADD_POINTERS(data,
+                             array->BufferObj->Mappings[MAP_INTERNAL].Pointer);
       }
       switch (array->Type) {
       case GL_FLOAT:
@@ -273,8 +284,8 @@ unmap_array_buffer(struct gl_context *ctx, struct gl_client_array *array)
 {
    if (array->Enabled &&
        _mesa_is_bufferobj(array->BufferObj) &&
-       _mesa_bufferobj_mapped(array->BufferObj)) {
-      ctx->Driver.UnmapBuffer(ctx, array->BufferObj);
+       _mesa_bufferobj_mapped(array->BufferObj, MAP_INTERNAL)) {
+      ctx->Driver.UnmapBuffer(ctx, array->BufferObj, MAP_INTERNAL);
    }
 }
 
@@ -287,15 +298,17 @@ static void
 check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
                          const void *elements, GLint basevertex)
 {
-   struct gl_array_object *vao = ctx->Array.VAO;
+   struct gl_vertex_array_object *vao = ctx->Array.VAO;
    const void *elemMap;
-   GLint i, k;
+   GLint i;
+   GLuint k;
 
-   if (_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj)) {
+   if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) {
       elemMap = ctx->Driver.MapBufferRange(ctx, 0,
-                                          ctx->Array.VAO->ElementArrayBufferObj->Size,
+                                          ctx->Array.VAO->IndexBufferObj->Size,
                                           GL_MAP_READ_BIT,
-                                          ctx->Array.VAO->ElementArrayBufferObj);
+                                          ctx->Array.VAO->IndexBufferObj,
+                                           MAP_INTERNAL);
       elements = ADD_POINTERS(elements, elemMap);
    }
 
@@ -318,16 +331,17 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
       }
 
       /* check element j of each enabled array */
-      for (k = 0; k < Elements(vao->_VertexAttrib); k++) {
+      for (k = 0; k < ARRAY_SIZE(vao->_VertexAttrib); k++) {
          check_array_data(ctx, &vao->_VertexAttrib[k], k, j);
       }
    }
 
-   if (_mesa_is_bufferobj(vao->ElementArrayBufferObj)) {
-      ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->ElementArrayBufferObj);
+   if (_mesa_is_bufferobj(vao->IndexBufferObj)) {
+      ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->IndexBufferObj,
+                              MAP_INTERNAL);
    }
 
-   for (k = 0; k < Elements(vao->_VertexAttrib); k++) {
+   for (k = 0; k < ARRAY_SIZE(vao->_VertexAttrib); k++) {
       unmap_array_buffer(ctx, &vao->_VertexAttrib[k]);
    }
 }
@@ -352,7 +366,7 @@ print_draw_arrays(struct gl_context *ctx,
 {
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_exec_context *exec = &vbo->exec;
-   struct gl_array_object *vao = ctx->Array.VAO;
+   struct gl_vertex_array_object *vao = ctx->Array.VAO;
    int i;
 
    printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n",
@@ -374,7 +388,8 @@ print_draw_arrays(struct gl_context *ctx,
 
       if (bufName) {
          GLubyte *p = ctx->Driver.MapBufferRange(ctx, 0, bufObj->Size,
-                                                GL_MAP_READ_BIT, bufObj);
+                                                GL_MAP_READ_BIT, bufObj,
+                                                 MAP_INTERNAL);
          int offset = (int) (GLintptr) exec->array.inputs[i]->Ptr;
          float *f = (float *) (p + offset);
          int *k = (int *) f;
@@ -386,7 +401,7 @@ print_draw_arrays(struct gl_context *ctx,
          for (i = 0; i < n; i++) {
             printf("    float[%d] = 0x%08x %f\n", i, k[i], f[i]);
          }
-         ctx->Driver.UnmapBuffer(ctx, bufObj);
+         ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_INTERNAL);
       }
    }
 }
@@ -556,38 +571,6 @@ vbo_bind_arrays(struct gl_context *ctx)
    }
 }
 
-
-/**
- * Handle a draw case that potentially has primitive restart enabled.
- *
- * If primitive restart is enabled, and PrimitiveRestartInSoftware is
- * set, then vbo_sw_primitive_restart is used to handle the primitive
- * restart case in software.
- */
-static void
-vbo_handle_primitive_restart(struct gl_context *ctx,
-                             const struct _mesa_prim *prim,
-                             GLuint nr_prims,
-                             const struct _mesa_index_buffer *ib,
-                             GLboolean index_bounds_valid,
-                             GLuint min_index,
-                             GLuint max_index)
-{
-   struct vbo_context *vbo = vbo_context(ctx);
-
-   if ((ib != NULL) &&
-       ctx->Const.PrimitiveRestartInSoftware &&
-       ctx->Array._PrimitiveRestart) {
-      /* Handle primitive restart in software */
-      vbo_sw_primitive_restart(ctx, prim, nr_prims, ib, NULL);
-   } else {
-      /* Call driver directly for draw_prims */
-      vbo->draw_prims(ctx, prim, nr_prims, ib,
-                      index_bounds_valid, min_index, max_index, NULL, NULL);
-   }
-}
-
-
 /**
  * Helper function called by the other DrawArrays() functions below.
  * This is where we handle primitive restart for drawing non-indexed
@@ -614,7 +597,8 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
    prim[0].is_indirect = 0;
 
    /* Implement the primitive restart index */
-   if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
+   if (ctx->Array.PrimitiveRestart && !ctx->Array.PrimitiveRestartFixedIndex &&
+       ctx->Array.RestartIndex < count) {
       GLuint primCount = 0;
 
       if (ctx->Array.RestartIndex == start) {
@@ -804,7 +788,7 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
       _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n",
                   _mesa_lookup_enum_by_nr(mode), start, count);
 
-   if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
+   if (!_mesa_validate_DrawArrays(ctx, mode, count))
       return;
 
    if (0)
@@ -883,15 +867,16 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
 {
    const GLvoid *map =
       ctx->Driver.MapBufferRange(ctx, 0,
-                                ctx->Array.VAO->ElementArrayBufferObj->Size,
+                                ctx->Array.VAO->IndexBufferObj->Size,
                                 GL_MAP_READ_BIT,
-                                ctx->Array.VAO->ElementArrayBufferObj);
+                                 ctx->Array.VAO->IndexBufferObj,
+                                 MAP_INTERNAL);
    switch (type) {
    case GL_UNSIGNED_BYTE:
       {
          const GLubyte *us = (const GLubyte *) map;
          GLint i;
-         for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size; i++) {
+         for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size; i++) {
             printf("%02x ", us[i]);
             if (i % 32 == 31)
                printf("\n");
@@ -903,7 +888,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
       {
          const GLushort *us = (const GLushort *) map;
          GLint i;
-         for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size / 2; i++) {
+         for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size / 2; i++) {
             printf("%04x ", us[i]);
             if (i % 16 == 15)
                printf("\n");
@@ -915,7 +900,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
       {
          const GLuint *us = (const GLuint *) map;
          GLint i;
-         for (i = 0; i < ctx->Array.VAO->ElementArrayBufferObj->Size / 4; i++) {
+         for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size / 4; i++) {
             printf("%08x ", us[i]);
             if (i % 8 == 7)
                printf("\n");
@@ -927,7 +912,8 @@ dump_element_buffer(struct gl_context *ctx, GLenum type)
       ;
    }
 
-   ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->ElementArrayBufferObj);
+   ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->IndexBufferObj,
+                           MAP_INTERNAL);
 }
 #endif
 
@@ -955,7 +941,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
 
    ib.count = count;
    ib.type = type;
-   ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+   ib.obj = ctx->Array.VAO->IndexBufferObj;
    ib.ptr = indices;
 
    prim[0].begin = 1;
@@ -1003,8 +989,8 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
     */
 
    check_buffers_are_unmapped(exec->array.inputs);
-   vbo_handle_primitive_restart(ctx, prim, 1, &ib,
-                                index_bounds_valid, start, end);
+   vbo->draw_prims(ctx, prim, 1, &ib,
+                   index_bounds_valid, start, end, NULL, NULL);
 
    if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
       _mesa_flush(ctx);
@@ -1024,7 +1010,12 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
 {
    static GLuint warnCount = 0;
    GLboolean index_bounds_valid = GL_TRUE;
-   GLuint max_element;
+
+   /* This is only useful to catch invalid values in the "end" parameter
+    * like ~0.
+    */
+   GLuint max_element = 2 * 1000 * 1000 * 1000; /* just a big number */
+
    GET_CURRENT_CONTEXT(ctx);
 
    if (MESA_VERBOSE & VERBOSE_DRAW)
@@ -1033,29 +1024,10 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
                 _mesa_lookup_enum_by_nr(mode), start, end, count,
                 _mesa_lookup_enum_by_nr(type), indices, basevertex);
 
-   if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
-                                          type, indices, basevertex ))
+   if (!_mesa_validate_DrawRangeElements(ctx, mode, start, end, count,
+                                         type, indices))
       return;
 
-   if (ctx->Const.CheckArrayBounds) {
-      /* _MaxElement was computed, so we can use it.
-       * This path is used for drivers which need strict bounds checking.
-       */
-      max_element = ctx->Array.VAO->_MaxElement;
-   }
-   else {
-      /* Generally, hardware drivers don't need to know the buffer bounds
-       * if all vertex attributes are in VBOs.
-       * However, if none of vertex attributes are in VBOs, _MaxElement
-       * is always set to some random big number anyway, so bounds checking
-       * is mostly useless.
-       *
-       * This is only useful to catch invalid values in the "end" parameter
-       * like ~0.
-       */
-      max_element = 2 * 1000 * 1000 * 1000; /* just a big number */
-   }
-
    if ((int) end + basevertex < 0 ||
        start + basevertex >= max_element) {
       /* The application requested we draw using a range of indices that's
@@ -1097,7 +1069,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
             "(start %u, end %u, type 0x%x, count %d) ElemBuf %u, "
             "base %d\n",
             start, end, type, count,
-            ctx->Array.VAO->ElementArrayBufferObj->Name,
+            ctx->Array.VAO->IndexBufferObj->Name,
             basevertex);
    }
 
@@ -1150,7 +1122,7 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
                   _mesa_lookup_enum_by_nr(mode), count,
                   _mesa_lookup_enum_by_nr(type), indices);
 
-   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
+   if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
@@ -1172,8 +1144,7 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
                   _mesa_lookup_enum_by_nr(mode), count,
                   _mesa_lookup_enum_by_nr(type), indices, basevertex);
 
-   if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
-                                    basevertex ))
+   if (!_mesa_validate_DrawElements(ctx, mode, count, type, indices))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
@@ -1196,7 +1167,7 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
                   _mesa_lookup_enum_by_nr(type), indices, numInstances);
 
    if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
-                                             numInstances, 0))
+                                             numInstances))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
@@ -1221,7 +1192,7 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type
                   numInstances, basevertex);
 
    if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
-                                             numInstances, basevertex))
+                                             numInstances))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
@@ -1246,7 +1217,7 @@ vbo_exec_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum ty
                   numInstances, baseInstance);
 
    if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
-                                             numInstances, 0))
+                                             numInstances))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
@@ -1272,7 +1243,7 @@ vbo_exec_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count,
                   numInstances, basevertex, baseInstance);
 
    if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
-                                             numInstances, basevertex))
+                                             numInstances))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
@@ -1305,7 +1276,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
    if (primcount == 0)
       return;
 
-   prim = calloc(1, primcount * sizeof(*prim));
+   prim = calloc(primcount, sizeof(*prim));
    if (prim == NULL) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
       return;
@@ -1350,13 +1321,13 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
     * subranges of the index buffer as one large index buffer may lead to
     * us reading unmapped memory.
     */
-   if (!_mesa_is_bufferobj(ctx->Array.VAO->ElementArrayBufferObj))
+   if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj))
       fallback = GL_TRUE;
 
    if (!fallback) {
       ib.count = (max_index_ptr - min_index_ptr) / index_type_size;
       ib.type = type;
-      ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+      ib.obj = ctx->Array.VAO->IndexBufferObj;
       ib.ptr = (void *)min_index_ptr;
 
       for (i = 0; i < primcount; i++) {
@@ -1378,8 +1349,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
       }
 
       check_buffers_are_unmapped(exec->array.inputs);
-      vbo_handle_primitive_restart(ctx, prim, primcount, &ib,
-                                   GL_FALSE, ~0, ~0);
+      vbo->draw_prims(ctx, prim, primcount, &ib,
+                      false, ~0, ~0, NULL, NULL);
    } else {
       /* render one prim at a time */
       for (i = 0; i < primcount; i++) {
@@ -1387,7 +1358,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
            continue;
         ib.count = count[i];
         ib.type = type;
-        ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+        ib.obj = ctx->Array.VAO->IndexBufferObj;
         ib.ptr = indices[i];
 
         prim[0].begin = 1;
@@ -1407,8 +1378,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
            prim[0].basevertex = 0;
 
          check_buffers_are_unmapped(exec->array.inputs);
-         vbo_handle_primitive_restart(ctx, prim, 1, &ib,
-                                      GL_FALSE, ~0, ~0);
+         vbo->draw_prims(ctx, prim, 1, &ib,
+                         false, ~0, ~0, NULL, NULL);
       }
    }
 
@@ -1429,7 +1400,7 @@ vbo_exec_MultiDrawElements(GLenum mode,
    GET_CURRENT_CONTEXT(ctx);
 
    if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
-                                         primcount, NULL))
+                                         primcount))
       return;
 
    vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
@@ -1447,7 +1418,7 @@ vbo_exec_MultiDrawElementsBaseVertex(GLenum mode,
    GET_CURRENT_CONTEXT(ctx);
 
    if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
-                                         primcount, basevertex))
+                                         primcount))
       return;
 
    vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
@@ -1470,8 +1441,6 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
 
    if (ctx->Driver.GetTransformFeedbackVertexCount &&
        (ctx->Const.AlwaysUseGetTransformFeedbackVertexCount ||
-        (ctx->Const.PrimitiveRestartInSoftware &&
-         ctx->Array._PrimitiveRestart) ||
         !vbo_all_varyings_in_vbos(exec->array.inputs))) {
       GLsizei n = ctx->Driver.GetTransformFeedbackVertexCount(ctx, obj, stream);
       vbo_draw_arrays(ctx, mode, 0, n, numInstances, 0);
@@ -1657,7 +1626,7 @@ vbo_validated_drawelementsindirect(struct gl_context *ctx,
 
    ib.count = 0; /* unknown */
    ib.type = type;
-   ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+   ib.obj = ctx->Array.VAO->IndexBufferObj;
    ib.ptr = NULL;
 
    memset(prim, 0, sizeof(prim));
@@ -1701,11 +1670,11 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx,
 
    vbo_bind_arrays(ctx);
 
-   /* NOTE: ElementArrayBufferObj is guaranteed to be a VBO. */
+   /* NOTE: IndexBufferObj is guaranteed to be a VBO. */
 
    ib.count = 0; /* unknown */
    ib.type = type;
-   ib.obj = ctx->Array.VAO->ElementArrayBufferObj;
+   ib.obj = ctx->Array.VAO->IndexBufferObj;
    ib.ptr = NULL;
 
    prim[0].begin = 1;
@@ -1882,6 +1851,12 @@ _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count)
    vbo_exec_DrawArrays(mode, first, count);
 }
 
+void GLAPIENTRY
+_mesa_DrawArraysInstanced(GLenum mode, GLint first, GLsizei count,
+                          GLsizei primcount)
+{
+   vbo_exec_DrawArraysInstanced(mode, first, count, primcount);
+}
 
 void GLAPIENTRY
 _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,