summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-06-20 18:40:08 +0200
committerSamuel Pitoiset <[email protected]>2017-06-21 08:47:24 +0200
commit540766257041b47b2eae28045b3c8043aa19cd8c (patch)
tree2bca8e69eba78fe4a08d166747193a32037d8c23 /src
parente6659c560a73316ea6b0273cfa0870b5242baab0 (diff)
mesa: add stencil_op() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/stencil.c47
-rw-r--r--src/mesa/main/stencil.h2
2 files changed, 29 insertions, 20 deletions
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index 82dd7870675..7913bb176e7 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -320,28 +320,11 @@ _mesa_StencilMask( GLuint mask )
* __struct gl_contextRec::Stencil. On change flushes the vertices and notifies
* the driver via the dd_function_table::StencilOp callback.
*/
-void GLAPIENTRY
-_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+static void
+stencil_op(struct gl_context *ctx, GLenum fail, GLenum zfail, GLenum zpass)
{
- GET_CURRENT_CONTEXT(ctx);
const GLint face = ctx->Stencil.ActiveFace;
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glStencilOp()\n");
-
- if (!validate_stencil_op(ctx, fail)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(sfail)");
- return;
- }
- if (!validate_stencil_op(ctx, zfail)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zfail)");
- return;
- }
- if (!validate_stencil_op(ctx, zpass)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zpass)");
- return;
- }
-
if (face != 0) {
/* only set active face state */
if (ctx->Stencil.ZFailFunc[face] == zfail &&
@@ -383,6 +366,32 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
}
+void GLAPIENTRY
+_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glStencilOp()\n");
+
+ if (!validate_stencil_op(ctx, fail)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(sfail)");
+ return;
+ }
+
+ if (!validate_stencil_op(ctx, zfail)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zfail)");
+ return;
+ }
+
+ if (!validate_stencil_op(ctx, zpass)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zpass)");
+ return;
+ }
+
+ stencil_op(ctx, fail, zfail, zpass);
+}
+
/* GL_EXT_stencil_two_side */
void GLAPIENTRY
diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h
index 71844712a28..5425065a7ca 100644
--- a/src/mesa/main/stencil.h
+++ b/src/mesa/main/stencil.h
@@ -53,7 +53,7 @@ _mesa_StencilMask( GLuint mask );
extern void GLAPIENTRY
-_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass );
+_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass);
extern void GLAPIENTRY