summaryrefslogtreecommitdiffstats
path: root/src/mesa
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
parent1074d8c3613bb44f12ed5dc28aec4fd7fdd79f19 (diff)
Implemented GL_EXT_multi_draw_arrays: glMultiDrawArraysEXT() and glMultiDrawElementsEXT().
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/glapi/glapioffsets.h2
-rw-r--r--src/mesa/glapi/glapitable.h2
-rw-r--r--src/mesa/glapi/glapitemp.h14
-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
-rw-r--r--src/mesa/sparc/glapi_sparc.S42
-rw-r--r--src/mesa/x86/glapi_x86.S12
10 files changed, 151 insertions, 6 deletions
diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h
index 2ecf718bbb2..21d70ef2536 100644
--- a/src/mesa/glapi/glapioffsets.h
+++ b/src/mesa/glapi/glapioffsets.h
@@ -646,5 +646,7 @@
#define _gloffset_VertexAttribs4ubvNV 641
#define _gloffset_PointParameteriNV 642
#define _gloffset_PointParameterivNV 643
+#define _gloffset_MultiDrawArraysEXT 644
+#define _gloffset_MultiDrawElementsEXT 645
#endif
diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h
index 2f98e9b1a19..5511863b67b 100644
--- a/src/mesa/glapi/glapitable.h
+++ b/src/mesa/glapi/glapitable.h
@@ -650,6 +650,8 @@ struct _glapi_table
void (*VertexAttribs4ubvNV)(GLuint index, GLsizei n, const GLubyte * v); /* 641 */
void (*PointParameteriNV)(GLenum pname, GLint params); /* 642 */
void (*PointParameterivNV)(GLenum pname, const GLint * params); /* 643 */
+ void (*MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 644 */
+ void (*MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 645 */
};
#endif
diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h
index cf1976e9b8d..0fcb59d6ac1 100644
--- a/src/mesa/glapi/glapitemp.h
+++ b/src/mesa/glapi/glapitemp.h
@@ -3169,8 +3169,16 @@ KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, G
}
/* No dispatch for TextureNormalEXT() */
-/* No dispatch for MultiDrawArraysEXT() */
-/* No dispatch for MultiDrawElementsEXT() */
+KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount)
+{
+ DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArraysEXT(0x%x, %p, %p, %d);\n", mode, (void *) first, (void *) count, primcount));
+}
+
+KEYWORD1 void KEYWORD2 NAME(MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount)
+{
+ DISPATCH(MultiDrawElementsEXT, (mode, count, type, indices, primcount), (F, "glMultiDrawElementsEXT(0x%x, %p, 0x%x, %p, %d);\n", mode, (void *) count, type, (void *) indices, primcount));
+}
+
KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord)
{
DISPATCH(FogCoordfEXT, (coord), (F, "glFogCoordfEXT(%f);\n", coord));
@@ -4611,6 +4619,8 @@ void *DISPATCH_TABLE_NAME[] = {
TABLE_ENTRY(VertexAttribs4ubvNV),
TABLE_ENTRY(PointParameteriNV),
TABLE_ENTRY(PointParameterivNV),
+ TABLE_ENTRY(MultiDrawArraysEXT),
+ TABLE_ENTRY(MultiDrawElementsEXT),
/* A whole bunch of no-op functions. These might be called
* when someone tries to call a dynamically-registered
* extension function without a current rendering context.
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
diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S
index c9bf45b604a..a70b6300ffb 100644
--- a/src/mesa/sparc/glapi_sparc.S
+++ b/src/mesa/sparc/glapi_sparc.S
@@ -12936,6 +12936,48 @@ glSecondaryColorPointerEXT:
jmpl %g3, %g0
nop
+.globl glMultiDrawArraysEXT
+.type glMultiDrawArraysEXT,#function
+glMultiDrawArraysEXT:
+#ifdef __sparc_v9__
+ sethi %hi(0x00000000), %g2
+ sethi %hi(0x00000000), %g1
+ or %g2, %lo(0x00000000), %g2
+ or %g1, %lo(0x00000000), %g1
+ sllx %g2, 32, %g2
+ ldx [%g1 + %g2], %g1
+ sethi %hi(8 * _gloffset_MultiDrawArraysEXT), %g2
+ or %g2, %lo(8 * _gloffset_MultiDrawArraysEXT), %g2
+ ldx [%g1 + %g2], %g3
+#else
+ sethi %hi(0x00000000), %g1
+ ld [%g1 + %lo(0x00000000)], %g1
+ ld [%g1 + (4 * _gloffset_MultiDrawArraysEXT)], %g3
+#endif
+ jmpl %g3, %g0
+ nop
+
+.globl glMultiDrawElementsEXT
+.type glMultiDrawElementsEXT,#function
+glMultiDrawElementsEXT:
+#ifdef __sparc_v9__
+ sethi %hi(0x00000000), %g2
+ sethi %hi(0x00000000), %g1
+ or %g2, %lo(0x00000000), %g2
+ or %g1, %lo(0x00000000), %g1
+ sllx %g2, 32, %g2
+ ldx [%g1 + %g2], %g1
+ sethi %hi(8 * _gloffset_MultiDrawElementsEXT), %g2
+ or %g2, %lo(8 * _gloffset_MultiDrawElementsEXT), %g2
+ ldx [%g1 + %g2], %g3
+#else
+ sethi %hi(0x00000000), %g1
+ ld [%g1 + %lo(0x00000000)], %g1
+ ld [%g1 + (4 * _gloffset_MultiDrawElementsEXT)], %g3
+#endif
+ jmpl %g3, %g0
+ nop
+
.globl glFogCoordfEXT
.type glFogCoordfEXT,#function
glFogCoordfEXT:
diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S
index f99538697a4..7b26f94fea8 100644
--- a/src/mesa/x86/glapi_x86.S
+++ b/src/mesa/x86/glapi_x86.S
@@ -3712,6 +3712,18 @@ GL_PREFIX(SecondaryColorPointerEXT):
JMP(GL_OFFSET(_gloffset_SecondaryColorPointerEXT))
ALIGNTEXT16
+GLOBL_FN(GL_PREFIX(MultiDrawArraysEXT))
+GL_PREFIX(MultiDrawArraysEXT):
+ MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX)
+ JMP(GL_OFFSET(_gloffset_MultiDrawArraysEXT))
+
+ALIGNTEXT16
+GLOBL_FN(GL_PREFIX(MultiDrawElementsEXT))
+GL_PREFIX(MultiDrawElementsEXT):
+ MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX)
+ JMP(GL_OFFSET(_gloffset_MultiDrawElementsEXT))
+
+ALIGNTEXT16
GLOBL_FN(GL_PREFIX(FogCoordfEXT))
GL_PREFIX(FogCoordfEXT):
MOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX)