Skip to content

Commit b683e95

Browse files
committed
Make submit info optional
1 parent cfeb1fe commit b683e95

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

base/vulkanexamplebase.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ 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
182183
void VulkanExampleBase::renderFrame()
183184
{
184185
VulkanExampleBase::prepareFrame();
@@ -800,17 +801,19 @@ void VulkanExampleBase::prepareFrame()
800801
}
801802
}
802803

803-
void VulkanExampleBase::submitFrame()
804+
void VulkanExampleBase::submitFrame(bool skipQueueSubmit)
804805
{
805806
if (useNewSync) {
806-
submitInfo.commandBufferCount = 1;
807807
// @todo: make this an argument
808-
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
809-
submitInfo.pWaitSemaphores = &presentCompleteSemaphores[currentBuffer];
810-
submitInfo.waitSemaphoreCount = 1;
811-
submitInfo.pSignalSemaphores = &renderCompleteSemaphores[currentImageIndex];
812-
submitInfo.signalSemaphoreCount = 1;
813-
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, waitFences[currentBuffer]));
808+
if (!skipQueueSubmit) {
809+
submitInfo.commandBufferCount = 1;
810+
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
811+
submitInfo.pWaitSemaphores = &presentCompleteSemaphores[currentBuffer];
812+
submitInfo.waitSemaphoreCount = 1;
813+
submitInfo.pSignalSemaphores = &renderCompleteSemaphores[currentImageIndex];
814+
submitInfo.signalSemaphoreCount = 1;
815+
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, waitFences[currentBuffer]));
816+
}
814817

815818
VkPresentInfoKHR presentInfo{ VK_STRUCTURE_TYPE_PRESENT_INFO_KHR };
816819
presentInfo.waitSemaphoreCount = 1;
@@ -1208,6 +1211,7 @@ bool VulkanExampleBase::initVulkan()
12081211
// Set up submit info structure
12091212
// Semaphores will stay the same during application lifetime
12101213
// Command buffer submission info is set by each example
1214+
// @todo: Rework when new sync is fully in place, feels odd building/setting this up in multiple places
12111215
submitInfo = vks::initializers::submitInfo();
12121216
submitInfo.pWaitDstStageMask = &submitPipelineStages;
12131217
submitInfo.waitSemaphoreCount = 1;

base/vulkanexamplebase.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,8 @@ class VulkanExampleBase
416416
/** Prepare the next frame for workload submission by acquiring the next swap chain image and waiting for the previous command buffer to finish */
417417
void prepareFrame();
418418
/** @brief Presents the current image to the swap chain */
419-
void submitFrame();
419+
// @todo: rework once new sync is in place, maybe overload with submission info
420+
void submitFrame(bool skipQueueSubmit = false);
420421
/** @brief (Virtual) Default image acquire + submission and command buffer submission function */
421422
virtual void renderFrame();
422423

0 commit comments

Comments
 (0)