Skip to content
Snippets Groups Projects
Unverified Commit f4197f93 authored by ShoufengYang's avatar ShoufengYang Committed by GitHub
Browse files

Fixed the first frame render error.

The compute commands should be submit before the graphic command. If not, there is a logical error that cause the first frame render error.  Since the graphic rendering need to sample the compute shader 's output image.
parent ab2d4060
Branches
No related tags found
No related merge requests found
...@@ -666,15 +666,6 @@ public: ...@@ -666,15 +666,6 @@ public:
void draw() void draw()
{ {
VulkanExampleBase::prepareFrame();
// Command buffer to be submitted to the queue
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
VulkanExampleBase::submitFrame();
// Submit compute commands // Submit compute commands
// Use a fence to ensure that compute command buffer has finished executing before using it again // 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); vkWaitForFences(device, 1, &compute.fence, VK_TRUE, UINT64_MAX);
...@@ -685,6 +676,15 @@ public: ...@@ -685,6 +676,15 @@ public:
computeSubmitInfo.pCommandBuffers = &compute.commandBuffer; computeSubmitInfo.pCommandBuffers = &compute.commandBuffer;
VK_CHECK_RESULT(vkQueueSubmit(compute.queue, 1, &computeSubmitInfo, compute.fence)); VK_CHECK_RESULT(vkQueueSubmit(compute.queue, 1, &computeSubmitInfo, compute.fence));
VulkanExampleBase::prepareFrame();
// Command buffer to be submitted to the queue
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
VulkanExampleBase::submitFrame();
} }
void prepare() void prepare()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment