intel: Transition intel_region_map() to being a miptree operation.
[mesa.git] / src / mesa / vbo / vbo_exec_array.c
index 6c8a32e64520e883c25d4a7d8655a6487183f7c2..7e61f7b31fdae5fbdbd5a878deb5221291d9c399 100644 (file)
@@ -90,8 +90,8 @@ vbo_get_minmax_index(struct gl_context *ctx,
                     GLuint *min_index, GLuint *max_index,
                     const GLuint count)
 {
-   const GLboolean restart = ctx->Array.PrimitiveRestart;
-   const GLuint restartIndex = ctx->Array.RestartIndex;
+   const GLboolean restart = ctx->Array._PrimitiveRestart;
+   const GLuint restartIndex = ctx->Array._RestartIndex;
    const int index_size = vbo_sizeof_ib_type(ib->type);
    const char *indices;
    GLuint i;
@@ -440,32 +440,6 @@ recalculate_input_bindings(struct gl_context *ctx)
       }
       break;
 
-   case VP_NV:
-      /* NV_vertex_program - attribute arrays alias and override
-       * conventional, legacy arrays.  No materials, and the generic
-       * slots are vacant.
-       */
-      for (i = 0; i < VERT_ATTRIB_FF_MAX; i++) {
-        if (i < VERT_ATTRIB_GENERIC_MAX
-             && vertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
-           inputs[i] = &vertexAttrib[VERT_ATTRIB_GENERIC(i)];
-        else if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
-           inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
-        else {
-           inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i];
-            const_inputs |= VERT_BIT_FF(i);
-         }
-      }
-
-      /* Could use just about anything, just to fill in the empty
-       * slots:
-       */
-      for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
-        inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
-         const_inputs |= VERT_BIT_GENERIC(i);
-      }
-      break;
-
    case VP_ARB:
       /* GL_ARB_vertex_program or GLSL vertex shader - Only the generic[0]
        * attribute array aliases and overrides the legacy position array.  
@@ -506,7 +480,7 @@ recalculate_input_bindings(struct gl_context *ctx)
    }
 
    _mesa_set_varying_vp_inputs( ctx, VERT_BIT_ALL & (~const_inputs) );
-   ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
+   ctx->NewDriverState |= ctx->DriverFlags.NewArray;
 }
 
 
@@ -542,6 +516,37 @@ 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);
+   } else {
+      /* Call driver directly for draw_prims */
+      vbo->draw_prims(ctx, prim, nr_prims, ib,
+                      index_bounds_valid, min_index, max_index, NULL);
+   }
+}
+
+
 /**
  * Helper function called by the other DrawArrays() functions below.
  * This is where we handle primitive restart for drawing non-indexed
@@ -550,7 +555,7 @@ vbo_bind_arrays(struct gl_context *ctx)
  */
 static void
 vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
