zink: switch to memory barriers instead of actual buffer barriers

drivers don't seem to actually use the buffer part of the info, so this is
just wasting cycles initializing the values

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10996>
This commit is contained in:
Mike Blumenkrantz 2021-01-21 14:40:26 -05:00 committed by Marge Bot
parent e46b0e87f2
commit e4e20556d6
1 changed files with 6 additions and 4 deletions

View File

@ -2053,14 +2053,16 @@ zink_resource_buffer_barrier_init(VkBufferMemoryBarrier *bmb, struct zink_resour
void
zink_resource_buffer_barrier(struct zink_context *ctx, struct zink_batch *batch, struct zink_resource *res, VkAccessFlags flags, VkPipelineStageFlags pipeline)
{
VkBufferMemoryBarrier bmb;
if (!zink_resource_buffer_barrier_init(&bmb, res, flags, pipeline))
return;
VkMemoryBarrier bmb;
if (!pipeline)
pipeline = pipeline_access_stage(flags);
if (!zink_resource_buffer_needs_barrier(res, flags, pipeline))
return;
bmb.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
bmb.pNext = NULL;
bmb.srcAccessMask = res->access;
bmb.dstAccessMask = flags;
VkCommandBuffer cmdbuf = get_cmdbuf(ctx, res);
/* only barrier if we're changing layout or doing something besides read -> read */
vkCmdPipelineBarrier(
@ -2068,8 +2070,8 @@ zink_resource_buffer_barrier(struct zink_context *ctx, struct zink_batch *batch,
res->access_stage ? res->access_stage : pipeline_access_stage(res->access),
pipeline,
0,
0, NULL,
1, &bmb,
0, NULL,
0, NULL
);