diff options
author | Marek Olšák <[email protected]> | 2016-05-12 13:26:24 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-05-19 12:35:50 +0200 |
commit | f6742859b76de8c90a8593f2f308e7c22380a390 (patch) | |
tree | 2752b6be6424745808ce6df6a9a8721a47fb0c33 /src/gallium/drivers/radeon | |
parent | 54737aabb9ec914baed43656b88e39f1153c7ff9 (diff) |
gallium/radeon: small cleanups in r600_texture_transfer_map
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index a00dedcd3ec..e2955aa8956 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1237,6 +1237,8 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, unsigned offset = 0; char *map; + assert(!(texture->flags & R600_RESOURCE_FLAG_TRANSFER)); + /* We cannot map a tiled texture directly because the data is * in a different order, therefore we do detiling using a blit. * @@ -1257,10 +1259,6 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, use_staging_texture = TRUE; } - if (texture->flags & R600_RESOURCE_FLAG_TRANSFER) { - use_staging_texture = FALSE; - } - trans = CALLOC_STRUCT(r600_transfer); if (!trans) return NULL; @@ -1327,6 +1325,7 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, trans->transfer.stride = staging_depth->surface.level[level].pitch_bytes; trans->transfer.layer_stride = staging_depth->surface.level[level].slice_size; trans->staging = (struct r600_resource*)staging_depth; + buf = trans->staging; } else if (use_staging_texture) { struct pipe_resource resource; struct r600_texture *staging; @@ -1346,21 +1345,18 @@ static void *r600_texture_transfer_map(struct pipe_context *ctx, trans->staging = &staging->resource; trans->transfer.stride = staging->surface.level[0].pitch_bytes; trans->transfer.layer_stride = staging->surface.level[0].slice_size; - if (usage & PIPE_TRANSFER_READ) { + + if (usage & PIPE_TRANSFER_READ) r600_copy_to_staging_texture(ctx, trans); - } + else + usage |= PIPE_TRANSFER_UNSYNCHRONIZED; + + buf = trans->staging; } else { /* the resource is mapped directly */ trans->transfer.stride = rtex->surface.level[level].pitch_bytes; trans->transfer.layer_stride = rtex->surface.level[level].slice_size; offset = r600_texture_get_offset(rtex, level, box); - } - - if (trans->staging) { - buf = trans->staging; - if (!rtex->is_depth && !(usage & PIPE_TRANSFER_READ)) - usage |= PIPE_TRANSFER_UNSYNCHRONIZED; - } else { buf = &rtex->resource; } |