diff options
author | Brian Paul <[email protected]> | 2013-07-16 06:27:33 -0600 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-08-05 15:41:13 -0700 |
commit | 62370903308af032cd31581ec1fd71fa1fb2f9d3 (patch) | |
tree | cc6f52af70236455ee9a2041fd778c5176cdb38c /src | |
parent | 55ab069e5fdcd1fd6a311057fb96283614f11b8b (diff) |
meta: handle 2D texture arrays in decompress_texture_image()
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66850
NOTE: This is a candidate for the 9.x branches.
Cc: [email protected]
Reviewed-by: José Fonseca <[email protected]>
(cherry picked from commit 484fa879847fdc7c9ef22231315f78a4c342e85d)
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/common/meta.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index e8484299bdb..4a3497c9aa7 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -4095,10 +4095,29 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, _mesa_get_format_datatype(texImage->TexFormat) == GL_UNSIGNED_NORMALIZED) { struct gl_texture_object *texObj = texImage->TexObject; - const GLuint slice = 0; /* only 2D compressed textures for now */ + GLuint slice; /* Need to unlock the texture here to prevent deadlock... */ _mesa_unlock_texture(ctx, texObj); - decompress_texture_image(ctx, texImage, slice, format, type, pixels); + for (slice = 0; slice < texImage->Depth; slice++) { + void *dst; + if (texImage->TexObject->Target == GL_TEXTURE_2D_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 + * here (according to SkipImages and ImageHeight). + */ + struct gl_pixelstore_attrib packing = ctx->Pack; + packing.SkipPixels = 0; + packing.SkipRows = 0; + dst = _mesa_image_address3d(&packing, pixels, texImage->Width, + texImage->Height, format, type, + slice, 0, 0); + } + else { + dst = pixels; + } + decompress_texture_image(ctx, texImage, slice, format, type, dst); + } /* ... and relock it */ _mesa_lock_texture(ctx, texObj); } |