zink: hook up buffer TRANSFER_DST barrier optimizing

this should massively optimize e.g., incremental index buffer overwrites

ref #8358

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21779>
This commit is contained in:
Mike Blumenkrantz 2023-02-27 13:50:13 -05:00 committed by Marge Bot
parent fe469a7618
commit aaed609e57
2 changed files with 3 additions and 3 deletions

View File

@ -512,7 +512,7 @@ zink_clear_buffer(struct pipe_context *pctx,
or VK_WHOLE_SIZE to fill the range from offset to the end of the buffer
*/
util_range_add(&res->base.b, &res->valid_buffer_range, offset, offset + size);
zink_screen(ctx->base.screen)->buffer_barrier(ctx, res, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
zink_resource_buffer_transfer_dst_barrier(ctx, res, offset, size);
VkCommandBuffer cmdbuf = zink_get_cmdbuf(ctx, NULL, res);
zink_batch_reference_resource_rw(&ctx->batch, res, true);
VKCTX(CmdFillBuffer)(cmdbuf, res->obj->buffer, offset, size, *(uint32_t*)clear_value);

View File

@ -4678,7 +4678,7 @@ zink_copy_buffer(struct zink_context *ctx, struct zink_resource *dst, struct zin
struct zink_batch *batch = &ctx->batch;
util_range_add(&dst->base.b, &dst->valid_buffer_range, dst_offset, dst_offset + size);
zink_screen(ctx->base.screen)->buffer_barrier(ctx, src, VK_ACCESS_TRANSFER_READ_BIT, 0);
zink_screen(ctx->base.screen)->buffer_barrier(ctx, dst, VK_ACCESS_TRANSFER_WRITE_BIT, 0);
zink_resource_buffer_transfer_dst_barrier(ctx, dst, dst_offset, size);
VkCommandBuffer cmdbuf = zink_get_cmdbuf(ctx, src, dst);
zink_batch_reference_resource_rw(batch, src, false);
zink_batch_reference_resource_rw(batch, dst, true);
@ -4712,7 +4712,7 @@ zink_copy_image_buffer(struct zink_context *ctx, struct zink_resource *dst, stru
if (zink_is_swapchain(img))
needs_present_readback = zink_kopper_acquire_readback(ctx, img);
zink_screen(ctx->base.screen)->image_barrier(ctx, img, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, 0, 0);
zink_screen(ctx->base.screen)->buffer_barrier(ctx, buf, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
zink_resource_buffer_transfer_dst_barrier(ctx, buf, dstx, src_box->width);
util_range_add(&dst->base.b, &dst->valid_buffer_range, dstx, dstx + src_box->width);
}