summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glformats.c
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2018-11-15 16:46:36 +0100
committerErik Faye-Lund <[email protected]>2018-12-03 18:16:44 +0100
commit70bfd312875810e23962a70c9ba98c8295d6a3fd (patch)
treeb5fd3a3bb0f6d8e18eebe6e0788d61220b238bff /src/mesa/main/glformats.c
parent5109742e7be2ba8c53fafd14e895cc9f0a8dd10c (diff)
mesa/main: clean up integer texture check
This makes the logic a little bit easier to follow, and reduce a bit of repetition. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/glformats.c')
-rw-r--r--src/mesa/main/glformats.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 4bd2f9d7e23..41e7393a46d 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2076,8 +2076,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->Version >= 30 ||
- ctx->Extensions.EXT_texture_integer)
+ return _mesa_has_integer_textures(ctx)
? GL_NO_ERROR : GL_INVALID_ENUM;
default:
return GL_INVALID_ENUM;
@@ -2091,8 +2090,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->Version >= 30 ||
- ctx->Extensions.EXT_texture_integer)
+ return _mesa_has_integer_textures(ctx)
? GL_NO_ERROR : GL_INVALID_ENUM;
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
@@ -2113,8 +2111,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_INT:
case GL_UNSIGNED_INT:
/* NOTE: no packed formats w/ BGR format */
- return (ctx->Version >= 30 ||
- ctx->Extensions.EXT_texture_integer)
+ return _mesa_has_integer_textures(ctx)
? GL_NO_ERROR : GL_INVALID_ENUM;
default:
return GL_INVALID_ENUM;
@@ -2129,8 +2126,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->Version >= 30 ||
- ctx->Extensions.EXT_texture_integer)
+ return _mesa_has_integer_textures(ctx)
? GL_NO_ERROR : GL_INVALID_ENUM;
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
@@ -2493,8 +2489,7 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
}
}
- if (ctx->Version >= 30 ||
- ctx->Extensions.EXT_texture_integer) {
+ if (_mesa_has_integer_textures(ctx)) {
switch (internalFormat) {
case GL_RGBA8UI_EXT:
case GL_RGBA16UI_EXT:
@@ -2568,9 +2563,9 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
case GL_R16UI:
case GL_R32I:
case GL_R32UI:
- if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_integer)
- break;
- /* FALLTHROUGH */
+ if (!_mesa_has_integer_textures(ctx))
+ break;
+ /* FALLTHROUGH */
case GL_R8:
case GL_R16:
case GL_RED:
@@ -2588,9 +2583,9 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
case GL_RG16UI:
case GL_RG32I:
case GL_RG32UI:
- if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_integer)
- break;
- /* FALLTHROUGH */
+ if (!_mesa_has_integer_textures(ctx))
+ break;
+ /* FALLTHROUGH */
case GL_RG:
case GL_RG8:
case GL_RG16: