diff options
author | Marek Olšák <[email protected]> | 2013-01-02 21:05:02 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-02-26 01:14:20 +0100 |
commit | d8d58bdcb9cd4caed9fe8bbfd683299fab89b11f (patch) | |
tree | 7ce8ccc6aba0a469a9e6bf5005dbaa8ba70fc0dd | |
parent | 3857f450a6d88cf4d0c616a4224bbd5b9cc89388 (diff) |
r300g: implement 3D transfers
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=61351
-rw-r--r-- | src/gallium/drivers/r300/r300_transfer.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index 436b30445b2..b87164ba836 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -86,7 +86,10 @@ static void r300_copy_into_tiled_texture(struct pipe_context *ctx, struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer; struct pipe_resource *tex = transfer->resource; struct pipe_box src_box; - u_box_origin_2d(transfer->box.width, transfer->box.height, &src_box); + + u_box_3d(0, 0, 0, + transfer->box.width, transfer->box.height, transfer->box.depth, + &src_box); ctx->resource_copy_region(ctx, tex, transfer->level, transfer->box.x, transfer->box.y, transfer->box.z, @@ -107,7 +110,6 @@ r300_texture_transfer_map(struct pipe_context *ctx, struct r300_context *r300 = r300_context(ctx); struct r300_resource *tex = r300_resource(texture); struct r300_transfer *trans; - struct pipe_resource base; boolean referenced_cs, referenced_hw; enum pipe_format format = tex->b.b.format; char *map; @@ -135,6 +137,8 @@ r300_texture_transfer_map(struct pipe_context *ctx, if (tex->tex.microtile || tex->tex.macrotile[level] || (referenced_hw && !(usage & PIPE_TRANSFER_READ) && r300_is_blit_supported(texture->format))) { + struct pipe_resource base; + if (r300->blitter->running) { fprintf(stderr, "r300: ERROR: Blitter recursion in texture_get_transfer.\n"); os_break(); @@ -150,6 +154,15 @@ r300_texture_transfer_map(struct pipe_context *ctx, base.usage = PIPE_USAGE_STAGING; base.flags = R300_RESOURCE_FLAG_TRANSFER; + /* We must set the correct texture target and dimensions if needed for a 3D transfer. */ + if (box->depth > 1 && util_max_layer(texture, level) > 0) { + base.target = texture->target; + + if (base.target == PIPE_TEXTURE_3D) { + base.depth0 = util_next_power_of_two(box->depth); + } + } + /* Create the temporary texture. */ trans->linear_texture = r300_resource( ctx->screen->resource_create(ctx->screen, @@ -178,6 +191,8 @@ r300_texture_transfer_map(struct pipe_context *ctx, /* Set the stride. */ trans->transfer.stride = trans->linear_texture->tex.stride_in_bytes[0]; + trans->transfer.layer_stride = + trans->linear_texture->tex.layer_size_in_bytes[0]; if (usage & PIPE_TRANSFER_READ) { /* We cannot map a tiled texture directly because the data is @@ -190,6 +205,7 @@ r300_texture_transfer_map(struct pipe_context *ctx, } else { /* Unpipelined transfer. */ trans->transfer.stride = tex->tex.stride_in_bytes[level]; + trans->transfer.layer_stride = tex->tex.layer_size_in_bytes[level]; trans->offset = r300_texture_get_offset(tex, level, box->z); if (referenced_cs && |