[03/30] mesa/main: clean up S3_s3tc check

Submitted by Erik Faye-Lund on Nov. 19, 2018, 12:14 p.m.

Details

Message ID 20181119121506.18206-4-erik.faye-lund@collabora.com
State New
Headers show
Series "do not allow invalid texture-format enums" ( rev: 2 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Erik Faye-Lund Nov. 19, 2018, 12:14 p.m.
S3_s3tc is the extension that enables this functionality on desktop, so
let's check for that one. The _mesa_has_S3_s3tc() helper already
verifies the API according to the extension-table.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
---
 src/mesa/main/glformats.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 9a507d11b96..b2c18aa6d94 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1352,8 +1352,7 @@  _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
    case GL_RGB4_S3TC:
    case GL_RGBA_S3TC:
    case GL_RGBA4_S3TC:
-      return _mesa_is_desktop_gl(ctx) &&
-         ctx->Extensions.ANGLE_texture_compression_dxt;
+      return _mesa_has_S3_s3tc(ctx);
    case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
       return ctx->API == API_OPENGL_COMPAT
          && ctx->Extensions.ATI_texture_compression_3dc;
@@ -1378,9 +1377,8 @@  _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
           */
          return ctx->Extensions.ANGLE_texture_compression_dxt;
       } else {
-         return _mesa_is_desktop_gl(ctx)
-            && ctx->Extensions.EXT_texture_sRGB
-            && ctx->Extensions.EXT_texture_compression_s3tc;
+         return _mesa_has_EXT_texture_sRGB(ctx) &&
+            _mesa_has_S3_s3tc(ctx);
       }
    case MESA_FORMAT_LAYOUT_FXT1:
       return _mesa_is_desktop_gl(ctx)

Comments

Assuming you use _mesa_has_EXT_texture_compression_s3tc in the second hunk,
the series is:

Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Marek

On Mon, Nov 19, 2018 at 7:15 AM Erik Faye-Lund <erik.faye-lund@collabora.com>
wrote:

> S3_s3tc is the extension that enables this functionality on desktop, so
> let's check for that one. The _mesa_has_S3_s3tc() helper already
> verifies the API according to the extension-table.
>
> Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
> ---
>  src/mesa/main/glformats.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 9a507d11b96..b2c18aa6d94 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -1352,8 +1352,7 @@ _mesa_is_compressed_format(const struct gl_context
> *ctx, GLenum format)
>     case GL_RGB4_S3TC:
>     case GL_RGBA_S3TC:
>     case GL_RGBA4_S3TC:
> -      return _mesa_is_desktop_gl(ctx) &&
> -         ctx->Extensions.ANGLE_texture_compression_dxt;
> +      return _mesa_has_S3_s3tc(ctx);
>     case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
>        return ctx->API == API_OPENGL_COMPAT
>           && ctx->Extensions.ATI_texture_compression_3dc;
> @@ -1378,9 +1377,8 @@ _mesa_is_compressed_format(const struct gl_context
> *ctx, GLenum format)
>            */
>           return ctx->Extensions.ANGLE_texture_compression_dxt;
>        } else {
> -         return _mesa_is_desktop_gl(ctx)
> -            && ctx->Extensions.EXT_texture_sRGB
> -            && ctx->Extensions.EXT_texture_compression_s3tc;
> +         return _mesa_has_EXT_texture_sRGB(ctx) &&
> +            _mesa_has_S3_s3tc(ctx);
>        }
>     case MESA_FORMAT_LAYOUT_FXT1:
>        return _mesa_is_desktop_gl(ctx)
> --
> 2.19.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>