-                GLsizei count, GLuint numInstances)
+                GLsizei count, GLuint numInstances, GLuint baseInstance)
 {
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_exec_context *exec = &vbo->exec;
@@ -564,12 +569,13 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
    prim[0].end = 1;
    prim[0].mode = mode;
    prim[0].num_instances = numInstances;
+   prim[0].base_instance = baseInstance;
 
    /* Implement the primitive restart index */
-   if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
+   if (ctx->Array._PrimitiveRestart && ctx->Array._RestartIndex < count) {
       GLuint primCount = 0;
 
-      if (ctx->Array.RestartIndex == start) {
+      if (ctx->Array._RestartIndex == start) {
          /* special case: RestartIndex at beginning */
          if (count > 1) {
             prim[0].start = start + 1;
@@ -577,7 +583,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
             primCount = 1;
          }
       }
-      else if (ctx->Array.RestartIndex == start + count - 1) {
+      else if (ctx->Array._RestartIndex == start + count - 1) {
          /* special case: RestartIndex at end */
          if (count > 1) {
             prim[0].start = start;
@@ -588,10 +594,10 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
       else {
          /* general case: RestartIndex in middle, split into two prims */
          prim[0].start = start;
-         prim[0].count = ctx->Array.RestartIndex - start;
+         prim[0].count = ctx->Array._RestartIndex - start;
 
          prim[1] = prim[0];
-         prim[1].start = ctx->Array.RestartIndex + 1;
+         prim[1].start = ctx->Array._RestartIndex + 1;
          prim[1].count = count - prim[1].start;
 
          primCount = 2;
@@ -600,7 +606,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
       if (primCount > 0) {
          /* draw one or two prims */
          check_buffers_are_unmapped(exec->array.inputs);
-         vbo->draw_prims(ctx, exec->array.inputs, prim, primCount, NULL,
+         vbo->draw_prims(ctx, prim, primCount, NULL,
                          GL_TRUE, start, start + count - 1, NULL);
       }
    }
@@ -610,10 +616,14 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
       prim[0].count = count;
 
       check_buffers_are_unmapped(exec->array.inputs);
-      vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL,
+      vbo->draw_prims(ctx, prim, 1, NULL,
                       GL_TRUE, start, start + count - 1,
                       NULL);
    }
+
+   if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
+      _mesa_flush(ctx);
+   }
 }
 
 
@@ -630,15 +640,13 @@ 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);
 
-   FLUSH_CURRENT(ctx, 0);
-
    if (!_mesa_validate_DrawArrays( ctx, mode, start, count ))
       return;
 
    if (0)
       check_draw_arrays_data(ctx, start, count);
 
-   vbo_draw_arrays(ctx, mode, start, count, 1);
+   vbo_draw_arrays(ctx, mode, start, count, 1, 0);
 
    if (0)
       print_draw_arrays(ctx, mode, start, count);
@@ -659,21 +667,48 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
       _mesa_debug(ctx, "glDrawArraysInstanced(%s, %d, %d, %d)\n",
                   _mesa_lookup_enum_by_nr(mode), start, count, numInstances);
 
-   FLUSH_CURRENT(ctx, 0);
-
    if (!_mesa_validate_DrawArraysInstanced(ctx, mode, start, count, numInstances))
       return;
 
    if (0)
       check_draw_arrays_data(ctx, start, count);
 
-   vbo_draw_arrays(ctx, mode, start, count, numInstances);
+   vbo_draw_arrays(ctx, mode, start, count, numInstances, 0);
 
    if (0)
       print_draw_arrays(ctx, mode, start, count);
 }
 
 
+/**
+ * Called from glDrawArraysInstancedBaseInstance when in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawArraysInstancedBaseInstance(GLenum mode, GLint first, GLsizei count,
+                                         GLsizei numInstances, GLuint baseInstance)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawArraysInstancedBaseInstance(%s, %d, %d, %d, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), first, count,
+                  numInstances, baseInstance);
+
+   if (!_mesa_validate_DrawArraysInstanced(ctx, mode, first, count,
+                                           numInstances))
+      return;
+
+   if (0)
+      check_draw_arrays_data(ctx, first, count);
+
+   vbo_draw_arrays(ctx, mode, first, count, numInstances, baseInstance);
+
+   if (0)
+      print_draw_arrays(ctx, mode, first, count);
+}
+
+
+
 /**
  * Map GL_ELEMENT_ARRAY_BUFFER and print contents.
  * For debugging.
@@ -744,7 +779,8 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
                                GLuint start, GLuint end,
                                GLsizei count, GLenum type,
                                const GLvoid *indices,
-                               GLint basevertex, GLint numInstances)
+                               GLint basevertex, GLuint numInstances,
+                               GLuint baseInstance)
 {
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_exec_context *exec = &vbo->exec;
@@ -768,6 +804,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
    prim[0].indexed = 1;
    prim[0].basevertex = basevertex;
    prim[0].num_instances = numInstances;
+   prim[0].base_instance = baseInstance;
 
    /* Need to give special consideration to rendering a range of
     * indices starting somewhere above zero.  Typically the
@@ -801,8 +838,12 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
     */
 
    check_buffers_are_unmapped(exec->array.inputs);
-   vbo->draw_prims( ctx, exec->array.inputs, prim, 1, &ib,
-                   index_bounds_valid, start, end, NULL );
+   vbo_handle_primitive_restart(ctx, prim, 1, &ib,
+                                index_bounds_valid, start, end);
+
+   if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
+      _mesa_flush(ctx);
+   }
 }
 
 
