[Mesa-dev] [PATCH 1/2] meta: Don't smash ColorMask when using MESA_META_COLOR_MASK save bit.

Jason Ekstrand jason at jlekstrand.net
Tue Apr 12 23:07:30 UTC 2016


On Apr 12, 2016 1:41 PM, "Kenneth Graunke" <kenneth at whitecape.org> wrote:
>
> This allows meta operations to inspect the existing color mask, and
> then do their own smashing.

I don't like this.  Part of the point of meta begin is to sanitize the
context.  Color masks seem like one of those things we should sanitize.

That said, this isn't a NAK... I just don't like it.  I'm looking at your
other patch to see how needed this really is.

--Jason

> BlitFramebuffer and Clear already override the color mask, so this
> was also redundant.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/common/meta.c                 | 7 ++-----
>  src/mesa/drivers/common/meta_generate_mipmap.c | 2 ++
>  2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/common/meta.c
b/src/mesa/drivers/common/meta.c
> index b673db4..eedfb7c 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -497,11 +497,6 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield
state)
>     if (state & MESA_META_COLOR_MASK) {
>        memcpy(save->ColorMask, ctx->Color.ColorMask,
>               sizeof(ctx->Color.ColorMask));
> -      if (!ctx->Color.ColorMask[0][0] ||
> -          !ctx->Color.ColorMask[0][1] ||
> -          !ctx->Color.ColorMask[0][2] ||
> -          !ctx->Color.ColorMask[0][3])
> -         _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
>     }
>
>     if (state & MESA_META_DEPTH_TEST) {
> @@ -2984,6 +2979,7 @@ decompress_texture_image(struct gl_context *ctx,
>
>     _mesa_meta_begin(ctx, MESA_META_ALL & ~(MESA_META_PIXEL_STORE |
>                                             MESA_META_DRAW_BUFFERS));
> +   _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
>
>     _mesa_reference_sampler_object(ctx, &samp_obj_save,
>
 ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler);
> @@ -3499,6 +3495,7 @@ cleartexsubimage_using_fbo(struct gl_context *ctx,
>                      MESA_META_DITHER |
>                      MESA_META_FRAMEBUFFER_SRGB);
>
> +   _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
>     _mesa_set_enable(ctx, GL_DITHER, GL_FALSE);
>
>     _mesa_set_enable(ctx, GL_SCISSOR_TEST, GL_TRUE);
> diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c
b/src/mesa/drivers/common/meta_generate_mipmap.c
> index b81e179..9cebbf7 100644
> --- a/src/mesa/drivers/common/meta_generate_mipmap.c
> +++ b/src/mesa/drivers/common/meta_generate_mipmap.c
> @@ -31,6 +31,7 @@
>   */
>
>  #include "main/arrayobj.h"
> +#include "main/blend.h"
>  #include "main/buffers.h"
>  #include "main/enums.h"
>  #include "main/enable.h"
> @@ -180,6 +181,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx,
GLenum target,
>     }
>
>     _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_DRAW_BUFFERS);
> +   _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
>
>     /* Choose between glsl version and fixed function version of
>      * GenerateMipmap function.
> --
> 2.8.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160412/c0375d8e/attachment-0001.html>


More information about the mesa-dev mailing list