summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-06-20 18:23:07 +0200
committerSamuel Pitoiset <[email protected]>2017-06-21 08:47:14 +0200
commit0614b7a6f75d7ab0c7c524ca71199d242f2bd052 (patch)
treefdea6f78f968a16ba1ca6bd5cc6d57c49e70797c /src/mesa/main
parentd222e14ffa6b72727238f45bacb0a39bf37f2ff7 (diff)
mesa: add stencil_op_separate() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/stencil.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c
index 746775d2db6..fa68fa1bd0d 100644
--- a/src/mesa/main/stencil.c
+++ b/src/mesa/main/stencil.c
@@ -391,32 +391,11 @@ _mesa_ActiveStencilFaceEXT(GLenum face)
}
-
-void GLAPIENTRY
-_mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)
+static void
+stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum sfail,
+ GLenum zfail, GLenum zpass)
{
GLboolean set = GL_FALSE;
- GET_CURRENT_CONTEXT(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glStencilOpSeparate()\n");
-
- if (!validate_stencil_op(ctx, sfail)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(sfail)");
- return;
- }
- if (!validate_stencil_op(ctx, zfail)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)");
- return;
- }
- if (!validate_stencil_op(ctx, zpass)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)");
- return;
- }
- if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(face)");
- return;
- }
if (face != GL_BACK) {
/* set front */
@@ -430,6 +409,7 @@ _mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)
set = GL_TRUE;
}
}
+
if (face != GL_FRONT) {
/* set back */
if (ctx->Stencil.ZFailFunc[1] != zfail ||
@@ -442,12 +422,45 @@ _mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)
set = GL_TRUE;
}
}
+
if (set && ctx->Driver.StencilOpSeparate) {
ctx->Driver.StencilOpSeparate(ctx, face, sfail, zfail, zpass);
}
}
+void GLAPIENTRY
+_mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glStencilOpSeparate()\n");
+
+ if (!validate_stencil_op(ctx, sfail)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(sfail)");
+ return;
+ }
+
+ if (!validate_stencil_op(ctx, zfail)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)");
+ return;
+ }
+
+ if (!validate_stencil_op(ctx, zpass)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)");
+ return;
+ }
+
+ if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(face)");
+ return;
+ }
+
+ stencil_op_separate(ctx, face, sfail, zfail, zpass);
+}
+
+
static void
stencil_func_separate(struct gl_context *ctx, GLenum face, GLenum func,
GLint ref, GLuint mask)