[Mesa-dev] [RFC][PATCH 1/5] mesa: add support for GL_AMD_depth_clamp_separate tokens

Sagar Ghuge sagar.ghuge at intel.com
Thu Aug 2 03:31:10 UTC 2018


_mesa_set_enable() and _mesa_IsEnabled() extended
to accept new two tokens GL_DEPTH_CLAMP_NEAR_AMD and
GL_DEPTH_CLAMP_FAR_AMD.

Signed-off-by: Sagar Ghuge <sagar.ghuge at intel.com>
---
 src/mesa/main/enable.c | 44 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index d1b2f3a962..54729743ab 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1013,6 +1013,32 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
                                                            _NEW_TRANSFORM);
          ctx->NewDriverState |= ctx->DriverFlags.NewDepthClamp;
          ctx->Transform.DepthClamp = state;
+         ctx->Transform.DepthClampNear = state;
+         ctx->Transform.DepthClampFar = state;
+         break;
+
+      case GL_DEPTH_CLAMP_NEAR_AMD:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
+         CHECK_EXTENSION(AMD_depth_clamp_separate, cap);
+         if (ctx->Transform.DepthClampNear == state)
+            return;
+         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepthClampNear ? 0 :
+                                                           _NEW_TRANSFORM);
+         ctx->NewDriverState |= ctx->DriverFlags.NewDepthClampNear;
+         ctx->Transform.DepthClampNear = state;
+         break;
+
+      case GL_DEPTH_CLAMP_FAR_AMD:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
+         CHECK_EXTENSION(AMD_depth_clamp_separate, cap);
+         if (ctx->Transform.DepthClampFar == state)
+            return;
+         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepthClampFar ? 0 :
+                                                           _NEW_TRANSFORM);
+         ctx->NewDriverState |= ctx->DriverFlags.NewDepthClampFar;
+         ctx->Transform.DepthClampFar = state;
          break;
 
       case GL_FRAGMENT_SHADER_ATI:
@@ -1684,7 +1710,23 @@ _mesa_IsEnabled( GLenum cap )
          if (!_mesa_is_desktop_gl(ctx))
             goto invalid_enum_error;
          CHECK_EXTENSION(ARB_depth_clamp);
-         return ctx->Transform.DepthClamp;
+         return (ctx->Transform.DepthClamp ||
+                ctx->Transform.DepthClampNear ||
+                ctx->Transform.DepthClampFar);
+
+      /* GL_AMD_depth_clamp_separate */
+      case GL_DEPTH_CLAMP_NEAR_AMD:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
+         CHECK_EXTENSION(AMD_depth_clamp_separate);
+         return ctx->Transform.DepthClampNear;
+
+      /* GL_AMD_depth_clamp_separate */
+      case GL_DEPTH_CLAMP_FAR_AMD:
+         if (!_mesa_is_desktop_gl(ctx))
+            goto invalid_enum_error;
+         CHECK_EXTENSION(AMD_depth_clamp_separate);
+         return ctx->Transform.DepthClampFar;
 
       case GL_FRAGMENT_SHADER_ATI:
          if (ctx->API != API_OPENGL_COMPAT)
-- 
2.17.1



More information about the mesa-dev mailing list