@@ -589,28 +589,23 @@ class VulkanExample : public VulkanExampleBase
589589 }
590590 else {
591591 firstDraw = false ;
592- if (maxConcurrentFrames > 1 )
593- {
594- // SRS - if we are double buffering the compute queue, submit extra command buffer at start
595- computeSubmitInfo.signalSemaphoreCount = 1 ;
596- computeSubmitInfo.pSignalSemaphores = &compute.semaphores [currentBuffer].complete ;
597- computeSubmitInfo.commandBufferCount = 1 ;
598- computeSubmitInfo.pCommandBuffers = &compute.commandBuffers [currentBuffer];
599-
600- VK_CHECK_RESULT (vkQueueSubmit (compute.queue , 1 , &computeSubmitInfo, compute.fences [currentBuffer]));
601-
602- VK_CHECK_RESULT (vkWaitForFences (device, 1 , &compute.fences [currentBuffer], VK_TRUE, UINT64_MAX));
603- VK_CHECK_RESULT (vkResetFences (device, 1 , &compute.fences [currentBuffer]));
604-
605- // Add an extra set of acquire and release barriers to the graphics queue,
606- // so that when the second compute command buffer executes for the first time
607- // it doesn't complain about a lack of a corresponding "acquire" to its "release" and vice versa
608- VkCommandBuffer barrierCmd = vulkanDevice->createCommandBuffer (VK_COMMAND_BUFFER_LEVEL_PRIMARY, true );
609- addComputeToGraphicsBarriers (barrierCmd, 0 , VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT);
610- addGraphicsToComputeBarriers (barrierCmd, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, 0 , VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
611- vulkanDevice->flushCommandBuffer (barrierCmd, queue, true );
612-
613- }
592+ computeSubmitInfo.signalSemaphoreCount = 1 ;
593+ computeSubmitInfo.pSignalSemaphores = &compute.semaphores [currentBuffer].complete ;
594+ computeSubmitInfo.commandBufferCount = 1 ;
595+ computeSubmitInfo.pCommandBuffers = &compute.commandBuffers [currentBuffer];
596+
597+ VK_CHECK_RESULT (vkQueueSubmit (compute.queue , 1 , &computeSubmitInfo, compute.fences [currentBuffer]));
598+
599+ VK_CHECK_RESULT (vkWaitForFences (device, 1 , &compute.fences [currentBuffer], VK_TRUE, UINT64_MAX));
600+ VK_CHECK_RESULT (vkResetFences (device, 1 , &compute.fences [currentBuffer]));
601+
602+ // Add an extra set of acquire and release barriers to the graphics queue,
603+ // so that when the second compute command buffer executes for the first time
604+ // it doesn't complain about a lack of a corresponding "acquire" to its "release" and vice versa
605+ VkCommandBuffer barrierCmd = vulkanDevice->createCommandBuffer (VK_COMMAND_BUFFER_LEVEL_PRIMARY, true );
606+ addComputeToGraphicsBarriers (barrierCmd, 0 , VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT);
607+ addGraphicsToComputeBarriers (barrierCmd, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, 0 , VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
608+ vulkanDevice->flushCommandBuffer (barrierCmd, queue, true );
614609 }
615610 computeSubmitInfo.signalSemaphoreCount = 1 ;
616611 computeSubmitInfo.pSignalSemaphores = &compute.semaphores [currentBuffer].complete ;
@@ -626,15 +621,9 @@ class VulkanExample : public VulkanExampleBase
626621
627622 buildGraphicsCommandBuffer ();
628623
629- VkPipelineStageFlags waitDstStageMask[2 ] = {
630- VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT
631- };
632- VkSemaphore waitSemaphores[2 ] = {
633- semaphores.presentComplete , compute.semaphores [currentBuffer].complete
634- };
635- VkSemaphore signalSemaphores[2 ] = {
636- semaphores.renderComplete , compute.semaphores [currentBuffer].ready
637- };
624+ VkPipelineStageFlags waitDstStageMask[2 ] = { VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT };
625+ VkSemaphore waitSemaphores[2 ] = { presentCompleteSemaphores[currentBuffer], compute.semaphores [currentBuffer].complete };
626+ VkSemaphore signalSemaphores[2 ] = { renderCompleteSemaphores[currentImageIndex], compute.semaphores [currentBuffer].ready };
638627
639628 VkSubmitInfo submitInfo = vks::initializers::submitInfo ();
640629 submitInfo.waitSemaphoreCount = 2 ;
0 commit comments