mesa: add stencil_op() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
+28
-19
@@ -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
|
||||
|
||||
@@ -53,7 +53,7 @@ _mesa_StencilMask( GLuint mask );
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass );
|
||||
_mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass);
|
||||
|
||||
|
||||
extern void GLAPIENTRY
|
||||
|
||||
Reference in New Issue
Block a user