[Mesa-dev] [PATCH] Adding support for EXT_sRGB for Opengl ES

Tapani Pälli tapani.palli at intel.com
Thu Apr 20 12:10:37 UTC 2017


On 04/07/2017 07:20 AM, Harish Krupo wrote:
> This addes support for the GL_EXT_sRGB extension for OpengGL ES 1.0 and above.
> With this patch this test passes in dEQP:
> dEQP-GLES2.capability.extensions.uncompressed_texture_formats.GL_EXT_sRGB

When searching for possible other cases these changes will affect I 
noticed there are also some sRGB related cases in fbo completeness that 
regress:

please run deqp-gles2 with:

--deqp-case=dEQP-GLES2.functional.fbo.completeness*srgb*

to see these.

> Signed-off-by: Harish Krupo <harish.krupo.kps at intel.com>
> ---
>   src/mapi/glapi/gen/es_EXT.xml                | 8 ++++++++
>   src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
>   src/mesa/main/extensions_table.h             | 1 +
>   src/mesa/main/fbobject.c                     | 2 +-
>   src/mesa/main/genmipmap.c                    | 3 +++
>   src/mesa/main/mtypes.h                       | 1 +
>   6 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
> index 3e705eb409..a6fd7c755a 100644
> --- a/src/mapi/glapi/gen/es_EXT.xml
> +++ b/src/mapi/glapi/gen/es_EXT.xml
> @@ -795,6 +795,14 @@
>       <enum name="FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT" value="0x8A52"/>
>   </category>
>   
> +<!-- 150. GL_EXT_sRGB -->
> +<category name="GL_EXT_sRGB" number="150">
> +    <enum name="SRGB_EXT" value="0x8C40"/>
> +    <enum name="SRGB_ALPHA_EXT" value="0x8C42"/>
> +    <enum name="SRGB8_ALPHA8_EXT" value="0x8C43"/>
> +    <enum name="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT" value="0x8210"/>
> +</category>
> +
>   <!-- 151. GL_EXT_draw_buffers -->
>   <category name="GL_EXT_draw_buffers" number="151">
>       <function name="DrawBuffersEXT" alias="DrawBuffers" es2="2.0">
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
> index 30f2c37695..2b49e6f8db 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -109,6 +109,7 @@ intelInitExtensions(struct gl_context *ctx)
>      ctx->Extensions.EXT_texture_shared_exponent = true;
>      ctx->Extensions.EXT_texture_snorm = true;
>      ctx->Extensions.EXT_texture_sRGB = true;
> +   ctx->Extensions.EXT_sRGB = true;
>      ctx->Extensions.EXT_texture_sRGB_decode = true;
>      ctx->Extensions.EXT_texture_swizzle = true;
>      ctx->Extensions.EXT_vertex_array_bgra = true;
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index ec717912cb..7fde0a3127 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -245,6 +245,7 @@ EXT(EXT_shader_integer_mix                  , EXT_shader_integer_mix
>   EXT(EXT_shader_io_blocks                    , dummy_true                             ,  x ,  x ,  x ,  31, 2014)
>   EXT(EXT_shader_samples_identical            , EXT_shader_samples_identical           , GLL, GLC,  x ,  31, 2015)
>   EXT(EXT_shadow_funcs                        , ARB_shadow                             , GLL,  x ,  x ,  x , 2002)
> +EXT(EXT_sRGB                                , EXT_sRGB                               ,  x ,  x , ES1, ES2, 2011)
>   EXT(EXT_stencil_two_side                    , EXT_stencil_two_side                   , GLL,  x ,  x ,  x , 2001)
>   EXT(EXT_stencil_wrap                        , dummy_true                             , GLL,  x ,  x ,  x , 2002)
>   EXT(EXT_subtexture                          , dummy_true                             , GLL,  x ,  x ,  x , 1995)
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index f73a009d62..caa4828111 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -3898,7 +3898,7 @@ _mesa_get_framebuffer_attachment_parameter(struct gl_context *ctx,
>            }
>         }
>         else {
> -         if (ctx->Extensions.EXT_framebuffer_sRGB) {
> +         if (ctx->Extensions.EXT_framebuffer_sRGB || !ctx->Extensions.EXT_sRGB) {
>               *params =
>                  _mesa_get_format_color_encoding(att->Renderbuffer->Format);
>            }
> diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
> index 6021c026f5..d451ea40be 100644
> --- a/src/mesa/main/genmipmap.c
> +++ b/src/mesa/main/genmipmap.c
> @@ -96,6 +96,9 @@ _mesa_is_valid_generate_texture_mipmap_internalformat(struct gl_context *ctx,
>                (_mesa_is_es3_color_renderable(internalformat) &&
>                 _mesa_is_es3_texture_filterable(ctx, internalformat));
>      }
> +   else if (!_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_sRGB && (internalformat == GL_SRGB)) {
> +      return GL_INVALID_OPERATION;
> +   }
>   
>      return (!_mesa_is_enum_format_integer(internalformat) &&
>              !_mesa_is_depthstencil_format(internalformat) &&
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index be78b96810..b938ed8958 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3963,6 +3963,7 @@ struct gl_extensions
>      GLboolean EXT_provoking_vertex;
>      GLboolean EXT_shader_integer_mix;
>      GLboolean EXT_shader_samples_identical;
> +   GLboolean EXT_sRGB;
>      GLboolean EXT_stencil_two_side;
>      GLboolean EXT_texture_array;
>      GLboolean EXT_texture_compression_latc;
> 


More information about the mesa-dev mailing list