aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2018-11-15 16:40:31 +0100
committerErik Faye-Lund <[email protected]>2018-12-03 18:16:44 +0100
commitb5a370dc250d4e5de1a2a598acfcae522e0e2bdf (patch)
treeac160db0c574c4682c23374fcb9cea6fd4a8c8c3
parent76b038bee7ea4a5cead8d949c290b9ee0ff5998d (diff)
mesa/main: do not allow ARB_texture_rgb10_a2ui enums before gles3
ARB_texture_rgb10_a2ui isn't supported on OpenGL ES, we shouldn't expose it there even if the driver supports it. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/mesa/main/context.h6
-rw-r--r--src/mesa/main/glformats.c12
2 files changed, 12 insertions, 6 deletions
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index d4fe774577e..c51b3c17c0d 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -343,6 +343,12 @@ _mesa_has_integer_textures(const struct gl_context *ctx)
return _mesa_has_EXT_texture_integer(ctx) || _mesa_is_gles3(ctx);
}
+static inline bool
+_mesa_has_texture_rgb10_a2ui(const struct gl_context *ctx)
+{
+ return _mesa_has_ARB_texture_rgb10_a2ui(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 8a3f9f27d47..5cfdeafa359 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1800,7 +1800,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
break; /* OK */
}
if (format == GL_RGB_INTEGER_EXT &&
- ctx->Extensions.ARB_texture_rgb10_a2ui) {
+ _mesa_has_texture_rgb10_a2ui(ctx)) {
break; /* OK */
}
return GL_INVALID_OPERATION;
@@ -1815,7 +1815,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
break; /* OK */
}
if ((format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) &&
- ctx->Extensions.ARB_texture_rgb10_a2ui) {
+ _mesa_has_texture_rgb10_a2ui(ctx)) {
break; /* OK */
}
return GL_INVALID_OPERATION;
@@ -1829,7 +1829,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
break; /* OK */
}
if ((format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT) &&
- ctx->Extensions.ARB_texture_rgb10_a2ui) {
+ _mesa_has_texture_rgb10_a2ui(ctx)) {
break; /* OK */
}
if (type == GL_UNSIGNED_INT_2_10_10_10_REV && format == GL_RGB &&
@@ -2087,7 +2087,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_BYTE_2_3_3_REV:
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
- return ctx->Extensions.ARB_texture_rgb10_a2ui
+ return _mesa_has_texture_rgb10_a2ui(ctx)
? GL_NO_ERROR : GL_INVALID_ENUM;
default:
return GL_INVALID_ENUM;
@@ -2127,7 +2127,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_INT_8_8_8_8_REV:
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
- return ctx->Extensions.ARB_texture_rgb10_a2ui
+ return _mesa_has_texture_rgb10_a2ui(ctx)
? GL_NO_ERROR : GL_INVALID_ENUM;
default:
return GL_INVALID_ENUM;
@@ -2501,7 +2501,7 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
}
}
- if (ctx->Extensions.ARB_texture_rgb10_a2ui) {
+ if (_mesa_has_texture_rgb10_a2ui(ctx)) {
switch (internalFormat) {
case GL_RGB10_A2UI:
return GL_RGBA;