[Mesa-dev] [PATCH v2] mesa: enable EXT_render_snorm extension

Tapani Pälli tapani.palli at intel.com
Wed Jun 27 08:27:05 UTC 2018


ping

On 06/15/2018 08:11 AM, Tapani Pälli wrote:
> Patch sets additional formats renderable and enables the extension
> when OpenGL ES 3.1 is supported.
> 
> v2: instead of dummy_true, have a separate toggle for extension
>      (Eric Anholt)
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
>   src/mesa/main/extensions_table.h |  1 +
>   src/mesa/main/fbobject.c         | 20 +++++++++++++++-----
>   src/mesa/main/glformats.c        |  9 +++++++++
>   src/mesa/main/mtypes.h           |  1 +
>   4 files changed, 26 insertions(+), 5 deletions(-)
> 
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index 79ef228b69..58f72e4d10 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -245,6 +245,7 @@ EXT(EXT_polygon_offset_clamp                , ARB_polygon_offset_clamp
>   EXT(EXT_primitive_bounding_box              , OES_primitive_bounding_box             ,  x ,  x ,  x ,  31, 2014)
>   EXT(EXT_provoking_vertex                    , EXT_provoking_vertex                   , GLL, GLC,  x ,  x , 2009)
>   EXT(EXT_read_format_bgra                    , dummy_true                             ,  x ,  x , ES1, ES2, 2009)
> +EXT(EXT_render_snorm                        , EXT_render_snorm                       ,  x ,  x ,  x,   31, 2014)
>   EXT(EXT_rescale_normal                      , dummy_true                             , GLL,  x ,  x ,  x , 1997)
>   EXT(EXT_robustness                          , KHR_robustness                         ,  x,   x,   x , ES2, 2011)
>   EXT(EXT_secondary_color                     , dummy_true                             , GLL,  x ,  x ,  x , 1999)
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index a63e8b8de5..9e2d3aae90 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -727,7 +727,10 @@ is_format_color_renderable(const struct gl_context *ctx, mesa_format format,
>   
>      /* Reject additional cases for GLES */
>      switch (internalFormat) {
> +   case GL_R8_SNORM:
> +   case GL_RG8_SNORM:
>      case GL_RGBA8_SNORM:
> +      return _mesa_has_EXT_render_snorm(ctx);
>      case GL_RGB32F:
>      case GL_RGB32I:
>      case GL_RGB32UI:
> @@ -740,8 +743,6 @@ is_format_color_renderable(const struct gl_context *ctx, mesa_format format,
>      case GL_SRGB8:
>      case GL_RGB10:
>      case GL_RGB9_E5:
> -   case GL_RG8_SNORM:
> -   case GL_R8_SNORM:
>         return GL_FALSE;
>      default:
>         break;
> @@ -1920,13 +1921,19 @@ _mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat)
>         return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
>            ? GL_RG : 0;
>      /* signed normalized texture formats */
> -   case GL_RED_SNORM:
>      case GL_R8_SNORM:
> +      return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm) ||
> +              _mesa_has_EXT_render_snorm(ctx)
> +         ? GL_RED : 0;
> +   case GL_RED_SNORM:
>      case GL_R16_SNORM:
>         return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
>            ? GL_RED : 0;
> -   case GL_RG_SNORM:
>      case GL_RG8_SNORM:
> +      return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm) ||
> +              _mesa_has_EXT_render_snorm(ctx)
> +         ? GL_RG : 0;
> +   case GL_RG_SNORM:
>      case GL_RG16_SNORM:
>         return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
>            ? GL_RG : 0;
> @@ -1935,8 +1942,11 @@ _mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat)
>      case GL_RGB16_SNORM:
>         return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
>            ? GL_RGB : 0;
> -   case GL_RGBA_SNORM:
>      case GL_RGBA8_SNORM:
> +      return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm) ||
> +              _mesa_has_EXT_render_snorm(ctx)
> +         ? GL_RGBA : 0;
> +   case GL_RGBA_SNORM:
>      case GL_RGBA16_SNORM:
>         return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
>            ? GL_RGBA : 0;
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 667020c193..bbeb6034dd 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -3794,6 +3794,15 @@ _mesa_is_es3_color_renderable(const struct gl_context *ctx,
>      case GL_RG16:
>      case GL_RGBA16:
>         return _mesa_has_EXT_texture_norm16(ctx);
> +   case GL_R8_SNORM:
> +   case GL_RG8_SNORM:
> +   case GL_RGBA8_SNORM:
> +      return _mesa_has_EXT_render_snorm(ctx);
> +   case GL_R16_SNORM:
> +   case GL_RG16_SNORM:
> +   case GL_RGBA16_SNORM:
> +      return _mesa_has_EXT_texture_norm16(ctx) &&
> +             _mesa_has_EXT_render_snorm(ctx);
>      default:
>         return false;
>      }
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 482c42a4b2..3ba07337f5 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4177,6 +4177,7 @@ struct gl_extensions
>      GLboolean EXT_pixel_buffer_object;
>      GLboolean EXT_point_parameters;
>      GLboolean EXT_provoking_vertex;
> +   GLboolean EXT_render_snorm;
>      GLboolean EXT_semaphore;
>      GLboolean EXT_semaphore_fd;
>      GLboolean EXT_shader_integer_mix;
> 


More information about the mesa-dev mailing list