static void si_texture_transfer_destroy(struct pipe_context *ctx, struct pipe_transfer *transfer) { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct pipe_resource *texture = transfer->resource; struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; if (rtransfer->staging_texture) { if (transfer->usage & PIPE_TRANSFER_WRITE) { r600_copy_from_staging_texture(ctx, rtransfer); } pipe_resource_reference(&rtransfer->staging_texture, NULL); } if (rtex->depth && !rtex->is_flushing_texture) { if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtex->flushed_depth_texture) r600_blit_push_depth(ctx, rtex); } pipe_resource_reference(&transfer->resource, NULL); FREE(transfer); }
static void si_texture_transfer_unmap(struct pipe_context *ctx, struct pipe_transfer* transfer) { struct r600_transfer *rtransfer = (struct r600_transfer*)transfer; struct r600_context *rctx = (struct r600_context*)ctx; struct radeon_winsys_cs_handle *buf; struct pipe_resource *texture = transfer->resource; struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; if (rtransfer->staging_texture) { buf = si_resource(rtransfer->staging_texture)->cs_buf; } else { struct r600_resource_texture *rtex = (struct r600_resource_texture*)transfer->resource; if (rtex->flushed_depth_texture) { buf = rtex->flushed_depth_texture->resource.cs_buf; } else { buf = si_resource(transfer->resource)->cs_buf; } } rctx->ws->buffer_unmap(buf); if (rtransfer->staging_texture) { if (transfer->usage & PIPE_TRANSFER_WRITE) { r600_copy_from_staging_texture(ctx, rtransfer); } pipe_resource_reference(&rtransfer->staging_texture, NULL); } if (rtex->depth && !rtex->is_flushing_texture) { if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtex->flushed_depth_texture) r600_blit_push_depth(ctx, rtex); } pipe_resource_reference(&transfer->resource, NULL); FREE(transfer); }