[Mesa-dev] [RFC][PATCH 3/5] mesa: Add support for AMD_depth_clamp_separate

Ian Romanick idr at freedesktop.org
Thu Aug 2 18:34:49 UTC 2018


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 08/01/2018 08:31 PM, Sagar Ghuge wrote:
> enable _mesa_PushAttrib() and _mesa_PopAttrib()
> to handle GL_DEPTH_CLAMP_NEAR_AMD and
> GL_DEPTH_CLAMP_FAR_AMD tokens.
> 
> Signed-off-by: Sagar Ghuge <sagar.ghuge at intel.com>
> ---
>  src/mesa/main/attrib.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
> index cbe93ab6fa..d9f165b428 100644
> --- a/src/mesa/main/attrib.c
> +++ b/src/mesa/main/attrib.c
> @@ -73,6 +73,8 @@ struct gl_enable_attrib
>     GLboolean ColorMaterial;
>     GLboolean CullFace;
>     GLboolean DepthClamp;
> +   GLboolean DepthClampNear;
> +   GLboolean DepthClampFar;
>     GLboolean DepthTest;
>     GLboolean Dither;
>     GLboolean Fog;
> @@ -337,6 +339,8 @@ _mesa_PushAttrib(GLbitfield mask)
>        attr->ColorMaterial = ctx->Light.ColorMaterialEnabled;
>        attr->CullFace = ctx->Polygon.CullFlag;
>        attr->DepthClamp = ctx->Transform.DepthClamp;
> +      attr->DepthClampNear = ctx->Transform.DepthClampNear;
> +      attr->DepthClampFar = ctx->Transform.DepthClampFar;
>        attr->DepthTest = ctx->Depth.Test;
>        attr->Dither = ctx->Color.DitherFlag;
>        attr->Fog = ctx->Fog.Enabled;
> @@ -629,6 +633,10 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
>     TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE);
>     TEST_AND_UPDATE(ctx->Transform.DepthClamp, enable->DepthClamp,
>                     GL_DEPTH_CLAMP);
> +   TEST_AND_UPDATE(ctx->Transform.DepthClampNear, enable->DepthClampNear,
> +                   GL_DEPTH_CLAMP_NEAR_AMD);
> +   TEST_AND_UPDATE(ctx->Transform.DepthClampFar, enable->DepthClampFar,
> +                   GL_DEPTH_CLAMP_FAR_AMD);
>     TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST);
>     TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER);
>     TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG);
> @@ -1150,6 +1158,8 @@ _mesa_PopAttrib(void)
>                                        ctx->DriverFlags.NewClipPlaneEnable |
>                                        ctx->DriverFlags.NewDepth |
>                                        ctx->DriverFlags.NewDepthClamp |
> +                                      ctx->DriverFlags.NewDepthClampNear |
> +                                      ctx->DriverFlags.NewDepthClampFar |
>                                        ctx->DriverFlags.NewFramebufferSRGB |
>                                        ctx->DriverFlags.NewLineState |
>                                        ctx->DriverFlags.NewLogicOp |
> @@ -1436,6 +1446,12 @@ _mesa_PopAttrib(void)
>                 if (xform->DepthClamp != ctx->Transform.DepthClamp)
>                    _mesa_set_enable(ctx, GL_DEPTH_CLAMP,
>                                     ctx->Transform.DepthClamp);
> +               if (xform->DepthClampNear != ctx->Transform.DepthClampNear)
> +                  _mesa_set_enable(ctx, GL_DEPTH_CLAMP_NEAR_AMD,
> +                                   ctx->Transform.DepthClampNear);
> +               if (xform->DepthClampFar != ctx->Transform.DepthClampFar)
> +                  _mesa_set_enable(ctx, GL_DEPTH_CLAMP_FAR_AMD,
> +                                   ctx->Transform.DepthClampFar);
>                 if (ctx->Extensions.ARB_clip_control)
>                    _mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode);
>              }
> 



More information about the mesa-dev mailing list