summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/enable.c
diff options
context:
space:
mode:
authorSagar Ghuge <[email protected]>2018-07-27 14:55:57 -0700
committerAnuj Phogat <[email protected]>2018-08-28 12:57:27 -0700
commit5650d3997851007a4e4268a4fa4bd698db41e7dc (patch)
tree64317045968fff5a595dfa19e7275726d1b67487 /src/mesa/main/enable.c
parent379949b967f88d27529a2a1a9706753600ce80ca (diff)
mesa: Add support for AMD_depth_clamp_separate
Enable _mesa_PushAttrib() and _mesa_PopAttrib() to handle GL_DEPTH_CLAMP_NEAR_AMD and GL_DEPTH_CLAMP_FAR_AMD tokens. Remove DepthClamp, because DepthClampNear + DepthClampFar replaces it, as suggested by Marek Olsak. Driver that enables AMD_depth_clamp_separate will only ever look at DepthClampNear and DepthClampFar, as suggested by Ian Romanick. v2: 1) Remove unnecessary parentheses (Marek Olsak) 2) if AMD_depth_clamp_separate is unsupported, TEST_AND_UPDATE GL_DEPTH_CLAMP only (Marek Olsak) 3) Clamp against near and far plane separately (Marek Olsak) 4) Clip point separately for near and far Z clipping plane (Marek Olsak) v3: Clamp raster position zw to the range [min(n,f), 0] for near plane and [0, max(n,f)] for far plane (Marek Olsak) v4: Use MIN2 and MAX2 instead of CLAMP (Marek Olsak) Signed-off-by: Sagar Ghuge <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r--src/mesa/main/enable.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index d1b2f3a9625..30d275075d5 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1007,12 +1007,14 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
CHECK_EXTENSION(ARB_depth_clamp, cap);
- if (ctx->Transform.DepthClamp == state)
+ if (ctx->Transform.DepthClampNear == state &&
+ ctx->Transform.DepthClampFar == state)
return;
FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepthClamp ? 0 :
_NEW_TRANSFORM);
ctx->NewDriverState |= ctx->DriverFlags.NewDepthClamp;
- ctx->Transform.DepthClamp = state;
+ ctx->Transform.DepthClampNear = state;
+ ctx->Transform.DepthClampFar = state;
break;
case GL_FRAGMENT_SHADER_ATI:
@@ -1684,7 +1686,8 @@ _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.DepthClampNear ||
+ ctx->Transform.DepthClampFar;
case GL_FRAGMENT_SHADER_ATI:
if (ctx->API != API_OPENGL_COMPAT)