*/
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;
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 (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);
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;
+
+ FLUSH_CURRENT(ctx, 0);
+
+ if (!_mesa_valid_to_render(ctx, "glDrawArraysInstancedBaseInstance"))
+ 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.
GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid *indices,
- GLint basevertex, GLint numInstances)
+ GLint basevertex, GLint numInstances,
+ GLuint baseInstance)
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
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
#endif
vbo_validated_drawrangeelements(ctx, mode, index_bounds_valid, start, end,
- count, type, indices, basevertex, 1);
+ count, type, indices, basevertex, 1, 0);
}
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, 0, 1);
+ count, type, indices, 0, 1, 0);
}
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, basevertex, 1);
+ count, type, indices, basevertex, 1, 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.
*/
return;
vbo_validated_drawrangeelements(ctx, mode, GL_FALSE, ~0, ~0,
- count, type, indices, basevertex, numInstances);
+ 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,
+ baseInstance);
}
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
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].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
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;
+ exec->vtxfmt.DrawElementsInstancedBaseVertexBaseInstance = vbo_exec_DrawElementsInstancedBaseVertexBaseInstance;
#if FEATURE_EXT_transform_feedback
exec->vtxfmt.DrawTransformFeedback = vbo_exec_DrawTransformFeedback;
#endif