diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-20 18:09:02 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-21 08:47:06 +0200 |
commit | 6f10d93ea4d4cf13321bd7b75adc94d161027a94 (patch) | |
tree | 9ab73d7a3ff230e76ad0ea20c610fc820ee4971b /src/mesa | |
parent | 629003b5b841380ccad1b369507924c9946bb00a (diff) |
mesa: add stencil_func_separate() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/stencil.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index b303bb7c13f..78a09072b29 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -448,24 +448,10 @@ _mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) } -/* OpenGL 2.0 */ -void GLAPIENTRY -_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) +static void +stencil_func_separate(struct gl_context *ctx, GLenum face, GLenum func, + GLint ref, GLuint mask) { - GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glStencilFuncSeparate()\n"); - - if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(face)"); - return; - } - if (!validate_stencil_func(ctx, func)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)"); - return; - } - FLUSH_VERTICES(ctx, _NEW_STENCIL); if (face != GL_BACK) { @@ -474,12 +460,14 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) ctx->Stencil.Ref[0] = ref; ctx->Stencil.ValueMask[0] = mask; } + if (face != GL_FRONT) { /* set back */ ctx->Stencil.Function[1] = func; ctx->Stencil.Ref[1] = ref; ctx->Stencil.ValueMask[1] = mask; } + if (ctx->Driver.StencilFuncSeparate) { ctx->Driver.StencilFuncSeparate(ctx, face, func, ref, mask); } @@ -488,6 +476,29 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) /* OpenGL 2.0 */ void GLAPIENTRY +_mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glStencilFuncSeparate()\n"); + + if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(face)"); + return; + } + + if (!validate_stencil_func(ctx, func)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)"); + return; + } + + stencil_func_separate(ctx, face, func, ref, mask); +} + + +/* OpenGL 2.0 */ +void GLAPIENTRY _mesa_StencilMaskSeparate(GLenum face, GLuint mask) { GET_CURRENT_CONTEXT(ctx); |