summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texgetimage.c
diff options
context:
space:
mode:
authorLaura Ekstrand <laura@jlekstrand.net>2015-01-06 14:05:41 -0800
committerLaura Ekstrand <laura@jlekstrand.net>2015-03-09 13:33:53 -0700
commitff011340a499d9fe5c3ead6b46b917578bfeb533 (patch)
tree035396a638f8445c067c53c2295eabd62ac91961 /src/mesa/main/texgetimage.c
parent4080c330fa2868017c99b059b8e5ccf8d4eaa938 (diff)
downloadexternal_mesa3d-ff011340a499d9fe5c3ead6b46b917578bfeb533.zip
external_mesa3d-ff011340a499d9fe5c3ead6b46b917578bfeb533.tar.gz
external_mesa3d-ff011340a499d9fe5c3ead6b46b917578bfeb533.tar.bz2
main: Checking for cube completeness in GetCompressedTextureImage.
v2: Review from Anuj Phogat - Remove redundant copies of the cube map block comment - Replace redundant "if (!texImage) return;" statements with assert(texImage) Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Diffstat (limited to 'src/mesa/main/texgetimage.c')
-rw-r--r--src/mesa/main/texgetimage.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 9411db8..255d365 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1303,7 +1303,16 @@ _mesa_GetCompressedTextureImage(GLuint texture, GLint level,
/* Must handle special case GL_TEXTURE_CUBE_MAP. */
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
- assert(texObj->NumLayers >= 6);
+
+ /* Make sure the texture object is a proper cube.
+ * (See texturesubimage in teximage.c for details on why this check is
+ * performed.)
+ */
+ if (!_mesa_cube_level_complete(texObj, level)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetCompressedTextureImage(cube map incomplete)");
+ return;
+ }
/* Copy each face. */
for (i = 0; i < 6; ++i) {