[Mesa-dev] [PATCH] gen6-gen7: disable dithering for GL_RGB10_A2 render buffers

Anuj Phogat anuj.phogat at gmail.com
Fri Mar 14 15:58:43 PDT 2014


On Fri, Mar 14, 2014 at 11:15 AM, Jordan Justen
<jordan.l.justen at intel.com> wrote:
> With only 2 bits available, dithering causes undesirable results
> for RGB10_A2 render targets.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74700
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Cc to mesa-stable ?
> ---
> Tested on Haswell.
>
> We likely need a change for gen8 too. I'll work with Ken on this.
>
>  src/mesa/drivers/dri/i965/gen6_cc.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c
> index 45c926c..c99ee12 100644
> --- a/src/mesa/drivers/dri/i965/gen6_cc.c
> +++ b/src/mesa/drivers/dri/i965/gen6_cc.c
> @@ -63,13 +63,17 @@ gen6_upload_blend_state(struct brw_context *brw)
>     for (b = 0; b < nr_draw_buffers; b++) {
>        /* _NEW_BUFFERS */
>        struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[b];
> +      GLenum rb_internal_format;
>        GLenum rb_type;
>        bool integer;
>
> -      if (rb)
> +      if (rb) {
>          rb_type = _mesa_get_format_datatype(rb->Format);
> -      else
> +         rb_internal_format = rb->InternalFormat;
> +      } else {
>          rb_type = GL_UNSIGNED_NORMALIZED;
> +         rb_internal_format = GL_NONE;
You can avoid this change by initializing rb_internal_format = GL_NONE
at top. Its a nit-pick. I'm fine if you don't change that.
> +      }
>
>        /* Used for implementing the following bit of GL_EXT_texture_integer:
>         *     "Per-fragment operations that require floating-point color
> @@ -179,7 +183,8 @@ gen6_upload_blend_state(struct brw_context *brw)
>        }
>
>        /* _NEW_COLOR */
> -      if (ctx->Color.DitherFlag && !integer) {
> +      if (ctx->Color.DitherFlag && !integer &&
> +          rb_internal_format != GL_RGB10_A2) {
>          blend[b].blend1.dither_enable = 1;
>          blend[b].blend1.y_dither_offset = 0;
>          blend[b].blend1.x_dither_offset = 0;
I'm convinced by the details of investigation on bugzilla.
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>

BTW good work fixing this bug :)
> --
> 1.9.rc1
>
> _______________________________________________
> 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