st/mesa: account for texture views when doing CopyImageSubData
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 5 Nov 2015 05:33:22 +0000 (00:33 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 5 Nov 2015 16:22:18 +0000 (11:22 -0500)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_copyimage.c

index 75114cdb712a254d78bd41fb12b8fefb891c53e4..03a7294e7c9be130536a4bcca38b1ad60b630397 100644 (file)
@@ -552,6 +552,10 @@ st_CopyImageSubData(struct gl_context *ctx,
       src_res = src->pt;
       src_level = src_image->Level;
       src_z += src_image->Face;
+      if (src_image->TexObject->Immutable) {
+         src_level += src_image->TexObject->MinLevel;
+         src_z += src_image->TexObject->MinLayer;
+      }
    } else {
       struct st_renderbuffer *src = st_renderbuffer(src_renderbuffer);
       src_res = src->texture;
@@ -563,6 +567,10 @@ st_CopyImageSubData(struct gl_context *ctx,
       dst_res = dst->pt;
       dst_level = dst_image->Level;
       dst_z += dst_image->Face;
+      if (dst_image->TexObject->Immutable) {
+         dst_level += dst_image->TexObject->MinLevel;
+         dst_z += dst_image->TexObject->MinLayer;
+      }
    } else {
       struct st_renderbuffer *dst = st_renderbuffer(dst_renderbuffer);
       dst_res = dst->texture;