MIN2(src_priv->levels[level].padded_width, dst_priv->levels[level].padded_width);
blit.src.box.height = blit.dst.box.height =
MIN2(src_priv->levels[level].padded_height, dst_priv->levels[level].padded_height);
+ unsigned depth = MIN2(src_priv->levels[level].depth, dst_priv->levels[level].depth);
+ if (dst->array_size > 1) {
+ assert(depth == 1); /* no array of 3d texture */
+ depth = dst->array_size;
+ }
- for (int layer = 0; layer < dst->array_size; layer++) {
- blit.src.box.z = blit.dst.box.z = layer;
+ for (int z = 0; z < depth; z++) {
+ blit.src.box.z = blit.dst.box.z = z;
pctx->blit(pctx, &blit);
}
}
blit.dst.box.depth = blit.src.box.depth = 1;
blit.src.level = blit.dst.level = level;
- for (int layer = 0; layer < dst->array_size; layer++) {
- blit.src.box.z = blit.dst.box.z = layer;
+ for (int z = 0; z < box->depth; z++) {
+ blit.src.box.z = blit.dst.box.z = box->z + z;
pctx->blit(pctx, &blit);
}
}
struct etna_resource_level *res_level = &rsc->levels[ptrans->level];
if (rsc->layout == ETNA_LAYOUT_TILED) {
- etna_texture_tile(
- trans->mapped + ptrans->box.z * res_level->layer_stride,
- trans->staging, ptrans->box.x, ptrans->box.y,
- res_level->stride, ptrans->box.width, ptrans->box.height,
- ptrans->stride, util_format_get_blocksize(rsc->base.format));
+ for (unsigned z = 0; z < ptrans->box.depth; z++) {
+ etna_texture_tile(
+ trans->mapped + (ptrans->box.z + z) * res_level->layer_stride,
+ trans->staging + z * ptrans->layer_stride,
+ ptrans->box.x, ptrans->box.y,
+ res_level->stride, ptrans->box.width, ptrans->box.height,
+ ptrans->stride, util_format_get_blocksize(rsc->base.format));
+ }
} else if (rsc->layout == ETNA_LAYOUT_LINEAR) {
util_copy_box(trans->mapped, rsc->base.format, res_level->stride,
res_level->layer_stride, ptrans->box.x,
return NULL;
}
- if (prsc->depth0 > 1) {
+ if (prsc->depth0 > 1 && rsc->ts_bo) {
slab_free(&ctx->transfer_pool, trans);
BUG("resource has depth >1 with tile status");
return NULL;
if (usage & PIPE_TRANSFER_READ) {
if (rsc->layout == ETNA_LAYOUT_TILED) {
- etna_texture_untile(trans->staging,
- trans->mapped + ptrans->box.z * res_level->layer_stride,
- ptrans->box.x, ptrans->box.y, res_level->stride,
- ptrans->box.width, ptrans->box.height, ptrans->stride,
- util_format_get_blocksize(rsc->base.format));
+ for (unsigned z = 0; z < ptrans->box.depth; z++) {
+ etna_texture_untile(trans->staging + z * ptrans->layer_stride,
+ trans->mapped + (ptrans->box.z + z) * res_level->layer_stride,
+ ptrans->box.x, ptrans->box.y, res_level->stride,
+ ptrans->box.width, ptrans->box.height, ptrans->stride,
+ util_format_get_blocksize(rsc->base.format));
+ }
} else if (rsc->layout == ETNA_LAYOUT_LINEAR) {
util_copy_box(trans->staging, rsc->base.format, ptrans->stride,
ptrans->layer_stride, 0, 0, 0, /* dst x,y,z */