[Mesa-dev] [PATCH 2/2] mesa: Speedup the xrgb -> argb special case in fast_read_rgba_pixels_memcpy
Jose Fonseca
jfonseca at vmware.com
Mon Mar 11 07:56:29 PDT 2013
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
----- 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
>
More information about the mesa-dev
mailing list