summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/genmipmap.c
diff options
context:
space:
mode:
authorAntia Puentes <apuentes@igalia.com>2015-11-26 15:20:24 +0100
committerEduardo Lima Mitev <elima@igalia.com>2016-03-03 15:14:06 +0100
commit079d99b830073f55a22954f6bb2b56cfb731e5e3 (patch)
treebe83e07935d18427172b2824e8542c555aaa173b /src/mesa/main/genmipmap.c
parent06852f4b7a1ab9ea724bd7708662b2e6549aa98e (diff)
downloadexternal_mesa3d-079d99b830073f55a22954f6bb2b56cfb731e5e3.zip
external_mesa3d-079d99b830073f55a22954f6bb2b56cfb731e5e3.tar.gz
external_mesa3d-079d99b830073f55a22954f6bb2b56cfb731e5e3.tar.bz2
mesa/genmipmap: Added a function to validate the internalformat
It will be used by the ARB_internalformat_query2 implementation to implement mipmap related queries. Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/genmipmap.c')
-rw-r--r--src/mesa/main/genmipmap.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
index efbb1cf..f9ef2d1 100644
--- a/src/mesa/main/genmipmap.c
+++ b/src/mesa/main/genmipmap.c
@@ -75,6 +75,16 @@ _mesa_is_valid_generate_texture_mipmap_target(struct gl_context *ctx,
return (error != GL_TRUE);
}
+bool
+_mesa_is_valid_generate_texture_mipmap_internalformat(struct gl_context *ctx,
+ GLenum internalformat)
+{
+ return (!_mesa_is_enum_format_integer(internalformat) &&
+ !_mesa_is_depthstencil_format(internalformat) &&
+ !_mesa_is_astc_format(internalformat) &&
+ !_mesa_is_stencil_format(internalformat));
+}
+
/**
* Implements glGenerateMipmap and glGenerateTextureMipmap.
* Generates all the mipmap levels below the base level.
@@ -117,10 +127,8 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx,
return;
}
- if (_mesa_is_enum_format_integer(srcImage->InternalFormat) ||
- _mesa_is_depthstencil_format(srcImage->InternalFormat) ||
- _mesa_is_astc_format(srcImage->InternalFormat) ||
- _mesa_is_stencil_format(srcImage->InternalFormat)) {
+ if (!_mesa_is_valid_generate_texture_mipmap_internalformat(ctx,
+ srcImage->InternalFormat)) {
_mesa_unlock_texture(ctx, texObj);
_mesa_error(ctx, GL_INVALID_OPERATION,
"glGenerate%sMipmap(invalid internal format)", suffix);