aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-06-30 15:47:00 +0000
committerBrian Paul <[email protected]>2002-06-30 15:47:00 +0000
commit2525bc7d305f6dcab3beb75535da25a488c969b0 (patch)
tree3c70b05a2c7e8649b89d68c2b7d5c1dd2c48095b /src/mesa/main
parent1074d8c3613bb44f12ed5dc28aec4fd7fdd79f19 (diff)
Implemented GL_EXT_multi_draw_arrays: glMultiDrawArraysEXT() and glMultiDrawElementsEXT().
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/dlist.c26
-rw-r--r--src/mesa/main/glprocs.h2
-rw-r--r--src/mesa/main/state.c6
-rw-r--r--src/mesa/main/varray.c40
-rw-r--r--src/mesa/main/varray.h11
5 files changed, 81 insertions, 4 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 1409f0ee420..07687e4dab7 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 <table> 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 433910af441..b98c25dc313 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 52cec5a0af3..27e7e0017ad 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 e9138693664..3fd318e7d4c 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! <sigh> */
+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 b2f18667cd1..cf114cda8a9 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