Add missing pipeline barrier in Apply_InitialState()

The commands to initialize srcBuf must complete before it is copied. Sync
validation reports this as a READ_AFTER_WRITE hazard.  This also fixes a
VK_Image_Layouts test failure when running with KosmicKrisp.
This commit is contained in:
Jeremy Gebben authored and Baldur Karlsson committed 2026-09-09 04:11:01 +09:00
1 parent 8a15c19d6b
commit 3fbf0d871c
1 file changed
+16
+16
View File
@@ -2084,6 +2084,22 @@ void WrappedVulkan::Apply_InitialState(WrappedVkRes *res, VkInitialContents &ini
}
else
{
// srcBuf was initilized with a vkCmdCopyBuffer() or vkCmdFillBuffer() earlier
// in this command buffer. Add a barrier to make sure that command finishes
// before this copy.
VkBufferMemoryBarrier srcBufBarrier = {
VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
NULL,
VK_ACCESS_TRANSFER_WRITE_BIT,
VK_ACCESS_TRANSFER_READ_BIT,
VK_QUEUE_FAMILY_IGNORED,
VK_QUEUE_FAMILY_IGNORED,
Unwrap(srcBuf),
0,
VK_WHOLE_SIZE,
};
DoPipelineBarrier(cmd, 1, &srcBufBarrier);
VkBufferCopy bufCopy;
bufCopy.srcOffset = boundMemoryOffset;
bufCopy.size = boundMemorySize;