From 1b2e9aca7722a299f82d3590bf36e76071d804d8 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 15 Nov 2018 18:00:24 +0100 Subject: [PATCH] mesa/main: do not allow EXT_texture_shared_exponent enums before gles3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ctx->Extensions.EXT_texture_shared_exponent is set regardless of the API that's used, so checking for those direcly will always allow the enums from this extensions when they are supported by the driver. We also need to make sure this is enabled on OpenGL ES 3. Because the check is repeated, let's introduce a helper. Signed-off-by: Erik Faye-Lund Reviewed-by: Marek Olšák --- src/mesa/main/context.h | 6 ++++++ src/mesa/main/glformats.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index af81717d9bd..7db3b94e0b6 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -367,6 +367,12 @@ _mesa_has_rg_textures(const struct gl_context *ctx) return _mesa_has_ARB_texture_rg(ctx) || _mesa_is_gles3(ctx); } +static inline bool +_mesa_has_texture_shared_exponent(const struct gl_context *ctx) +{ + return _mesa_has_EXT_texture_shared_exponent(ctx) || _mesa_is_gles3(ctx); +} + /** * Checks if the context supports geometry shaders. */ diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index fb1135284d9..319422c27ad 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -1966,7 +1966,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx, return (ctx->API == API_OPENGLES2) ? GL_NO_ERROR : GL_INVALID_ENUM; case GL_UNSIGNED_INT_5_9_9_9_REV: - return ctx->Extensions.EXT_texture_shared_exponent + return _mesa_has_texture_shared_exponent(ctx) ? GL_NO_ERROR : GL_INVALID_ENUM; case GL_UNSIGNED_INT_10F_11F_11F_REV: return _mesa_has_packed_float(ctx) @@ -2589,7 +2589,7 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat) } } - if (ctx->Extensions.EXT_texture_shared_exponent) { + if (_mesa_has_texture_shared_exponent(ctx)) { switch (internalFormat) { case GL_RGB9_E5_EXT: return GL_RGB; -- 2.30.2