mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-29 13:50:25 +01:00
main: Checking for cube completeness in TextureSubImage.
This is part of a potential solution to a spec bug. Cube completeness is a concept from glGenerateMipmap, but it seems reasonable to check for it in TextureSubImage when target=GL_TEXTURE_CUBE_MAP. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
This commit is contained in:
parent
efbc1c86a6
commit
8d2542fc9d
1 changed files with 35 additions and 13 deletions
|
|
@ -3557,19 +3557,41 @@ 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* What do we do if the user created a texture with the following code
|
||||
* and then called this function with its handle?
|
||||
*
|
||||
* GLuint tex;
|
||||
* glCreateTextures(GL_TEXTURE_CUBE_MAP, 1, &tex);
|
||||
* glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
|
||||
* glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, ...);
|
||||
* glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, ...);
|
||||
* glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, ...);
|
||||
* // Note: GL_TEXTURE_CUBE_MAP_NEGATIVE_Y not set, or given the
|
||||
* // wrong format, or given the wrong size, etc.
|
||||
* glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, ...);
|
||||
* glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, ...);
|
||||
*
|
||||
* A bug has been filed against the spec for this case. In the
|
||||
* meantime, we will check for cube completeness.
|
||||
*
|
||||
* 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)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glTextureSubImage%uD(cube map incomplete)",
|
||||
dims);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Copy in each face. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue