From e1466f9f212d2c8f28c850666ad129bc61b87418 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 5 Feb 2024 12:50:26 -0800 Subject: [PATCH] fixup! fixup! Fix barrier issues in computecloth --- base/VulkanDevice.cpp | 3 --- base/VulkanInitializers.hpp | 1 - examples/computecloth/computecloth.cpp | 5 +++++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/base/VulkanDevice.cpp b/base/VulkanDevice.cpp index 01c1c0c09..b508a0999 100644 --- a/base/VulkanDevice.cpp +++ b/base/VulkanDevice.cpp @@ -490,9 +490,6 @@ namespace vks if (begin) { VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo(); - // If we're allocating AND starting the command buffer, we're almost certainly going to - // use it right away, so we'll use the ONE_TIME_SUBMIT_BIT flag - cmdBufInfo.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; VK_CHECK_RESULT(vkBeginCommandBuffer(cmdBuffer, &cmdBufInfo)); } return cmdBuffer; diff --git a/base/VulkanInitializers.hpp b/base/VulkanInitializers.hpp index 62a6b0435..2feabf4dd 100644 --- a/base/VulkanInitializers.hpp +++ b/base/VulkanInitializers.hpp @@ -97,7 +97,6 @@ namespace vks bufferMemoryBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; bufferMemoryBarrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; bufferMemoryBarrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - bufferMemoryBarrier.size = VK_WHOLE_SIZE; return bufferMemoryBarrier; } diff --git a/examples/computecloth/computecloth.cpp b/examples/computecloth/computecloth.cpp index ae75aab95..e0a74b776 100644 --- a/examples/computecloth/computecloth.cpp +++ b/examples/computecloth/computecloth.cpp @@ -159,6 +159,7 @@ class VulkanExample : public VulkanExampleBase bufferBarrier.srcQueueFamilyIndex = vulkanDevice->queueFamilyIndices.graphics; bufferBarrier.dstQueueFamilyIndex = vulkanDevice->queueFamilyIndices.compute; bufferBarrier.buffer = storageBuffers.output.buffer; + bufferBarrier.size = VK_WHOLE_SIZE; vkCmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, @@ -176,10 +177,12 @@ class VulkanExample : public VulkanExampleBase bufferBarriers[0].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; bufferBarriers[0].dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT; bufferBarriers[0].buffer = storageBuffers.input.buffer; + bufferBarriers[0].size = VK_WHOLE_SIZE; bufferBarriers[1] = vks::initializers::bufferMemoryBarrier(); bufferBarriers[1].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; bufferBarriers[1].dstAccessMask = VK_ACCESS_SHADER_READ_BIT; bufferBarriers[1].buffer = storageBuffers.output.buffer; + bufferBarriers[1].size = VK_WHOLE_SIZE; if (reverse) { std::swap(bufferBarriers[0].buffer, bufferBarriers[1].buffer); } @@ -327,10 +330,12 @@ class VulkanExample : public VulkanExampleBase bufferBarriers[0].srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; bufferBarriers[0].dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; bufferBarriers[0].buffer = storageBuffers.input.buffer; + bufferBarriers[0].size = VK_WHOLE_SIZE; bufferBarriers[1] = vks::initializers::bufferMemoryBarrier(); bufferBarriers[1].srcAccessMask = VK_ACCESS_SHADER_READ_BIT; bufferBarriers[1].dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT; bufferBarriers[1].buffer = storageBuffers.output.buffer; + bufferBarriers[1].size = VK_WHOLE_SIZE; vkCmdPipelineBarrier( compute.commandBuffers[i], VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,