From 2525bc7d305f6dcab3beb75535da25a488c969b0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 30 Jun 2002 15:47:00 +0000 Subject: Implemented GL_EXT_multi_draw_arrays: glMultiDrawArraysEXT() and glMultiDrawElementsEXT(). --- src/mesa/main/dlist.c | 26 +++++++++++++++++++++++++- src/mesa/main/glprocs.h | 2 ++ src/mesa/main/state.c | 6 +++++- src/mesa/main/varray.c | 40 +++++++++++++++++++++++++++++++++++++++- src/mesa/main/varray.h | 11 ++++++++++- 5 files changed, 81 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 1409f0ee42..07687e4dab 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,4 +1,4 @@ -/* $Id: dlist.c,v 1.91 2002/06/29 19:48:15 brianp Exp $ */ +/* $Id: dlist.c,v 1.92 2002/06/30 15:47:00 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -5725,6 +5725,26 @@ static void exec_FogCoordPointerEXT(GLenum type, GLsizei stride, ctx->Exec->FogCoordPointerEXT( type, stride, ptr); } +/* GL_EXT_multi_draw_arrays */ +static void exec_MultiDrawArraysEXT(GLenum mode, GLint *first, + GLsizei *count, GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->MultiDrawArraysEXT( mode, first, count, primcount ); +} + +/* GL_EXT_multi_draw_arrays */ +static void exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, + GLenum type, const GLvoid **indices, + GLsizei primcount) +{ + GET_CURRENT_CONTEXT(ctx); + FLUSH_VERTICES(ctx, 0); + ctx->Exec->MultiDrawElementsEXT(mode, count, type, indices, primcount); +} + + /* * Assign all the pointers in to point to Mesa's display list @@ -6045,6 +6065,10 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) /* 145. GL_EXT_secondary_color */ table->SecondaryColorPointerEXT = exec_SecondaryColorPointerEXT; + /* 148. GL_EXT_multi_draw_arrays */ + table->MultiDrawArraysEXT = exec_MultiDrawArraysEXT; + table->MultiDrawElementsEXT = exec_MultiDrawElementsEXT; + /* 149. GL_EXT_fog_coord */ table->FogCoordPointerEXT = exec_FogCoordPointerEXT; diff --git a/src/mesa/main/glprocs.h b/src/mesa/main/glprocs.h index 433910af44..b98c25dc31 100644 --- a/src/mesa/main/glprocs.h +++ b/src/mesa/main/glprocs.h @@ -619,6 +619,8 @@ static struct name_address_offset static_functions[] = { { "glSecondaryColor3usEXT", (GLvoid *) glSecondaryColor3usEXT, _gloffset_SecondaryColor3usEXT }, { "glSecondaryColor3usvEXT", (GLvoid *) glSecondaryColor3usvEXT, _gloffset_SecondaryColor3usvEXT }, { "glSecondaryColorPointerEXT", (GLvoid *) glSecondaryColorPointerEXT, _gloffset_SecondaryColorPointerEXT }, + { "glMultiDrawArraysEXT", (GLvoid *) glMultiDrawArraysEXT, _gloffset_MultiDrawArraysEXT }, + { "glMultiDrawElementsEXT", (GLvoid *) glMultiDrawElementsEXT, _gloffset_MultiDrawElementsEXT }, { "glFogCoordfEXT", (GLvoid *) glFogCoordfEXT, _gloffset_FogCoordfEXT }, { "glFogCoordfvEXT", (GLvoid *) glFogCoordfvEXT, _gloffset_FogCoordfvEXT }, { "glFogCoorddEXT", (GLvoid *) glFogCoorddEXT, _gloffset_FogCoorddEXT }, diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 52cec5a0af..27e7e0017a 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -1,4 +1,4 @@ -/* $Id: state.c,v 1.87 2002/06/25 02:31:37 brianp Exp $ */ +/* $Id: state.c,v 1.88 2002/06/30 15:47:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -425,6 +425,10 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) exec->LockArraysEXT = _mesa_LockArraysEXT; exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; + /* 148. GL_EXT_multi_draw_arrays */ + exec->MultiDrawArraysEXT = _mesa_MultiDrawArraysEXT; + exec->MultiDrawElementsEXT = _mesa_MultiDrawElementsEXT; + /* 173. GL_INGR_blend_func_separate */ exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index e913869366..3fd318e7d4 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1,4 +1,4 @@ -/* $Id: varray.c,v 1.45 2002/06/15 02:38:16 brianp Exp $ */ +/* $Id: varray.c,v 1.46 2002/06/30 15:47:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -799,3 +799,41 @@ _mesa_UnlockArraysEXT( void ) if (ctx->Driver.UnlockArraysEXT) ctx->Driver.UnlockArraysEXT( ctx ); } + + + +/* GL_EXT_multi_draw_arrays */ +/* Somebody forgot to spec the first and count parameters as const! */ +void +_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, + GLsizei *count, GLsizei primcount ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + (ctx->Exec->DrawArrays)(mode, first[i], count[i]); + } + } +} + + +/* GL_EXT_multi_draw_arrays */ +void +_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + (ctx->Exec->DrawElements)(mode, count[i], type, indices[i]); + } + } +} diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index b2f18667cd..cf114cda8a 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -1,4 +1,4 @@ -/* $Id: varray.h,v 1.13 2002/01/11 17:25:35 brianp Exp $ */ +/* $Id: varray.h,v 1.14 2002/06/30 15:47:01 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -111,4 +111,13 @@ extern void _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer); +extern void +_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first, + GLsizei *count, GLsizei primcount ); + +extern void +_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount ); + + #endif -- cgit v1.2.3