@@ -826,8 +867,6 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
                 _mesa_lookup_enum_by_nr(mode), start, end, count,
                 _mesa_lookup_enum_by_nr(type), indices, basevertex);
 
-   FLUSH_CURRENT(ctx, 0);
-
    if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count,
                                           type, indices, basevertex ))
       return;
@@ -888,7 +927,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode,
 #endif
 
    vbo_validated_drawrangeelements(ctx, mode, index_bounds_valid, start, end,
-                                  count, type, indices, basevertex, 1);
+                                  count, type, indices, basevertex, 1, 0);
 }
 
 
@@ -926,13 +965,11 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type,
                   _mesa_lookup_enum_by_nr(mode), count,
                   _mesa_lookup_enum_by_nr(type), indices);
 
-   FLUSH_CURRENT(ctx, 0);
-
    if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 ))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
-                                  count, type, indices, 0, 1);
+                                  count, type, indices, 0, 1, 0);
 }
 
 
@@ -950,14 +987,12 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
                   _mesa_lookup_enum_by_nr(mode), count,
                   _mesa_lookup_enum_by_nr(type), indices, basevertex);
 
-   FLUSH_CURRENT(ctx, 0);
-
    if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices,
                                     basevertex ))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
-                                  count, type, indices, basevertex, 1);
+                                  count, type, indices, basevertex, 1, 0);
 }
 
 
@@ -975,16 +1010,15 @@ vbo_exec_DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
                   _mesa_lookup_enum_by_nr(mode), count,
                   _mesa_lookup_enum_by_nr(type), indices, numInstances);
 
-   FLUSH_CURRENT(ctx, 0);
-
    if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
                                              numInstances, 0))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
-                                  count, type, indices, 0, numInstances);
+                                  count, type, indices, 0, numInstances, 0);
 }
 
+
 /**
  * Called by glDrawElementsInstancedBaseVertex() in immediate mode.
  */
@@ -1001,14 +1035,64 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type
                   _mesa_lookup_enum_by_nr(type), indices,
                   numInstances, basevertex);
 
-   FLUSH_CURRENT(ctx, 0);
+   if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
+                                             numInstances, basevertex))
+      return;
+
+   vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+                                  count, type, indices, basevertex, numInstances, 0);
+}
+
+
+/**
+ * Called by glDrawElementsInstancedBaseInstance() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type,
+                                           const GLvoid *indices, GLsizei numInstances,
+                                           GLuint baseInstance)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawElementsInstancedBaseInstance(%s, %d, %s, %p, %d, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), count,
+                  _mesa_lookup_enum_by_nr(type), indices,
+                  numInstances, baseInstance);
+
+   if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
+                                             numInstances, 0))
+      return;
+
+   vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
+                                   count, type, indices, 0, numInstances,
+                                   baseInstance);
+}
+
+
+/**
+ * Called by glDrawElementsInstancedBaseVertexBaseInstance() in immediate mode.
+ */
+static void GLAPIENTRY
+vbo_exec_DrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type,
+                                                     const GLvoid *indices, GLsizei numInstances,
+                                                     GLint basevertex, GLuint baseInstance)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawElementsInstancedBaseVertexBaseInstance(%s, %d, %s, %p, %d, %d, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), count,
+                  _mesa_lookup_enum_by_nr(type), indices,
+                  numInstances, basevertex, baseInstance);
 
    if (!_mesa_validate_DrawElementsInstanced(ctx, mode, count, type, indices,
                                              numInstances, basevertex))
       return;
 
    vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
-                                  count, type, indices, basevertex, numInstances);
+                                   count, type, indices, basevertex, numInstances,
+                                   baseInstance);
 }
 
 
@@ -1020,7 +1104,8 @@ vbo_exec_DrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type
 static void
 vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
                                const GLsizei *count, GLenum type,
-                               const GLvoid **indices, GLsizei primcount,
+                               const GLvoid * const *indices,
+                               GLsizei primcount,
                                const GLint *basevertex)
 {
    struct vbo_context *vbo = vbo_context(ctx);
@@ -1089,6 +1174,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
         prim[i].count = count[i];
         prim[i].indexed = 1;
          prim[i].num_instances = 1;
+         prim[i].base_instance = 0;
         if (basevertex != NULL)
            prim[i].basevertex = basevertex[i];
         else
@@ -1096,8 +1182,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
       }
 
       check_buffers_are_unmapped(exec->array.inputs);
