summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorSagar Ghuge <sagar.ghuge@intel.com>2018-07-27 14:55:57 -0700
committerAnuj Phogat <anuj.phogat@gmail.com>2018-08-28 12:57:27 -0700
commit5650d3997851007a4e4268a4fa4bd698db41e7dc (patch)
tree64317045968fff5a595dfa19e7275726d1b67487 /src/mesa/tnl
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 <sagar.ghuge@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_vb_program.c6
-rw-r--r--src/mesa/tnl/t_vb_vertex.c8
2 files changed, 9 insertions, 5 deletions
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index 19be5eed63a..8d8aca614e3 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -143,7 +143,8 @@ do_ndc_cliptest(struct gl_context *ctx, struct vp_stage_data *store)
store->clipmask,
&store->ormask,
&store->andmask,
- !ctx->Transform.DepthClamp );
+ !(ctx->Transform.DepthClampNear &&
+ ctx->Transform.DepthClampFar) );
}
else {
VB->NdcPtr = NULL;
@@ -152,7 +153,8 @@ do_ndc_cliptest(struct gl_context *ctx, struct vp_stage_data *store)
store->clipmask,
&store->ormask,
&store->andmask,
- !ctx->Transform.DepthClamp );
+ !(ctx->Transform.DepthClampNear &&
+ ctx->Transform.DepthClampFar) );
}
if (store->andmask) {
diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c
index 71a32b49528..4fb3659a358 100644
--- a/src/mesa/tnl/t_vb_vertex.c
+++ b/src/mesa/tnl/t_vb_vertex.c
@@ -123,7 +123,7 @@ tnl_clip_prepare(struct gl_context *ctx)
/* Neither the x86 nor sparc asm cliptest functions have been updated
* for ARB_depth_clamp, so force the C paths.
*/
- if (ctx->Transform.DepthClamp) {
+ if (ctx->Transform.DepthClampNear && ctx->Transform.DepthClampFar) {
static GLboolean c_funcs_installed = GL_FALSE;
if (!c_funcs_installed) {
init_c_cliptest();
@@ -191,7 +191,8 @@ static GLboolean run_vertex_stage( struct gl_context *ctx,
store->clipmask,
&store->ormask,
&store->andmask,
- !ctx->Transform.DepthClamp );
+ !(ctx->Transform.DepthClampNear &&
+ ctx->Transform.DepthClampFar) );
}
else {
VB->NdcPtr = NULL;
@@ -200,7 +201,8 @@ static GLboolean run_vertex_stage( struct gl_context *ctx,
store->clipmask,
&store->ormask,
&store->andmask,
- !ctx->Transform.DepthClamp );
+ !(ctx->Transform.DepthClampNear &&
+ ctx->Transform.DepthClampFar) );
}
if (store->andmask)