mesa: add depth_func() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
eaa477104c
commit
bbc03839d1
|
@ -57,30 +57,27 @@ _mesa_ClearDepthf( GLclampf depth )
|
|||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_DepthFunc( GLenum func )
|
||||
static ALWAYS_INLINE void
|
||||
depth_func(struct gl_context *ctx, GLenum func, bool no_error)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glDepthFunc %s\n", _mesa_enum_to_string(func));
|
||||
|
||||
if (ctx->Depth.Func == func)
|
||||
return;
|
||||
|
||||
switch (func) {
|
||||
case GL_LESS: /* (default) pass if incoming z < stored z */
|
||||
case GL_GEQUAL:
|
||||
case GL_LEQUAL:
|
||||
case GL_GREATER:
|
||||
case GL_NOTEQUAL:
|
||||
case GL_EQUAL:
|
||||
case GL_ALWAYS:
|
||||
case GL_NEVER:
|
||||
break;
|
||||
default:
|
||||
_mesa_error( ctx, GL_INVALID_ENUM, "glDepth.Func" );
|
||||
return;
|
||||
if (!no_error) {
|
||||
switch (func) {
|
||||
case GL_LESS: /* (default) pass if incoming z < stored z */
|
||||
case GL_GEQUAL:
|
||||
case GL_LEQUAL:
|
||||
case GL_GREATER:
|
||||
case GL_NOTEQUAL:
|
||||
case GL_EQUAL:
|
||||
case GL_ALWAYS:
|
||||
case GL_NEVER:
|
||||
break;
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glDepth.Func");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
|
||||
|
@ -88,7 +85,19 @@ _mesa_DepthFunc( GLenum func )
|
|||
ctx->Depth.Func = func;
|
||||
|
||||
if (ctx->Driver.DepthFunc)
|
||||
ctx->Driver.DepthFunc( ctx, func );
|
||||
ctx->Driver.DepthFunc(ctx, func);
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_DepthFunc(GLenum func)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(ctx, "glDepthFunc %s\n", _mesa_enum_to_string(func));
|
||||
|
||||
depth_func(ctx, func, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ extern void GLAPIENTRY
|
|||
_mesa_ClearDepthf( GLclampf depth );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_DepthFunc( GLenum func );
|
||||
_mesa_DepthFunc(GLenum func);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_DepthMask( GLboolean flag );
|
||||
|
|
Loading…
Reference in New Issue