mesa: Add missing include guards
[mesa.git] / src / mesa / main / depth.c
index bb4591cf152e88aa79669b01e3525cf9fa3a281e..930f5e816f9b645108cb4c089dbc25a86ba2db70 100644 (file)
@@ -57,37 +57,55 @@ _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_lookup_enum_by_nr(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, _NEW_DEPTH);
+   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
+   ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
    ctx->Depth.Func = func;
 
    if (ctx->Driver.DepthFunc)
-      ctx->Driver.DepthFunc( ctx, func );
+      ctx->Driver.DepthFunc(ctx, func);
+}
+
+
+void GLAPIENTRY
+_mesa_DepthFunc_no_error(GLenum func)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   depth_func(ctx, func, true);
+}
+
+
+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);
 }
 
 
@@ -107,7 +125,8 @@ _mesa_DepthMask( GLboolean flag )
    if (ctx->Depth.Mask == flag)
       return;
 
-   FLUSH_VERTICES(ctx, _NEW_DEPTH);
+   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
+   ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
    ctx->Depth.Mask = flag;
 
    if (ctx->Driver.DepthMask)
@@ -138,7 +157,8 @@ _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
    if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax)
       return;
 
-   FLUSH_VERTICES(ctx, _NEW_DEPTH);
+   FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepth ? 0 : _NEW_DEPTH);
+   ctx->NewDriverState |= ctx->DriverFlags.NewDepth;
    ctx->Depth.BoundsMin = (GLfloat) zmin;
    ctx->Depth.BoundsMax = (GLfloat) zmax;
 }