diff options
author | Jonathan Marek <[email protected]> | 2019-07-24 10:30:08 -0400 |
---|---|---|
committer | Jonathan Marek <[email protected]> | 2019-08-06 10:37:36 -0400 |
commit | 3508f2fb185042aae31555321c9eff0ec47a9369 (patch) | |
tree | 7f26d141d0bec10bd128d91c30a0b57f23d19249 /src/gallium/drivers/etnaviv/etnaviv_transfer.c | |
parent | ed7a27719a9fceb7271dfd97b2217c787356f21a (diff) |
etnaviv: fix 3d texture upload
Fix uploading of 3D textures and 2D array textures:
* Remove asserts in BLT and RS checking z
* Use box->z/box->depth in etna_copy_resource_box and CPU tile/untile
* Track mip level depth and use it in etna_copy_resource
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_transfer.c')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_transfer.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c b/src/gallium/drivers/etnaviv/etnaviv_transfer.c index 78face1ee90..de2d6ed9ba2 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c @@ -134,11 +134,14 @@ etna_transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *ptrans) 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, @@ -240,7 +243,7 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc, 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; @@ -427,11 +430,13 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc, 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 */ |