From 8ab0aaa3507247c8cddace7e2eee02382beebf34 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 20 Jun 2017 18:16:05 +0200 Subject: mesa: add stencil_mask_separate() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- src/mesa/main/stencil.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 0b7e151ad13..497fffafbe3 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -506,6 +506,25 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) } +static void +stencil_mask_separate(struct gl_context *ctx, GLenum face, GLuint mask) +{ + FLUSH_VERTICES(ctx, _NEW_STENCIL); + + if (face != GL_BACK) { + ctx->Stencil.WriteMask[0] = mask; + } + + if (face != GL_FRONT) { + ctx->Stencil.WriteMask[1] = mask; + } + + if (ctx->Driver.StencilMaskSeparate) { + ctx->Driver.StencilMaskSeparate(ctx, face, mask); + } +} + + /* OpenGL 2.0 */ void GLAPIENTRY _mesa_StencilMaskSeparate(GLenum face, GLuint mask) @@ -520,17 +539,7 @@ _mesa_StencilMaskSeparate(GLenum face, GLuint mask) return; } - FLUSH_VERTICES(ctx, _NEW_STENCIL); - - if (face != GL_BACK) { - ctx->Stencil.WriteMask[0] = mask; - } - if (face != GL_FRONT) { - ctx->Stencil.WriteMask[1] = mask; - } - if (ctx->Driver.StencilMaskSeparate) { - ctx->Driver.StencilMaskSeparate(ctx, face, mask); - } + stencil_mask_separate(ctx, face, mask); } -- cgit v1.2.3