-      vbo->draw_prims(ctx, exec->array.inputs, prim, primcount, &ib,
-                     GL_FALSE, ~0, ~0, NULL);
+      vbo_handle_primitive_restart(ctx, prim, primcount, &ib,
+                                   GL_FALSE, ~0, ~0);
    } else {
       /* render one prim at a time */
       for (i = 0; i < primcount; i++) {
@@ -1115,18 +1201,23 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
         prim[0].count = count[i];
         prim[0].indexed = 1;
          prim[0].num_instances = 1;
+         prim[0].base_instance = 0;
         if (basevertex != NULL)
            prim[0].basevertex = basevertex[i];
         else
            prim[0].basevertex = 0;
 
          check_buffers_are_unmapped(exec->array.inputs);
-         vbo->draw_prims(ctx, exec->array.inputs, prim, 1, &ib,
-                         GL_FALSE, ~0, ~0, NULL);
+         vbo_handle_primitive_restart(ctx, prim, 1, &ib,
+                                      GL_FALSE, ~0, ~0);
       }
    }
 
    free(prim);
+
+   if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
+      _mesa_flush(ctx);
+   }
 }
 
 
@@ -1137,15 +1228,10 @@ vbo_exec_MultiDrawElements(GLenum mode,
                           GLsizei primcount)
 {
    GET_CURRENT_CONTEXT(ctx);
-   GLint i;
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   for (i = 0; i < primcount; i++) {
-      if (!_mesa_validate_DrawElements(ctx, mode, count[i], type, indices[i],
-                                      0))
-        return;
-   }
+   if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
+                                         primcount, NULL))
+      return;
 
    vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
                                   NULL);
@@ -1155,36 +1241,34 @@ vbo_exec_MultiDrawElements(GLenum mode,
 static void GLAPIENTRY
 vbo_exec_MultiDrawElementsBaseVertex(GLenum mode,
                                     const GLsizei *count, GLenum type,
-                                    const GLvoid **indices,
+                                    const GLvoid * const *indices,
                                     GLsizei primcount,
                                     const GLsizei *basevertex)
 {
    GET_CURRENT_CONTEXT(ctx);
-   GLint i;
-
-   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   for (i = 0; i < primcount; i++) {
-      if (!_mesa_validate_DrawElements(ctx, mode, count[i], type, indices[i],
-                                      basevertex[i]))
-        return;
-   }
+   if (!_mesa_validate_MultiDrawElements(ctx, mode, count, type, indices,
+                                         primcount, basevertex))
+      return;
 
    vbo_validated_multidrawelements(ctx, mode, count, type, indices, primcount,
                                   basevertex);
 }
 
-#if FEATURE_EXT_transform_feedback
-
 static void
 vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
                             struct gl_transform_feedback_object *obj,
-                            GLuint numInstances)
+                            GLuint stream, GLuint numInstances)
 {
    struct vbo_context *vbo = vbo_context(ctx);
    struct vbo_exec_context *exec = &vbo->exec;
    struct _mesa_prim prim[2];
 
+   if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj, stream,
+                                             numInstances)) {
+      return;
+   }
+
    vbo_bind_arrays(ctx);
 
    /* init most fields to zero */
@@ -1193,14 +1277,19 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
    prim[0].end = 1;
    prim[0].mode = mode;
    prim[0].num_instances = numInstances;
+   prim[0].base_instance = 0;
 
    /* Maybe we should do some primitive splitting for primitive restart
     * (like in DrawArrays), but we have no way to know how many vertices
     * will be rendered. */
 
    check_buffers_are_unmapped(exec->array.inputs);
-   vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL,
+   vbo->draw_prims(ctx, prim, 1, NULL,
                    GL_TRUE, 0, 0, obj);
