diff options
author | Samuel Pitoiset <[email protected]> | 2017-06-23 17:20:39 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-28 10:25:12 +0200 |
commit | bbc03839d1e61f0c0250f2af51c3194637ee2745 (patch) | |
tree | cc0c38231c61619bac3056f19d4594d63df122ac /src/mesa/main/depth.c | |
parent | eaa477104c28389ee27f11d9ab97e44ff543c802 (diff) |
mesa: add depth_func() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/depth.c')
-rw-r--r-- | src/mesa/main/depth.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 1ea7d1af5c0..4bc000fd138 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -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); } |