Skip to content

Commit

Permalink
fixup! fixup! Fix barrier issues in computecloth
Browse files Browse the repository at this point in the history
  • Loading branch information
jherico committed Feb 5, 2024
1 parent 2f664d7 commit e1466f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions base/VulkanDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion base/VulkanInitializers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 5 additions & 0 deletions examples/computecloth/computecloth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit e1466f9

Please sign in to comment.