From 5650d3997851007a4e4268a4fa4bd698db41e7dc Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Fri, 27 Jul 2018 14:55:57 -0700 Subject: mesa: Add support for AMD_depth_clamp_separate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ian Romanick Reviewed-by: Marek Olšák --- src/mesa/swrast/s_span.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 87b72e81970..f50b549a97f 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1219,7 +1219,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) if (!(span->arrayMask & SPAN_Z)) _swrast_span_interpolate_z(ctx, span); - if (ctx->Transform.DepthClamp) + if (ctx->Transform.DepthClampNear && ctx->Transform.DepthClampFar) _swrast_depth_clamp_span(ctx, span); if (_mesa_stencil_is_enabled(ctx)) { -- cgit v1.2.3