diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-20 18:40:08 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-21 08:47:24 +0200 |
commit | 540766257041b47b2eae28045b3c8043aa19cd8c (patch) | |
tree | 2bca8e69eba78fe4a08d166747193a32037d8c23 /src/mesa/main/stencil.c | |
parent | e6659c560a73316ea6b0273cfa0870b5242baab0 (diff) |
mesa: add stencil_op() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/stencil.c')
-rw-r--r-- | src/mesa/main/stencil.c | 47 |
1 files changed, 28 insertions, 19 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 |