[Mesa-dev] [PATCH] mesa/st: Use more precision for GL_UNSIGNED_BYTE_3_3_2(_REV)

Jose Fonseca jfonseca at vmware.com
Thu Oct 25 09:33:16 PDT 2012


Forgot to mention -- it works well even if the driver does not support PIPE_FORMAT_B2G3R3_UNORM. It looks like 
PIPE_FORMAT_B5G6R5_UNORM is enough to make piglit happy.

Jose

----- Original Message -----
> Indeed it does. Thanks Marek!
> 
> This is the updated patch.
> 
> Jose
> 
> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c
> b/src/mesa/state_tracker/st_cb_drawpixels.c
> index 4e2edd2..6420114 100644
> --- a/src/mesa/state_tracker/st_cb_drawpixels.c
> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
> @@ -396,6 +396,8 @@ internal_format(struct gl_context *ctx, GLenum
> format, GLenum type)
>  
>           case GL_UNSIGNED_BYTE_3_3_2:
>           case GL_UNSIGNED_BYTE_2_3_3_REV:
> +            return GL_R3_G3_B2;
> +
>           case GL_UNSIGNED_SHORT_4_4_4_4:
>           case GL_UNSIGNED_SHORT_4_4_4_4_REV:
>              return GL_RGBA4;
> 
> 
> ----- Original Message -----
> > You could also use GL_R3_G3_B2 and check if st_format.c (line 775)
> > does what you want.
> > 
> > Marek
> > 
> > On Thu, Oct 25, 2012 at 4:47 PM,  <jfonseca at vmware.com> wrote:
> > > From: José Fonseca <jfonseca at vmware.com>
> > >
> > > 4bits and 3bits quantitization values differ significantly for
> > > values other than 0 and 1.
> > >
> > > Fixes piglit draw-pixels for softpipe/llvmpipe.
> > > ---
> > >  src/mesa/state_tracker/st_cb_drawpixels.c |    3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c
> > > b/src/mesa/state_tracker/st_cb_drawpixels.c
> > > index 4e2edd2..4532ded 100644
> > > --- a/src/mesa/state_tracker/st_cb_drawpixels.c
> > > +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
> > > @@ -396,6 +396,9 @@ internal_format(struct gl_context *ctx,
> > > GLenum
> > > format, GLenum type)
> > >
> > >           case GL_UNSIGNED_BYTE_3_3_2:
> > >           case GL_UNSIGNED_BYTE_2_3_3_REV:
> > > +           /* GL_RGBA4 introduces too much error for normalized
> > > values */
> > > +            return GL_RGBA8;
> > > +
> > >           case GL_UNSIGNED_SHORT_4_4_4_4:
> > >           case GL_UNSIGNED_SHORT_4_4_4_4_REV:
> > >              return GL_RGBA4;
> > > --
> > > 1.7.9.5
> > >
> > > _______________________________________________
> > > 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