Updated multithreading sample to explicitly call drawUI (updated ImGUI version)

Refs #496
This commit is contained in:
saschawillems 2018-08-31 22:33:26 +02:00
parent 69c3f62b9a
commit 73dbdfcbda

View file

@ -33,6 +33,8 @@
class VulkanExample : public VulkanExampleBase
{
public:
bool displaySkybox = true;
// Vertex layout for the models
vks::VertexLayout vertexLayout = vks::VertexLayout({
vks::VERTEX_COMPONENT_POSITION,
@ -318,6 +320,8 @@ public:
vkCmdBindPipeline(secondaryCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.starsphere);
if (displaySkybox) {
glm::mat4 view = glm::mat4(1.0f);
view = glm::rotate(view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f));
view = glm::rotate(view, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f));
@ -337,6 +341,13 @@ public:
vkCmdBindVertexBuffers(secondaryCommandBuffer, 0, 1, &models.skysphere.vertices.buffer, offsets);
vkCmdBindIndexBuffer(secondaryCommandBuffer, models.skysphere.indices.buffer, 0, VK_INDEX_TYPE_UINT32);
vkCmdDrawIndexed(secondaryCommandBuffer, models.skysphere.indexCount, 1, 0, 0, 0);
}
// With VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS, the primary command buffer's content has to be defined
// by secondary command buffers, which also applies to the UI overlay command buffer
if (settings.overlay) {
drawUI(secondaryCommandBuffer);
}
VK_CHECK_RESULT(vkEndCommandBuffer(secondaryCommandBuffer));
}
@ -633,6 +644,10 @@ public:
if (overlay->header("Statistics")) {
overlay->text("Active threads: %d", numThreads);
}
if (overlay->header("Settings")) {
overlay->checkBox("Skybox", &displaySkybox);
}
}
};