[Mesa-dev] [PATCH] mesa: support GL_RGB for GL_EXT_texture_type_2_10_10_10_REV

Iago Toral Quiroga itoral at igalia.com
Wed Jan 14 05:16:34 PST 2015


Hi Tapani,

thanks for looking into this one, I certainly missed that extension...

On mié, 2015-01-14 at 14:04 +0200, Tapani Pälli wrote:
> Commit 8ec6534 changed texture upload path and the way how texture
> format is being checked, this commit adds support for GL_RGB with
> GL_UNSIGNED_INT_2_10_10_10_REV as specified by the extension
> EXT_texture_type_2_10_10_10_REV specification.

The extension mentions that when this is used with RGB, the alpha
channel assumes a value 1.0 when expanded...

> This fixes regression in ES3 conformance test
>    ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88385
> ---
>  src/mesa/main/glformats.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 3e913ed..e54bb90 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -2666,7 +2666,8 @@ _mesa_format_from_format_and_type(GLenum format, GLenum type)
>           return MESA_FORMAT_A2R10G10B10_UINT;
>        break;
>     case GL_UNSIGNED_INT_2_10_10_10_REV:
> -      if (format == GL_RGBA)
> +      if (format == GL_RGB || /* GL_EXT_texture_type_2_10_10_10_REV */
> +          format == GL_RGBA)
>           return MESA_FORMAT_R10G10B10A2_UNORM;

...so I think this is not correct: with this we will lose track that
this was RGB data and we will not ensure A=1.0 if this is stored as
RGBA.

I think what we want to do here is add a new mesa_format like
MESA_FORMAT_R10G10B10X2_UNORM, so we can use auto-generated pack/unpack
functions that take care of this. We would add that enum to formats.h,
then add the type description to formats.csv and then return that enum
here for the RGB case.

Jason, what do you think?

>        else if (format == GL_RGBA_INTEGER)
>           return MESA_FORMAT_R10G10B10A2_UINT;




More information about the mesa-dev mailing list