[Mesa-dev] [PATCH 14/14] mesa: Collect all the draw functions in draw.{h, c}.

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Tue Oct 30 05:07:25 UTC 2018


From: Mathias Fröhlich <mathias.froehlich at web.de>

Some of these functions were distributed across different
implementation and header files. Put them at a central place.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
---
 src/mesa/drivers/common/meta.c |  1 +
 src/mesa/main/draw.c           | 43 ++++++++++++++++++++++
 src/mesa/main/draw.h           | 65 ++++++++++++++++++++++++++++++++++
 src/mesa/main/varray.c         | 43 ----------------------
 src/mesa/main/varray.h         | 53 ---------------------------
 5 files changed, 109 insertions(+), 96 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 056a181c17..4392c4bbd8 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 85a9eedbc3..cceadf2613 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 57b3ec9e7d..76d54f4822 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 a3e1aebb76..2e27a16a99 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 a901bf9171..a2477a7c6f 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);
 
-- 
2.17.2



More information about the mesa-dev mailing list