summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Lima Mitev <[email protected]>2016-11-14 15:25:14 -0800
committerEduardo Lima Mitev <[email protected]>2016-11-15 12:26:13 +0100
commite73513f3c85f45a05a23dbdcda7901812fc4d4fa (patch)
tree5d3d70023c81997cc2598d57c480f9f2e6f1b525
parent277f868e6682b9ee398ed326425274c3d1898417 (diff)
meta/GetTexSubImage: Account for GL_PACK_SKIP_IMAGES on compressed textures
This option was being ignored when packing compressed 3D and cube textures. Fixes CTS test (on gen8+): * GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels_pixelstore v2: Drop API checks. v3 (Ken): Just apply the existing code in more cases. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/common/meta.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 5ab1e6ca285..99c85cff17b 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3243,8 +3243,20 @@ _mesa_meta_GetTexSubImage(struct gl_context *ctx,
for (slice = 0; slice < depth; slice++) {
void *dst;
- if (texImage->TexObject->Target == GL_TEXTURE_2D_ARRAY
- || texImage->TexObject->Target == GL_TEXTURE_CUBE_MAP_ARRAY) {
+ /* Section 8.11.4 (Texture Image Queries) of the GL 4.5 spec says:
+ *
+ * "For three-dimensional, two-dimensional array, cube map array,
+ * and cube map textures pixel storage operations are applied as
+ * if the image were two-dimensional, except that the additional
+ * pixel storage state values PACK_IMAGE_HEIGHT and
+ * PACK_SKIP_IMAGES are applied. The correspondence of texels to
+ * memory locations is as defined for TexImage3D in section 8.5."
+ */
+ switch (texImage->TexObject->Target) {
+ case GL_TEXTURE_3D:
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_ARRAY: {
/* Setup pixel packing. SkipPixels and SkipRows will be applied
* in the decompress_texture_image() function's call to
* glReadPixels but we need to compute the dest slice's address
@@ -3255,9 +3267,11 @@ _mesa_meta_GetTexSubImage(struct gl_context *ctx,
packing.SkipRows = 0;
dst = _mesa_image_address3d(&packing, pixels, width, height,
format, type, slice, 0, 0);
+ break;
}
- else {
+ default:
dst = pixels;
+ break;
}
result = decompress_texture_image(ctx, texImage, slice,
xoffset, yoffset, width, height,