[Mesa-dev] [PATCH 3/5] mesa: Handle clip control in meta operations.

Neil Roberts neil at linux.intel.com
Tue Oct 28 11:22:33 PDT 2014


On inspection it looks like this would potentially break
_mesa_meta_Clear when it is using GLSL because that does not save the
MESA_META_TRANSFORM state.

I wonder if MESA_META_TRANSFORM is not the right state flag for this
because all of the other state in it is about fixed-function stuff which
is irrelevant for shaders. It would be a shame for shader-based meta ops
to suddenly have to save all of that state too. Maybe it would make more
sense in MESA_META_VIEWPORT?

- Neil

Mathias.Froehlich at gmx.net writes:

> From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
>
> Restore clip control to the default state if MESA_META_VIEWPORT
> or MESA_META_DEPTH_TEST is requested.
>
> v3:
> Handle clip control state with MESA_META_TRANSFORM.
>
> Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
> ---
>  src/mesa/drivers/common/meta.c | 6 ++++++
>  src/mesa/drivers/common/meta.h | 2 ++
>  2 files changed, 8 insertions(+)
>
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 7a8e627..ebb6f5c 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -680,6 +680,10 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
>           _mesa_Ortho(0.0, ctx->DrawBuffer->Width,
>                       0.0, ctx->DrawBuffer->Height,
>                       -1.0, 1.0);
> +
> +      save->ClipControlOrigin = ctx->Transform.Origin;
> +      save->ClipControlDepth = ctx->Transform.Depth;
> +      _mesa_ClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
>     }
>  
>     if (state & MESA_META_CLIP) {
> @@ -1081,6 +1085,8 @@ _mesa_meta_end(struct gl_context *ctx)
>        _mesa_LoadMatrixf(save->ProjectionMatrix);
>  
>        _mesa_MatrixMode(save->MatrixMode);
> +
> +      _mesa_ClipControl(save->ClipControlOrigin, save->ClipControlDepth);
>     }
>  
>     if (state & MESA_META_CLIP) {
> diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
> index 2c9517b..596a0d9 100644
> --- a/src/mesa/drivers/common/meta.h
> +++ b/src/mesa/drivers/common/meta.h
> @@ -136,6 +136,8 @@ struct save_state
>     GLfloat ModelviewMatrix[16];
>     GLfloat ProjectionMatrix[16];
>     GLfloat TextureMatrix[16];
> +   GLenum ClipControlOrigin;
> +   GLenum ClipControlDepth;
>  
>     /** MESA_META_CLIP */
>     GLbitfield ClipPlanesEnabled;
> -- 
> 1.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list