aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texgetimage.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-22 13:30:59 +0100
committermarha <marha@users.sourceforge.net>2015-03-22 13:30:59 +0100
commit82c8df11062f72a7d467e26cedbbd8b322ff7a70 (patch)
tree7e7a3e408d09d3e50ff0d2f9befeb5b7ab5617a5 /mesalib/src/mesa/main/texgetimage.c
parent8574eba804031f6b19713f0b02952280730bf62e (diff)
downloadvcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.tar.gz
vcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.tar.bz2
vcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.zip
randrproto fontconfig libX11 libXdmcp libxcb mesa xkbcomp xserver git update 22 Mar 2015
xserver commit 0a78b599b34cc8b5fe6fe82f90e90234e8ab7a56 libxcb commit a90be9955d2c5a635f791d44db1154633b9d3322 libX11 commit 5a499ca7b064bf7e6a4fcc169f22862dce0c60c5 libXdmcp commit 0c09444d276fbf46a0e8b427a4f6a325d0625742 xkbcomp commit fc3e6ddb2c8e922ea80f2dc5cbc1df2102e30d99 randrproto commit b1ba68df8a5fc113a387123ec2f312195e28e47f fontconfig commit 69ff6b6e260584e383c38b1b7034ddcbb23d214f mesa commit 397b491173f0d2df4deb44d21c170bf16840d507
Diffstat (limited to 'mesalib/src/mesa/main/texgetimage.c')
-rw-r--r--mesalib/src/mesa/main/texgetimage.c61
1 files changed, 16 insertions, 45 deletions
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index f975c160e..255d36559 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -1088,48 +1088,9 @@ _mesa_GetTextureImage(GLuint texture, GLint level, GLenum format,
/* Must handle special case GL_TEXTURE_CUBE_MAP. */
if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
- /* Error checking */
- if (texObj->NumLayers < 6) {
- /* 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,
- "glGetTextureImage(insufficient cube map storage)");
- 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 returned data has a consistent format and size
- * and therefore fits in the user's buffer.
+ /* 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,
@@ -1140,6 +1101,8 @@ _mesa_GetTextureImage(GLuint texture, GLint level, GLenum format,
/* Copy each face. */
for (i = 0; i < 6; ++i) {
texImage = texObj->Image[i][level];
+ assert(texImage);
+
_mesa_get_texture_image(ctx, texObj, texImage, texObj->Target, level,
format, type, bufSize, pixels, true);
@@ -1340,13 +1303,21 @@ _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) {
texImage = texObj->Image[i][level];
- if (!texImage)
- return;
+ assert(texImage);
_mesa_get_compressed_texture_image(ctx, texObj, texImage,
texObj->Target, level,