[Mesa-dev] [PATCH 07/10] mesa: add stencil_func() helper

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Jun 20 21:18:19 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/main/stencil.c | 30 +++++++++++++++++++-----------
 src/mesa/main/stencil.h |  2 +-
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index d7e94194012..4c35b2d20d7 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -184,20 +184,11 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui
  * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies
  * the driver via the dd_function_table::StencilFunc callback.
  */
-void GLAPIENTRY
-_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
+static void
+stencil_func(struct gl_context *ctx, GLenum func, GLint ref, GLuint mask)
 {
-   GET_CURRENT_CONTEXT(ctx);
    const GLint face = ctx->Stencil.ActiveFace;
 
-   if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glStencilFunc()\n");
-
-   if (!validate_stencil_func(ctx, func)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFunc(func)");
-      return;
-   }
-
    if (face != 0) {
       if (ctx->Stencil.Function[face] == func &&
           ctx->Stencil.ValueMask[face] == mask &&
@@ -238,6 +229,23 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
 }
 
 
+void GLAPIENTRY
+_mesa_StencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   if (MESA_VERBOSE & VERBOSE_API)
+      _mesa_debug(ctx, "glStencilFunc()\n");
+
+   if (!validate_stencil_func(ctx, func)) {
+      _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFunc(func)");
+      return;
+   }
+
+   stencil_func(ctx, func, ref, mask);
+}
+
+
 /**
  * Set the stencil writing mask.
  *
diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h
index 87708e009c9..a7a2210ac9b 100644
--- a/src/mesa/main/stencil.h
+++ b/src/mesa/main/stencil.h
@@ -42,7 +42,7 @@ _mesa_ClearStencil( GLint s );
 
 
 extern void GLAPIENTRY
-_mesa_StencilFunc( GLenum func, GLint ref, GLuint mask );
+_mesa_StencilFunc(GLenum func, GLint ref, GLuint mask);
 
 
 extern void GLAPIENTRY
-- 
2.13.1



More information about the mesa-dev mailing list