On 03/14/2014 11:15 AM, Jordan Justen 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.jus...@intel.com>
> ---
> 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;
> +      }
>  
>        /* 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;
> 

We may want to disable this for more formats, as well...I'm just not
sure what the cut-offs should be...

For example, do we want it on for:
- 5551?  (disable? too few alpha bits?)
- 565?   (enable?)
- 4444?  (not sure?)
- 8-bit formats?  (enable?)
- 16-bit formats?  (probably disable - high enough precision already?)
- 32-bit formats?  (ditto?)

Ian, others, thoughts?

If we end up disabling it for more formats, we may want to cue this off
of _mesa_get_format_bits()...

--Ken

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to