Updated draw functions using base class frame prepare and submit

This commit is contained in:
saschawillems 2016-06-21 21:55:31 +02:00
parent 1b376da279
commit 037804f3b9
2 changed files with 39 additions and 62 deletions

View file

@ -867,30 +867,6 @@ public:
textOverlay->endTextUpdate();
}
void draw()
{
// Get next image in the swap chain (back/front buffer)
VK_CHECK_RESULT(swapChain.acquireNextImage(semaphores.presentComplete, &currentBuffer));
submitPostPresentBarrier(swapChain.buffers[currentBuffer].image);
// Command buffer to be sumitted to the queue
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
// Submit to queue
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
// Submit text overlay to queue
textOverlay->submit(queue, currentBuffer);
submitPrePresentBarrier(swapChain.buffers[currentBuffer].image);
VK_CHECK_RESULT(swapChain.queuePresent(queue, currentBuffer, semaphores.renderComplete));
VK_CHECK_RESULT(vkQueueWaitIdle(queue));
}
void loadTextures()
{
textureLoader->loadTexture(getAssetPath() + "textures/skysphere_bc3.ktx", VK_FORMAT_BC3_UNORM_BLOCK, &textures.background);
@ -1184,6 +1160,23 @@ public:
updateTextOverlay();
}
void draw()
{
VulkanExampleBase::prepareFrame();
// Command buffer to be sumitted to the queue
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
// Submit to queue
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
// Submit text overlay to queue
textOverlay->submit(queue, currentBuffer);
VulkanExampleBase::submitFrame();
}
void prepare()
{
VulkanExampleBase::prepare();