Commit 2e9aed16 authored by Anthony Pesch's avatar Anthony Pesch Committed by Juan Suárez Romero

arb_get_texture_sub_image: update cube map tests to make textures cube complete

Update cube map tests to ensure cube map textures are cube complete before querying
them. Querying a cube map which is not cube complete should set INVALID_OPERATION
as per the OpenGL 4.6 Core spec:

"An INVALID_OPERATION error is generated 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."
Reviewed-by: default avatarArthur Huillet <ahuillet@nvidia.com>
Reviewed-by: Juan Suárez Romero's avatarJuan A. Suarez <jasuarez@igalia.com>
parent 9b050471
......@@ -253,16 +253,20 @@ test_cubemap_faces(void)
0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
}
/* try to get all six cube faces, should fail */
/* try to query incomplete cube map, should fail */
glGetTextureSubImage(tex, 0,
0, 0, 0,
8, 8, 6,
8, 8, 5,
GL_RGBA, GL_UNSIGNED_BYTE,
sizeof(results), results);
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
pass = false;
/* try to get five cube faces, should pass */
/* upload final face */
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + 5,
0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
/* try to query complete cube map, should now pass */
glGetTextureSubImage(tex, 0,
0, 0, 0,
8, 8, 5,
......
......@@ -157,12 +157,16 @@ test_getsubimage(GLenum target,
GL_RGBA, GL_UNSIGNED_BYTE, texData);
break;
case GL_TEXTURE_CUBE_MAP:
/* only set +Y face */
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
level, intFormat,
mip_width, mip_height, 0,
GL_RGBA, GL_UNSIGNED_BYTE,
texData);
/* specify dimensions and format for all faces to make texture cube complete,
but specify data for only the +Y face as it is the only one read back */
for (i = 0; i < 6; i++) {
GLubyte *faceData = i == 2 ? texData : NULL;
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
level, intFormat,
mip_width, mip_height, 0,
GL_RGBA, GL_UNSIGNED_BYTE,
faceData);
}
break;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment