@@ -179,16 +179,6 @@ VkResult VulkanExampleBase::createInstance()
179179 return result;
180180}
181181
182- // @todo: Only used by few examples, can be removed when new sync is fully in place
183- void VulkanExampleBase::renderFrame ()
184- {
185- VulkanExampleBase::prepareFrame ();
186- submitInfo.commandBufferCount = 1 ;
187- submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
188- VK_CHECK_RESULT (vkQueueSubmit (queue, 1 , &submitInfo, VK_NULL_HANDLE));
189- VulkanExampleBase::submitFrame ();
190- }
191-
192182std::string VulkanExampleBase::getWindowTitle () const
193183{
194184 std::string windowTitle{ title + " - " + deviceProperties.deviceName };
@@ -758,12 +748,14 @@ void VulkanExampleBase::drawUI(const VkCommandBuffer commandBuffer)
758748 }
759749}
760750
761- void VulkanExampleBase::prepareFrame ()
751+ void VulkanExampleBase::prepareFrame (bool waitForFence )
762752{
763753 if (useNewSync) {
764754 // Ensure command buffer execution has finished
765- VK_CHECK_RESULT (vkWaitForFences (device, 1 , &waitFences[currentBuffer], VK_TRUE, UINT64_MAX));
766- VK_CHECK_RESULT (vkResetFences (device, 1 , &waitFences[currentBuffer]));
755+ if (waitForFence) {
756+ VK_CHECK_RESULT (vkWaitForFences (device, 1 , &waitFences[currentBuffer], VK_TRUE, UINT64_MAX));
757+ VK_CHECK_RESULT (vkResetFences (device, 1 , &waitFences[currentBuffer]));
758+ }
767759 // Update UI if necessary
768760 updateOverlay ();
769761 // Acquire the next image from the swap chain
@@ -797,13 +789,20 @@ void VulkanExampleBase::prepareFrame()
797789 }
798790}
799791
800- void VulkanExampleBase::submitFrame (bool skipQueueSubmit)
792+ void VulkanExampleBase::submitFrame (VkCommandBuffer cmdBuffer, bool skipQueueSubmit)
801793{
802794 if (useNewSync) {
803795 // @todo: make this an argument
804796 if (!skipQueueSubmit) {
797+ const VkPipelineStageFlags waitPipelineStage{ VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT };
798+ VkSubmitInfo submitInfo{ .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO };
799+ submitInfo.pWaitDstStageMask = &waitPipelineStage;
805800 submitInfo.commandBufferCount = 1 ;
806- submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
801+ if (cmdBuffer != VK_NULL_HANDLE) {
802+ submitInfo.pCommandBuffers = &cmdBuffer;
803+ } else {
804+ submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
805+ }
807806 submitInfo.pWaitSemaphores = &presentCompleteSemaphores[currentBuffer];
808807 submitInfo.waitSemaphoreCount = 1 ;
809808 submitInfo.pSignalSemaphores = &renderCompleteSemaphores[currentImageIndex];
@@ -1204,17 +1203,6 @@ bool VulkanExampleBase::initVulkan()
12041203 // Ensures that the image is not presented until all commands have been submitted and executed
12051204 VK_CHECK_RESULT (vkCreateSemaphore (device, &semaphoreCreateInfo, nullptr , &semaphores.renderComplete ));
12061205
1207- // Set up submit info structure
1208- // Semaphores will stay the same during application lifetime
1209- // Command buffer submission info is set by each example
1210- // @todo: Rework when new sync is fully in place, feels odd building/setting this up in multiple places
1211- submitInfo = vks::initializers::submitInfo ();
1212- submitInfo.pWaitDstStageMask = &submitPipelineStages;
1213- submitInfo.waitSemaphoreCount = 1 ;
1214- submitInfo.pWaitSemaphores = &semaphores.presentComplete ;
1215- submitInfo.signalSemaphoreCount = 1 ;
1216- submitInfo.pSignalSemaphores = &semaphores.renderComplete ;
1217-
12181206 return true ;
12191207}
12201208
0 commit comments