[Mesa-dev] [PATCH 2/2] mesa: Speedup the xrgb -> argb special case in fast_read_rgba_pixels_memcpy
Patrick Baggett
baggett.patrick at gmail.com
Mon Mar 11 08:03:40 PDT 2013
On Mon, Mar 11, 2013 at 9:56 AM, Jose Fonseca <jfonseca at vmware.com> wrote:
> I'm surprised this is is faster.
>
> In particular, for big things we'll be touching memory twice.
>
> Did you measure the speed up?
>
> Jose
>
I'm sorry to be dull, but is there a SSE2 implementation of this somewhere
for x86 / x64 CPUs?
Patrick
>
> ----- Original Message -----
> > ---
> > src/mesa/main/readpix.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
> > index 349b0bc..0f5c84c 100644
> > --- a/src/mesa/main/readpix.c
> > +++ b/src/mesa/main/readpix.c
> > @@ -285,11 +285,12 @@ fast_read_rgba_pixels_memcpy( struct gl_context
> *ctx,
> > }
> > } else if (copy_xrgb) {
> > /* convert xrgb -> argb */
> > + int alphaOffset = texelBytes - 1;
> > for (j = 0; j < height; j++) {
> > - GLuint *dst4 = (GLuint *) dst, *map4 = (GLuint *) map;
> > + memcpy(dst, map, width * texelBytes);
> > int i;
> > for (i = 0; i < width; i++) {
> > - dst4[i] = map4[i] | 0xff000000; /* set A=0xff */
> > + dst[i * texelBytes + alphaOffset] = 0xff; /* set A=0xff */
> > }
> > dst += dstStride;
> > map += stride;
> > --
> > 1.8.1.5
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130311/1ef125d4/attachment.html>
More information about the mesa-dev
mailing list