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

Iago Toral itoral at igalia.com
Fri Jan 16 03:09:08 PST 2015


Looks good to me.
Jason: does this get your R-b?

Iago

On Fri, 2015-01-16 at 12:48 +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.
> 
> This fixes regression in ES3 conformance test
>    ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels
> 
> v2: add MESA_FORMAT_R10G10B10X2_UNORM format (Iago Toral)
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88385
> ---
>  src/mesa/main/formats.c      | 2 ++
>  src/mesa/main/formats.csv    | 1 +
>  src/mesa/main/formats.h      | 1 +
>  src/mesa/main/glformats.c    | 2 ++
>  src/mesa/swrast/s_texfetch.c | 2 ++
>  5 files changed, 8 insertions(+)
> 
> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> index 8ac0583..b6c5124 100644
> --- a/src/mesa/main/formats.c
> +++ b/src/mesa/main/formats.c
> @@ -1439,6 +1439,7 @@ _mesa_format_to_type_and_comps(mesa_format format,
>        return;
>  
>     case MESA_FORMAT_B10G10R10X2_UNORM:
> +   case MESA_FORMAT_R10G10B10X2_UNORM:
>        *datatype = GL_UNSIGNED_INT_2_10_10_10_REV;
>        *comps = 4;
>        return;
> @@ -2090,6 +2091,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
>     case MESA_FORMAT_RGBX_UINT8:
>     case MESA_FORMAT_RGBX_SINT8:
>     case MESA_FORMAT_B10G10R10X2_UNORM:
> +   case MESA_FORMAT_R10G10B10X2_UNORM:
>     case MESA_FORMAT_RGBX_UNORM16:
>     case MESA_FORMAT_RGBX_SNORM16:
>     case MESA_FORMAT_RGBX_FLOAT16:
> diff --git a/src/mesa/main/formats.csv b/src/mesa/main/formats.csv
> index 15d82aa..e159e7d 100644
> --- a/src/mesa/main/formats.csv
> +++ b/src/mesa/main/formats.csv
> @@ -82,6 +82,7 @@ MESA_FORMAT_G16R16_UNORM                  , packed, 1, 1, un16, un16,     ,
>  MESA_FORMAT_B10G10R10A2_UNORM             , packed, 1, 1, un10, un10, un10, un2 , zyxw, rgb
>  MESA_FORMAT_B10G10R10X2_UNORM             , packed, 1, 1, un10, un10, un10, x2  , zyx1, rgb
>  MESA_FORMAT_R10G10B10A2_UNORM             , packed, 1, 1, un10, un10, un10, un2 , xyzw, rgb
> +MESA_FORMAT_R10G10B10X2_UNORM             , packed, 1, 1, un10, un10, un10, x2  , xyz1, rgb
>  
>  MESA_FORMAT_S8_UINT_Z24_UNORM             , packed, 1, 1, un24, u8  ,     ,     , xy__, zs
>  MESA_FORMAT_X8_UINT_Z24_UNORM             , packed, 1, 1, un24, x8  ,     ,     , x___, zs
> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
> index 09890ec..7e451ca 100644
> --- a/src/mesa/main/formats.h
> +++ b/src/mesa/main/formats.h
> @@ -352,6 +352,7 @@ typedef enum
>     MESA_FORMAT_B10G10R10A2_UNORM,/* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
>     MESA_FORMAT_B10G10R10X2_UNORM,/* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */
>     MESA_FORMAT_R10G10B10A2_UNORM,/* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */
> +   MESA_FORMAT_R10G10B10X2_UNORM,/* xxBB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */
>  
>     MESA_FORMAT_S8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
>     MESA_FORMAT_X8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 3e913ed..06f9aaf 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -2666,6 +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_RGB)
> +         return MESA_FORMAT_R10G10B10X2_UNORM;
>        if (format == GL_RGBA)
>           return MESA_FORMAT_R10G10B10A2_UNORM;
>        else if (format == GL_RGBA_INTEGER)
> diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
> index a0f34fd..9629024 100644
> --- a/src/mesa/swrast/s_texfetch.c
> +++ b/src/mesa/swrast/s_texfetch.c
> @@ -166,6 +166,8 @@ texfetch_funcs[] =
>     FETCH_FUNCS(B10G10R10A2_UNORM),
>     FETCH_NULL(B10G10R10X2_UNORM),
>     FETCH_FUNCS(R10G10B10A2_UNORM),
> +   FETCH_NULL(R10G10B10X2_UNORM),
> +
>     FETCH_FUNCS(S8_UINT_Z24_UNORM),
>     {
>        MESA_FORMAT_X8_UINT_Z24_UNORM,




More information about the mesa-dev mailing list