summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/depth.c51
-rw-r--r--src/mesa/main/depth.h2
2 files changed, 31 insertions, 22 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);
}
diff --git a/src/mesa/main/depth.h b/src/mesa/main/depth.h
index 5ff7a5e9e54..5760951c853 100644
--- a/src/mesa/main/depth.h
+++ b/src/mesa/main/depth.h
@@ -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 );