zink: reorder barrier util functions to set up barrier struct before batch

no functional changes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9788>
This commit is contained in:
Mike Blumenkrantz 2020-11-30 12:27:24 -05:00
parent 7cee75f143
commit 86e1e1dafd

View file

@ -1602,9 +1602,6 @@ zink_resource_image_barrier(struct zink_context *ctx, struct zink_batch *batch,
flags = access_dst_flags(new_layout);
if (!zink_resource_image_needs_barrier(res, new_layout, flags, pipeline))
return;
/* only barrier if we're changing layout or doing something besides read -> read */
batch = zink_batch_no_rp(ctx);
assert(!batch->in_rp);
VkImageSubresourceRange isr = {
res->aspect,
0, VK_REMAINING_MIP_LEVELS,
@ -1623,6 +1620,9 @@ zink_resource_image_barrier(struct zink_context *ctx, struct zink_batch *batch,
res->obj->image,
isr
};
/* only barrier if we're changing layout or doing something besides read -> read */
batch = zink_batch_no_rp(ctx);
assert(!batch->in_rp);
vkCmdPipelineBarrier(
batch->state->cmdbuf,
res->access_stage ? res->access_stage : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
@ -1695,9 +1695,6 @@ zink_resource_buffer_barrier(struct zink_context *ctx, struct zink_batch *batch,
pipeline = pipeline_access_stage(flags);
if (!zink_resource_buffer_needs_barrier(res, flags, pipeline))
return;
/* only barrier if we're changing layout or doing something besides read -> read */
batch = zink_batch_no_rp(ctx);
assert(!batch->in_rp);
VkBufferMemoryBarrier bmb = {
VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
NULL,
@ -1709,7 +1706,9 @@ zink_resource_buffer_barrier(struct zink_context *ctx, struct zink_batch *batch,
res->obj->offset,
res->base.width0
};
/* only barrier if we're changing layout or doing something besides read -> read */
batch = zink_batch_no_rp(ctx);
assert(!batch->in_rp);
vkCmdPipelineBarrier(
batch->state->cmdbuf,
res->access_stage ? res->access_stage : pipeline_access_stage(res->access),