[Mesa-dev] [PATCH 1/6] main: _mesa_cube_level_complete checks NumLayers.

Laura Ekstrand laura at jlekstrand.net
Wed Mar 4 15:44:07 PST 2015


_mesa_cube_level_complete now verifies that a cube map texture object actually
has six texture images before proceeding.
---
 src/mesa/main/texobj.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index d5aa620..0b200a1 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -878,6 +878,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;
 
-- 
2.1.0



More information about the mesa-dev mailing list