Hi.
After enabling synchronization debugging I got very weird issue with it:
[ SYNC-HAZARD-WRITE-AFTER-READ ]
Object 0: handle = 0x5e592bc393f0, type = VK_OBJECT_TYPE_QUEUE; |
MessageID = 0x376bc9df | vkQueueSubmit(): Hazard WRITE_AFTER_READ for entry 1, VkCommandBuffer 0x5e592c15c1e0[],
Submitted access info (submitted_usage: SYNC_COPY_TRANSFER_WRITE, command: vkCmdCopyBuffer, seq_no: 1, reset_no: 52).
Access info (prior_usage: SYNC_VERTEX_ATTRIBUTE_INPUT_VERTEX_ATTRIBUTE_READ,
read_barriers: VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT,
queue: VkQueue 0x5e592bc393f0[], submit: 97, batch: 0, batch_tag: 926,
command: vkCmdDraw,
command_buffer: VkCommandBuffer 0x5e592c159720[], seq_no: 13, reset_no: 50).
Here is my global barrier that I am setting before draws and after copy operations:
VkMemoryBarrier2 barrier =
{
.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER_2,
.srcStageMask = VK_PIPELINE_STAGE_2_COPY_BIT,
.srcAccessMask = VK_ACCESS_2_TRANSFER_WRITE_BIT,
.dstStageMask = VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT | VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT,
.dstAccessMask = VK_ACCESS_2_INDEX_READ_BIT | VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT
};
Also I tried:
VkMemoryBarrier2 barrier =
{
.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER_2,
.srcStageMask = VK_PIPELINE_STAGE_2_TRANSFER_BIT,
.srcAccessMask = VK_ACCESS_2_MEMORY_WRITE_BIT,
.dstStageMask = VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT | VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT,
.dstAccessMask = VK_ACCESS_2_MEMORY_READ_BIT
};
And a few other combinations, but nothing helps.
Can it be a bug in drivers or validation layers?
Also I have two frames in flight, and frequently call vkCmdCopyBuffers
from staging to gpu buffers, and I have unique buffers for each frame.