[Mesa-dev] [PATCH] mesa: fix format selection for meta CopyTexSubImage()

Ian Romanick idr at freedesktop.org
Thu Jul 28 14:48:26 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/28/2011 08:54 AM, Brian Paul wrote:
> When we do a glReadPixels into the temporary buffer, we don't want to
> use GL_LUMINANCE, GL_LUMINANCE_ALPHA or GL_INTENSITY since they will
> compute L=R+G+B which is not what we want.
> 
> This bug has existed all along but was only exposed by the elimination
> of the driver hook for glCopyTexImage() in
> 5874890c26f434f54e9218b83fae4eb8175c24e9.
> 
> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39604

Tested-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>  src/mesa/drivers/common/meta.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 26c8951..f9b4755 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -2869,6 +2869,16 @@ copy_tex_sub_image(struct gl_context *ctx,
>  
>     /* Choose format/type for temporary image buffer */
>     format = _mesa_get_format_base_format(texImage->TexFormat);
> +   if (format == GL_LUMINANCE ||
> +       format == GL_LUMINANCE_ALPHA ||
> +       format == GL_INTENSITY) {
> +      /* We don't want to use GL_LUMINANCE, GL_INTENSITY, etc. for the
> +       * temp image buffer because glReadPixels will do L=R+G+B which is
> +       * not what we want (should be L=R).
> +       */
> +      format = GL_RGBA;
> +   }
> +
>     type = get_temp_image_type(ctx, format);
>     bpp = _mesa_bytes_per_pixel(format, type);
>     if (bpp <= 0) {

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk4x2SkACgkQX1gOwKyEAw+llgCeLzDz45H7vxwmnu6AXnm4ceNM
k+YAn139uWg1kr4FfQUs6RNBRoNiTptU
=Wmvb
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list