From: Mathias Fröhlich Date: Mon, 29 Oct 2018 05:13:20 +0000 (+0100) Subject: mesa: Collect all the draw functions in draw.{h,c}. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ad52e19408c1b830dc059bda84443341f6b4e65c;p=mesa.git mesa: Collect all the draw functions in draw.{h,c}. Some of these functions were distributed across different implementation and header files. Put them at a central place. Reviewed-by: Brian Paul Signed-off-by: Mathias Fröhlich --- diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 056a181c17b..4392c4bbd88 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -42,6 +42,7 @@ #include "main/buffers.h" #include "main/clear.h" #include "main/condrender.h" +#include "main/draw.h" #include "main/depth.h" #include "main/enable.h" #include "main/fbobject.h" diff --git a/src/mesa/main/draw.c b/src/mesa/main/draw.c index 85a9eedbc32..cceadf2613a 100644 --- a/src/mesa/main/draw.c +++ b/src/mesa/main/draw.c @@ -2146,6 +2146,49 @@ _mesa_DrawTransformFeedback(GLenum mode, GLuint name) } +/* GL_IBM_multimode_draw_arrays */ +void GLAPIENTRY +_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, + const GLsizei * count, + GLsizei primcount, GLint modestride ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + FLUSH_VERTICES(ctx, 0); + + for ( i = 0 ; i < primcount ; i++ ) { + if ( count[i] > 0 ) { + GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride)); + CALL_DrawArrays(ctx->CurrentServerDispatch, ( m, first[i], count[i] )); + } + } +} + + +/* GL_IBM_multimode_draw_arrays */ +void GLAPIENTRY +_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, + GLenum type, const GLvoid * const * indices, + GLsizei primcount, GLint modestride ) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + FLUSH_VERTICES(ctx, 0); + + /* XXX not sure about ARB_vertex_buffer_object handling here */ + + for ( i = 0 ; i < primcount ; i++ ) { + if ( count[i] > 0 ) { + GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride)); + CALL_DrawElements(ctx->CurrentServerDispatch, ( m, count[i], type, + indices[i] )); + } + } +} + + /* * Helper function for _mesa_draw_indirect below that additionally takes a zero * initialized array of _mesa_prim scratch space memory as the last argument. diff --git a/src/mesa/main/draw.h b/src/mesa/main/draw.h index 57b3ec9e7db..76d54f48222 100644 --- a/src/mesa/main/draw.h +++ b/src/mesa/main/draw.h @@ -87,6 +87,71 @@ _mesa_draw_indirect(struct gl_context *ctx, GLuint mode, const struct _mesa_index_buffer *ib); +void GLAPIENTRY +_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count); + + +void GLAPIENTRY +_mesa_DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, + GLsizei primcount); + + +void GLAPIENTRY +_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); + + +void GLAPIENTRY +_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, + GLenum type, const GLvoid *indices); + + +void GLAPIENTRY +_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices, GLint basevertex); + + +void GLAPIENTRY +_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices, + GLint basevertex); + + +void GLAPIENTRY +_mesa_DrawTransformFeedback(GLenum mode, GLuint name); + + + +void GLAPIENTRY +_mesa_MultiDrawArrays(GLenum mode, const GLint *first, + const GLsizei *count, GLsizei primcount); + + +void GLAPIENTRY +_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount); + + +void GLAPIENTRY +_mesa_MultiDrawElementsBaseVertex(GLenum mode, + const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount, + const GLint *basevertex); + + +void GLAPIENTRY +_mesa_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first, + const GLsizei * count, + GLsizei primcount, GLint modestride); + + +void GLAPIENTRY +_mesa_MultiModeDrawElementsIBM(const GLenum * mode, const GLsizei * count, + GLenum type, const GLvoid * const * indices, + GLsizei primcount, GLint modestride); + + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index a3e1aebb76c..2e27a16a99b 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1905,49 +1905,6 @@ _mesa_UnlockArraysEXT( void ) } -/* GL_IBM_multimode_draw_arrays */ -void GLAPIENTRY -_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first, - const GLsizei * count, - GLsizei primcount, GLint modestride ) -{ - GET_CURRENT_CONTEXT(ctx); - GLint i; - - FLUSH_VERTICES(ctx, 0); - - for ( i = 0 ; i < primcount ; i++ ) { - if ( count[i] > 0 ) { - GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride)); - CALL_DrawArrays(ctx->CurrentServerDispatch, ( m, first[i], count[i] )); - } - } -} - - -/* GL_IBM_multimode_draw_arrays */ -void GLAPIENTRY -_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count, - GLenum type, const GLvoid * const * indices, - GLsizei primcount, GLint modestride ) -{ - GET_CURRENT_CONTEXT(ctx); - GLint i; - - FLUSH_VERTICES(ctx, 0); - - /* XXX not sure about ARB_vertex_buffer_object handling here */ - - for ( i = 0 ; i < primcount ; i++ ) { - if ( count[i] > 0 ) { - GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride)); - CALL_DrawElements(ctx->CurrentServerDispatch, ( m, count[i], type, - indices[i] )); - } - } -} - - static void primitive_restart_index(struct gl_context *ctx, GLuint index) { diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h index a901bf9171d..a2477a7c6fe 100644 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@ -270,31 +270,6 @@ extern void GLAPIENTRY _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer); -extern void GLAPIENTRY -_mesa_MultiDrawArrays(GLenum mode, const GLint *first, - const GLsizei *count, GLsizei primcount); - -extern void GLAPIENTRY -_mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, - const GLvoid **indices, GLsizei primcount); - -extern void GLAPIENTRY -_mesa_MultiDrawElementsBaseVertex(GLenum mode, - const GLsizei *count, GLenum type, - const GLvoid **indices, GLsizei primcount, - const GLint *basevertex); - -extern void GLAPIENTRY -_mesa_MultiModeDrawArraysIBM(const GLenum * mode, const GLint * first, - const GLsizei * count, - GLsizei primcount, GLint modestride ); - - -extern void GLAPIENTRY -_mesa_MultiModeDrawElementsIBM(const GLenum * mode, const GLsizei * count, - GLenum type, const GLvoid * const * indices, - GLsizei primcount, GLint modestride ); - extern void GLAPIENTRY _mesa_LockArraysEXT(GLint first, GLsizei count); @@ -302,34 +277,6 @@ extern void GLAPIENTRY _mesa_UnlockArraysEXT(void); -extern void GLAPIENTRY -_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count); - -extern void GLAPIENTRY -_mesa_DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, - GLsizei primcount); - -extern void GLAPIENTRY -_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices); - -extern void GLAPIENTRY -_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, - GLenum type, const GLvoid *indices); - -extern void GLAPIENTRY -_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, - const GLvoid *indices, GLint basevertex); - -extern void GLAPIENTRY -_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid *indices, - GLint basevertex); - -extern void GLAPIENTRY -_mesa_DrawTransformFeedback(GLenum mode, GLuint name); - void GLAPIENTRY _mesa_PrimitiveRestartIndex_no_error(GLuint index);