[Mesa-dev] [PATCH] mesa: Mark R*32F formats as filterable when an extension is present.

Ilia Mirkin imirkin at alum.mit.edu
Thu Jul 7 21:48:14 UTC 2016


Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Thu, Jul 7, 2016 at 5:36 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> GL_OES_texture_float_linear marks R32F, RG32F, RGB32F, and RGBA32F
> as texture filterable.
>
> Fixes glGenerateMipmap GL errors when visiting a WebGL demo in Chromium:
> http://www.iamnop.com/particles
>
> Cc: Matt Atwood <matthew.s.atwood at intel.com>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/main/genmipmap.c |  2 +-
>  src/mesa/main/glformats.c | 17 ++++++++++++++++-
>  src/mesa/main/glformats.h |  3 ++-
>  3 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
> index d917220..5e780c9 100644
> --- a/src/mesa/main/genmipmap.c
> +++ b/src/mesa/main/genmipmap.c
> @@ -90,7 +90,7 @@ _mesa_is_valid_generate_texture_mipmap_internalformat(struct gl_context *ctx,
>               internalformat == GL_LUMINANCE_ALPHA ||
>               internalformat == GL_LUMINANCE || internalformat == GL_ALPHA ||
>               (_mesa_is_es3_color_renderable(internalformat) &&
> -              _mesa_is_es3_texture_filterable(internalformat));
> +              _mesa_is_es3_texture_filterable(ctx, internalformat));
>     }
>
>     return (!_mesa_is_enum_format_integer(internalformat) &&
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 24ce7b0..448577e 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -3656,7 +3656,8 @@ _mesa_is_es3_color_renderable(GLenum internal_format)
>   * is marked "Texture Filterable" in Table 8.10 of the ES 3.2 specification.
>   */
>  bool
> -_mesa_is_es3_texture_filterable(GLenum internal_format)
> +_mesa_is_es3_texture_filterable(const struct gl_context *ctx,
> +                                GLenum internal_format)
>  {
>     switch (internal_format) {
>     case GL_R8:
> @@ -3680,6 +3681,20 @@ _mesa_is_es3_texture_filterable(GLenum internal_format)
>     case GL_R11F_G11F_B10F:
>     case GL_RGB9_E5:
>        return true;
> +   case GL_R32F:
> +   case GL_RG32F:
> +   case GL_RGB32F:
> +   case GL_RGBA32F:
> +      /* The OES_texture_float_linear spec says:
> +       *
> +       *    "When implemented against OpenGL ES 3.0 or later versions, sized
> +       *     32-bit floating-point formats become texture-filterable. This
> +       *     should be noted by, for example, checking the ``TF'' column of
> +       *     table 8.13 in the ES 3.1 Specification (``Correspondence of sized
> +       *     internal formats to base internal formats ... and use cases ...'')
> +       *     for the R32F, RG32F, RGB32F, and RGBA32F formats."
> +       */
> +      return ctx->Extensions.OES_texture_float_linear;
>     default:
>        return false;
>     }
> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> index c73f464..782e0f2 100644
> --- a/src/mesa/main/glformats.h
> +++ b/src/mesa/main/glformats.h
> @@ -149,7 +149,8 @@ extern bool
>  _mesa_is_es3_color_renderable(GLenum internal_format);
>
>  extern bool
> -_mesa_is_es3_texture_filterable(GLenum internal_format);
> +_mesa_is_es3_texture_filterable(const struct gl_context *ctx,
> +                                GLenum internal_format);
>
>  #ifdef __cplusplus
>  }
> --
> 2.9.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list