diff options
author | Sagar Ghuge <[email protected]> | 2018-07-27 14:55:57 -0700 |
---|---|---|
committer | Anuj Phogat <[email protected]> | 2018-08-28 12:57:27 -0700 |
commit | 5650d3997851007a4e4268a4fa4bd698db41e7dc (patch) | |
tree | 64317045968fff5a595dfa19e7275726d1b67487 /src/mesa/drivers/dri/i965 | |
parent | 379949b967f88d27529a2a1a9706753600ce80ca (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/drivers/dri/i965')
-rw-r--r-- | src/mesa/drivers/dri/i965/genX_state_upload.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c index ca24394aa7d..24977a7bba2 100644 --- a/src/mesa/drivers/dri/i965/genX_state_upload.c +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c @@ -1399,7 +1399,8 @@ genX(upload_clip_state)(struct brw_context *brw) clip.ScreenSpaceViewportYMax = 1; clip.ViewportXYClipTestEnable = true; - clip.ViewportZClipTestEnable = !ctx->Transform.DepthClamp; + clip.ViewportZClipTestEnable = !(ctx->Transform.DepthClampNear && + ctx->Transform.DepthClampFar); /* _NEW_TRANSFORM */ if (GEN_GEN == 5 || GEN_IS_G4X) { @@ -1493,7 +1494,8 @@ genX(upload_clip_state)(struct brw_context *brw) clip.UserClipDistanceCullTestEnableBitmask = brw_vue_prog_data(brw->vs.base.prog_data)->cull_distance_mask; - clip.ViewportZClipTestEnable = !ctx->Transform.DepthClamp; + clip.ViewportZClipTestEnable = !(ctx->Transform.DepthClampNear && + ctx->Transform.DepthClampFar); #endif /* _NEW_LIGHT */ @@ -2338,7 +2340,7 @@ genX(upload_cc_viewport)(struct brw_context *brw) for (unsigned i = 0; i < viewport_count; i++) { /* _NEW_VIEWPORT | _NEW_TRANSFORM */ const struct gl_viewport_attrib *vp = &ctx->ViewportArray[i]; - if (ctx->Transform.DepthClamp) { + if (ctx->Transform.DepthClampNear && ctx->Transform.DepthClampFar) { ccv.MinimumDepth = MIN2(vp->Near, vp->Far); ccv.MaximumDepth = MAX2(vp->Near, vp->Far); } else { @@ -4605,7 +4607,8 @@ genX(upload_raster)(struct brw_context *brw) raster.ScissorRectangleEnable = ctx->Scissor.EnableFlags; /* _NEW_TRANSFORM */ - if (!ctx->Transform.DepthClamp) { + if (!(ctx->Transform.DepthClampNear && + ctx->Transform.DepthClampFar)) { #if GEN_GEN >= 9 raster.ViewportZFarClipTestEnable = true; raster.ViewportZNearClipTestEnable = true; |