ctx->Extensions.EXT_texture_type_2_10_10_10_REV is set regardless of
the API that's used, so checking for those direcly will always enable
extensions when they are supported by the driver.

There's no corresponding extension for OpenGL ES 1.x/2.0, so we
shouldn't allow these enums there.

Signed-off-by: Erik Faye-Lund <erik.faye-l...@collabora.com>
---
 src/mesa/main/context.h   | 7 +++++++
 src/mesa/main/glformats.c | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 7db3b94e0b6..071bd5b0818 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -373,6 +373,13 @@ _mesa_has_texture_shared_exponent(const struct gl_context 
*ctx)
    return _mesa_has_EXT_texture_shared_exponent(ctx) || _mesa_is_gles3(ctx);
 }
 
+static inline bool
+_mesa_has_texture_type_2_10_10_10_REV(const struct gl_context *ctx)
+{
+   return _mesa_is_desktop_gl(ctx) ||
+          _mesa_has_EXT_texture_type_2_10_10_10_REV(ctx);
+}
+
 /**
  * Checks if the context supports geometry shaders.
  */
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 7b86c1db9d0..2ac3110187f 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2194,7 +2194,7 @@ _mesa_es_error_check_format_and_type(const struct 
gl_context *ctx,
                     || type == GL_UNSIGNED_SHORT_5_5_5_1
                     || type == GL_FLOAT
                     || type == GL_HALF_FLOAT_OES
-                    || (ctx->Extensions.EXT_texture_type_2_10_10_10_REV &&
+                    || (_mesa_has_texture_type_2_10_10_10_REV(ctx) &&
                         type == GL_UNSIGNED_INT_2_10_10_10_REV));
       break;
 
@@ -2874,7 +2874,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
          case GL_RGBA:
          case GL_RGB10_A2:
          case GL_RGB5_A1:
-            if (!ctx->Extensions.EXT_texture_type_2_10_10_10_REV)
+            if (!_mesa_has_texture_type_2_10_10_10_REV(ctx))
                return GL_INVALID_OPERATION;
             break;
          default:
@@ -3052,7 +3052,7 @@ _mesa_gles_error_check_format_and_type(const struct 
gl_context *ctx,
              * GLES3 doesn't, and GL_OES_required_internalformat extends that
              * to allow the sized RGB internalformats as well.
              */
-            if (!ctx->Extensions.EXT_texture_type_2_10_10_10_REV)
+            if (!_mesa_has_texture_type_2_10_10_10_REV(ctx))
                return GL_INVALID_OPERATION;
             break;
          default:
-- 
2.19.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to