+
+   if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
+      _mesa_flush(ctx);
+   }
 }
 
 /**
@@ -1222,16 +1311,53 @@ vbo_exec_DrawTransformFeedback(GLenum mode, GLuint name)
       _mesa_debug(ctx, "glDrawTransformFeedback(%s, %d)\n",
                   _mesa_lookup_enum_by_nr(mode), name);
 
-   FLUSH_CURRENT(ctx, 0);
+   vbo_draw_transform_feedback(ctx, mode, obj, 0, 1);
+}
 
-   if (!_mesa_validate_DrawTransformFeedback(ctx, mode, obj)) {
-      return;
-   }
+static void GLAPIENTRY
+vbo_exec_DrawTransformFeedbackStream(GLenum mode, GLuint name, GLuint stream)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_transform_feedback_object *obj =
+      _mesa_lookup_transform_feedback_object(ctx, name);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawTransformFeedbackStream(%s, %u, %u)\n",
+                  _mesa_lookup_enum_by_nr(mode), name, stream);
 
-   vbo_draw_transform_feedback(ctx, mode, obj, 1);
+   vbo_draw_transform_feedback(ctx, mode, obj, stream, 1);
 }
 
-#endif
+static void GLAPIENTRY
+vbo_exec_DrawTransformFeedbackInstanced(GLenum mode, GLuint name,
+                                        GLsizei primcount)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_transform_feedback_object *obj =
+      _mesa_lookup_transform_feedback_object(ctx, name);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawTransformFeedbackInstanced(%s, %d)\n",
+                  _mesa_lookup_enum_by_nr(mode), name);
+
+   vbo_draw_transform_feedback(ctx, mode, obj, 0, primcount);
+}
+
+static void GLAPIENTRY
+vbo_exec_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
+                                              GLuint stream, GLsizei primcount)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   struct gl_transform_feedback_object *obj =
+      _mesa_lookup_transform_feedback_object(ctx, name);
+
+   if (MESA_VERBOSE & VERBOSE_DRAW)
+      _mesa_debug(ctx, "glDrawTransformFeedbackStreamInstanced"
+                  "(%s, %u, %u, %i)\n",
+                  _mesa_lookup_enum_by_nr(mode), name, stream, primcount);
+
+   vbo_draw_transform_feedback(ctx, mode, obj, stream, primcount);
+}
 
 /**
  * Plug in the immediate-mode vertex array drawing commands into the
@@ -1248,11 +1374,18 @@ vbo_exec_array_init( struct vbo_exec_context *exec )
    exec->vtxfmt.DrawRangeElementsBaseVertex = vbo_exec_DrawRangeElementsBaseVertex;
    exec->vtxfmt.MultiDrawElementsBaseVertex = vbo_exec_MultiDrawElementsBaseVertex;
    exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced;
+   exec->vtxfmt.DrawArraysInstancedBaseInstance = vbo_exec_DrawArraysInstancedBaseInstance;
    exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced;
+   exec->vtxfmt.DrawElementsInstancedBaseInstance = vbo_exec_DrawElementsInstancedBaseInstance;
    exec->vtxfmt.DrawElementsInstancedBaseVertex = vbo_exec_DrawElementsInstancedBaseVertex;
-#if FEATURE_EXT_transform_feedback
+   exec->vtxfmt.DrawElementsInstancedBaseVertexBaseInstance = vbo_exec_DrawElementsInstancedBaseVertexBaseInstance;
    exec->vtxfmt.DrawTransformFeedback = vbo_exec_DrawTransformFeedback;
-#endif
+   exec->vtxfmt.DrawTransformFeedbackStream =
+         vbo_exec_DrawTransformFeedbackStream;
+   exec->vtxfmt.DrawTransformFeedbackInstanced =
+         vbo_exec_DrawTransformFeedbackInstanced;
+   exec->vtxfmt.DrawTransformFeedbackStreamInstanced =
+         vbo_exec_DrawTransformFeedbackStreamInstanced;
 }
 
 
@@ -1329,12 +1462,8 @@ _mesa_MultiDrawElementsBaseVertex(GLenum mode,
                                        primcount, basevertex);
 }
 
-#if FEATURE_EXT_transform_feedback
-
 void GLAPIENTRY
 _mesa_DrawTransformFeedback(GLenum mode, GLuint name)
 {
    vbo_exec_DrawTransformFeedback(mode, name);
 }
-
-#endif