This is part of a potential solution to Khronos Bug 13223. Cube completeness is a concept from glGenerateMipmap, but it seems reasonable to check for it in TextureSubImage when target=GL_TEXTURE_CUBE_MAP. --- src/mesa/main/teximage.c | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index df05fb1..8150e65 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3565,19 +3565,35 @@ texturesubimage(struct gl_context *ctx, GLuint dims, dims); return; } - for (i = 0; i < 6; ++i) { /* For each face. */ - if (!texObj->Image[i][level]) { - /* Not enough image planes for a cube map. The spec does not say - * what should happen in this case because the user has always - * specified each cube face separately (using - * GL_TEXTURE_CUBE_MAP_POSITIVE_X+i) in previous GL versions. - * This is addressed in Khronos Bug 13223. - */ - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTextureSubImage%uD(insufficient cube map storage)", - dims); - return; - } + + /* + * This is part of a potential solution to a bug in the spec. According + * to Section 8.17 Texture Completeness in the OpenGL 4.5 Core Profile + * spec (30.10.2014): + * "[A] cube map texture is cube complete if the + * following conditions all hold true: The [base level] texture + * images of each of the six cube map faces have identical, positive, + * and square dimensions. The [base level] images were each specified + * with the same internal format." + * + * It seems reasonable to check for cube completeness of an arbitrary + * level here so that the image data has a consistent format and size. + */ + if (!_mesa_cube_level_complete(texObj, level)) { + /* + * Precedence for this error: + * In Section 8.14.4 Manual Mipmap Generation, the OpenGL 4.5 Core + * Profile spec (30.10.2014) says: + * "An INVALID_OPERATION error is generated by + * GenerateTextureMipmap if the effective target is + * TEXTURE_CUBE_MAP or TEXTURE_CUBE_MAP_ARRAY, and the texture + * object is not cube complete or cube array complete, + * respectively." + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureSubImage%uD(cube map incomplete)", + dims); + return; } /* Copy in each face. */ -- 2.1.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev