[Mesa-dev] [PATCH 07/42] mesa: add cull_face() helper

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Jun 27 11:20:10 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/main/polygon.c | 33 ++++++++++++++++++++-------------
 src/mesa/main/polygon.h |  2 +-
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index 03c63628dfc..13dca6d39cf 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -50,19 +50,9 @@
  * change, flushes the vertices and notifies the driver via
  * the dd_function_table::CullFace callback.
  */
-void GLAPIENTRY
-_mesa_CullFace( GLenum mode )
+static void
+cull_face(struct gl_context *ctx, GLenum mode)
 {
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (MESA_VERBOSE&VERBOSE_API)
-      _mesa_debug(ctx, "glCullFace %s\n", _mesa_enum_to_string(mode));
-
-   if (mode!=GL_FRONT && mode!=GL_BACK && mode!=GL_FRONT_AND_BACK) {
-      _mesa_error( ctx, GL_INVALID_ENUM, "glCullFace" );
-      return;
-   }
-
    if (ctx->Polygon.CullFaceMode == mode)
       return;
 
@@ -71,7 +61,24 @@ _mesa_CullFace( GLenum mode )
    ctx->Polygon.CullFaceMode = mode;
 
    if (ctx->Driver.CullFace)
-      ctx->Driver.CullFace( ctx, mode );
+      ctx->Driver.CullFace(ctx, mode);
+}
+
+
+void GLAPIENTRY
+_mesa_CullFace(GLenum mode)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glCullFace %s\n", _mesa_enum_to_string(mode));
+
+   if (mode != GL_FRONT && mode != GL_BACK && mode != GL_FRONT_AND_BACK) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glCullFace");
+      return;
+   }
+
+   cull_face(ctx, mode);
 }
 
 
diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h
index 41344a2ef0c..ceca848d6d4 100644
--- a/src/mesa/main/polygon.h
+++ b/src/mesa/main/polygon.h
@@ -40,7 +40,7 @@ extern void GLAPIENTRY
 _mesa_GetnPolygonStippleARB( GLsizei bufSize, GLubyte *dest );
 
 extern void GLAPIENTRY
-_mesa_CullFace( GLenum mode );
+_mesa_CullFace(GLenum mode);
 
 extern void GLAPIENTRY
 _mesa_FrontFace( GLenum mode );
-- 
2.13.2



More information about the mesa-dev mailing list