From 149148a29c0d016036db001446848e20619b305e Mon Sep 17 00:00:00 2001 From: scottchou007 <48142313+scottchou007@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:37:18 -0700 Subject: [PATCH] Fix potential resource dependency problem. --- examples/computeraytracing/computeraytracing.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/computeraytracing/computeraytracing.cpp b/examples/computeraytracing/computeraytracing.cpp index ac27db98d..ef782cdf4 100644 --- a/examples/computeraytracing/computeraytracing.cpp +++ b/examples/computeraytracing/computeraytracing.cpp @@ -740,7 +740,7 @@ class VulkanExample : public VulkanExampleBase VK_CHECK_RESULT(vkAllocateCommandBuffers(device, &cmdBufAllocateInfo, &compute.commandBuffer)); // Fence for compute CB sync - VkFenceCreateInfo fenceCreateInfo = vks::initializers::fenceCreateInfo(VK_FENCE_CREATE_SIGNALED_BIT); + VkFenceCreateInfo fenceCreateInfo = vks::initializers::fenceCreateInfo(); VK_CHECK_RESULT(vkCreateFence(device, &fenceCreateInfo, nullptr, &compute.fence)); // Build a single command buffer containing the compute dispatch commands @@ -775,15 +775,15 @@ class VulkanExample : public VulkanExampleBase { // Submit compute commands // Use a fence to ensure that compute command buffer has finished executing before using it again - vkWaitForFences(device, 1, &compute.fence, VK_TRUE, UINT64_MAX); - vkResetFences(device, 1, &compute.fence); - VkSubmitInfo computeSubmitInfo = vks::initializers::submitInfo(); computeSubmitInfo.commandBufferCount = 1; computeSubmitInfo.pCommandBuffers = &compute.commandBuffer; VK_CHECK_RESULT(vkQueueSubmit(compute.queue, 1, &computeSubmitInfo, compute.fence)); + vkWaitForFences(device, 1, &compute.fence, VK_TRUE, UINT64_MAX); + vkResetFences(device, 1, &compute.fence); + VulkanExampleBase::prepareFrame(); // Command buffer to be submitted to the queue