Skip to content

Commit bd7fd79

Browse files
authored
Fix potential resource dependency problem. (SaschaWillems#1079)
1 parent 59b7217 commit bd7fd79

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/computeraytracing/computeraytracing.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ class VulkanExample : public VulkanExampleBase
562562
VK_CHECK_RESULT(vkAllocateCommandBuffers(device, &cmdBufAllocateInfo, &compute.commandBuffer));
563563

564564
// Fence for compute CB sync
565-
VkFenceCreateInfo fenceCreateInfo = vks::initializers::fenceCreateInfo(VK_FENCE_CREATE_SIGNALED_BIT);
565+
VkFenceCreateInfo fenceCreateInfo = vks::initializers::fenceCreateInfo();
566566
VK_CHECK_RESULT(vkCreateFence(device, &fenceCreateInfo, nullptr, &compute.fence));
567567

568568
// Build a single command buffer containing the compute dispatch commands
@@ -604,15 +604,15 @@ class VulkanExample : public VulkanExampleBase
604604
{
605605
// Submit compute commands
606606
// Use a fence to ensure that compute command buffer has finished executing before using it again
607-
vkWaitForFences(device, 1, &compute.fence, VK_TRUE, UINT64_MAX);
608-
vkResetFences(device, 1, &compute.fence);
609-
610607
VkSubmitInfo computeSubmitInfo = vks::initializers::submitInfo();
611608
computeSubmitInfo.commandBufferCount = 1;
612609
computeSubmitInfo.pCommandBuffers = &compute.commandBuffer;
613610

614611
VK_CHECK_RESULT(vkQueueSubmit(compute.queue, 1, &computeSubmitInfo, compute.fence));
615612

613+
vkWaitForFences(device, 1, &compute.fence, VK_TRUE, UINT64_MAX);
614+
vkResetFences(device, 1, &compute.fence);
615+
616616
VulkanExampleBase::prepareFrame();
617617

618618
// Command buffer to be submitted to the queue

0 commit comments

Comments
 (0)