main: _mesa_cube_level_complete checks NumLayers.

_mesa_cube_level_complete now verifies that a cube map texture object actually
has six texture images before proceeding.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
Laura Ekstrand 2015-03-04 10:49:55 -08:00
parent c939231e72
commit 1ee000a0b6

View file

@ -879,6 +879,10 @@ _mesa_cube_level_complete(const struct gl_texture_object *texObj,
if (texObj->Target != GL_TEXTURE_CUBE_MAP)
return GL_FALSE;
/* Make sure we have enough image planes for a cube map. */
if (texObj->NumLayers < 6)
return GL_FALSE;
if ((level < 0) || (level >= MAX_TEXTURE_LEVELS))
return GL_FALSE;