From 6f10d93ea4d4cf13321bd7b75adc94d161027a94 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 20 Jun 2017 18:09:02 +0200 Subject: mesa: add stencil_func_separate() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- src/mesa/main/stencil.c | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'src/mesa/main/stencil.c') 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,18 +460,43 @@ _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); } } +/* 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) -- cgit v1.2.3