Added text overlay, removed device wait idle

This commit is contained in:
saschawillems 2016-05-26 19:13:14 +02:00
parent c3c610e7d5
commit 62df70f698

View file

@ -90,6 +90,7 @@ public:
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
{ {
enableTextOverlay = true;
title = "Vulkan Example - Compute shader particle system"; title = "Vulkan Example - Compute shader particle system";
} }
@ -225,25 +226,6 @@ public:
} }
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));
submitPrePresentBarrier(swapChain.buffers[currentBuffer].image);
VK_CHECK_RESULT(swapChain.queuePresent(queue, currentBuffer, semaphores.renderComplete));
}
// Setup and fill the compute shader storage buffers for // Setup and fill the compute shader storage buffers for
// vertex positions and velocities // vertex positions and velocities
void prepareStorageBuffers() void prepareStorageBuffers()
@ -590,6 +572,7 @@ public:
// Compute shader uniform buffer block // Compute shader uniform buffer block
createBuffer( createBuffer(
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
sizeof(computeUbo), sizeof(computeUbo),
nullptr, nullptr,
&uniformData.computeShader.ubo.buffer, &uniformData.computeShader.ubo.buffer,
@ -648,6 +631,17 @@ public:
vkGetDeviceQueue(device, queueIndex, 0, &computeQueue); vkGetDeviceQueue(device, queueIndex, 0, &computeQueue);
} }
void draw()
{
VulkanExampleBase::prepareFrame();
submitInfo.commandBufferCount = 1;
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
VulkanExampleBase::submitFrame();
}
void prepare() void prepare()
{ {
VulkanExampleBase::prepare(); VulkanExampleBase::prepare();
@ -684,7 +678,6 @@ public:
} }
} }
vkDeviceWaitIdle(device);
updateUniformBuffers(); updateUniformBuffers();
} }