<p dir="ltr"><br>
On May 4, 2015 6:41 AM, "Juha-Pekka Heikkila" <<a href="mailto:juhapekka.heikkila@gmail.com">juhapekka.heikkila@gmail.com</a>> wrote:<br>
><br>
> These two patches<br>
><br>
> Reviewed-and-tested-by: Juha-Pekka Heikkila <<a href="mailto:juhapekka.heikkila@gmail.com">juhapekka.heikkila@gmail.com</a>></p>
<p dir="ltr">Those should probably be sperate tags.  Also,</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>></p>
<p dir="ltr">> On 04.05.2015 12:24, Iago Toral Quiroga wrote:<br>
> > When we implemented the format conversion rewrite we forgot to handle<br>
> > GL_COLOR_INDEX here, which needs special handling.<br>
> ><br>
> > Fixes the following piglit test:<br>
> > bin/gl-1.0-drawpixels-color-index -auto -fbo<br>
> ><br>
> > Buzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=90213">https://bugs.freedesktop.org/show_bug.cgi?id=90213</a><br>
> > ---<br>
> >  src/mesa/swrast/s_drawpix.c | 29 ++++++++++++++++++++++++++---<br>
> >  1 file changed, 26 insertions(+), 3 deletions(-)<br>
> ><br>
> > diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c<br>
> > index bf42726..fb677ee 100644<br>
> > --- a/src/mesa/swrast/s_drawpix.c<br>
> > +++ b/src/mesa/swrast/s_drawpix.c<br>
> > @@ -448,14 +448,34 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,<br>
> >     {<br>
> >        const GLbitfield interpMask = span.interpMask;<br>
> >        const GLbitfield arrayMask = span.arrayMask;<br>
> > -      const GLint srcStride<br>
> > -         = _mesa_image_row_stride(unpack, width, format, type);<br>
> >        GLint skipPixels = 0;<br>
> >        /* use span array for temp color storage */<br>
> >        GLfloat *rgba = (GLfloat *) span.array->attribs[VARYING_SLOT_COL0];<br>
> >        void *tempImage = NULL;<br>
> ><br>
> > -      if (unpack->SwapBytes) {<br>
> > +      /* We have to deal with GL_COLOR_INDEX manually because<br>
> > +       * _mesa_format_convert does not handle this format. So what we do here is<br>
> > +       * convert it to RGBA ubyte first and then convert from that to dst as<br>
> > +       * usual.<br>
> > +       */<br>
> > +      if (format == GL_COLOR_INDEX) {<br>
> > +         /* This will handle byte swapping and transferops if needed */<br>
> > +         tempImage =<br>
> > +            _mesa_unpack_color_index_to_rgba_ubyte(ctx, 2,<br>
> > +                                                   pixels, format, type,<br>
> > +                                                   width, height, 1,<br>
> > +                                                   unpack,<br>
> > +                                                   transferOps);<br>
> > +         if (!tempImage) {<br>
> > +            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");<br>
> > +            return;<br>
> > +         }<br>
> > +<br>
> > +         transferOps = 0;<br>
> > +         pixels = tempImage;<br>
> > +         format = GL_RGBA;<br>
> > +         type = GL_UNSIGNED_BYTE;<br>
> > +      } else if (unpack->SwapBytes) {<br>
> >           /* We have to handle byte-swapping scenarios before calling<br>
> >            * _mesa_format_convert<br>
> >            */<br>
> > @@ -476,6 +496,9 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,<br>
> >           }<br>
> >        }<br>
> ><br>
> > +      const GLint srcStride<br>
> > +         = _mesa_image_row_stride(unpack, width, format, type);<br>
> > +<br>
> >        /* if the span is wider than SWRAST_MAX_WIDTH we have to do it in chunks */<br>
> >        while (skipPixels < width) {<br>
> >           const GLint spanWidth = MIN2(width - skipPixels, SWRAST_MAX_WIDTH);<br>
> ><br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>