diff --git a/examples/bloom/bloom.cpp b/examples/bloom/bloom.cpp index 50ea492d..2c4da834 100644 --- a/examples/bloom/bloom.cpp +++ b/examples/bloom/bloom.cpp @@ -509,6 +509,8 @@ public: vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/computecloth/computecloth.cpp b/examples/computecloth/computecloth.cpp index bd8417f2..7f5e3c28 100644 --- a/examples/computecloth/computecloth.cpp +++ b/examples/computecloth/computecloth.cpp @@ -210,6 +210,8 @@ public: vkCmdBindVertexBuffers(drawCmdBuffers[i], 0, 1, &compute.storageBuffers.output.buffer, offsets); vkCmdDrawIndexed(drawCmdBuffers[i], indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); @@ -692,11 +694,11 @@ public: void draw() { - VkSubmitInfo computeSubmitInfo = vks::initializers::submitInfo(); - computeSubmitInfo.commandBufferCount = 1; - computeSubmitInfo.pCommandBuffers = &compute.commandBuffers[readSet]; + VkSubmitInfo computeSubmitInfo = vks::initializers::submitInfo(); + computeSubmitInfo.commandBufferCount = 1; + computeSubmitInfo.pCommandBuffers = &compute.commandBuffers[readSet]; - VK_CHECK_RESULT( vkQueueSubmit( compute.queue, 1, &computeSubmitInfo, compute.fence ) ); + VK_CHECK_RESULT( vkQueueSubmit( compute.queue, 1, &computeSubmitInfo, compute.fence ) ); // Submit graphics commands VulkanExampleBase::prepareFrame(); diff --git a/examples/computecullandlod/computecullandlod.cpp b/examples/computecullandlod/computecullandlod.cpp index 2bcfd166..b0d8ad7d 100644 --- a/examples/computecullandlod/computecullandlod.cpp +++ b/examples/computecullandlod/computecullandlod.cpp @@ -211,6 +211,8 @@ public: } } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/computenbody/computenbody.cpp b/examples/computenbody/computenbody.cpp index 2789da16..4aca49d7 100644 --- a/examples/computenbody/computenbody.cpp +++ b/examples/computenbody/computenbody.cpp @@ -178,9 +178,11 @@ public: VkDeviceSize offsets[1] = { 0 }; vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &compute.storageBuffer.buffer, offsets); vkCmdDraw(drawCmdBuffers[i], numParticles, 1, 0, 0); + + drawUI(drawCmdBuffers[i]); vkCmdEndRenderPass(drawCmdBuffers[i]); - + VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); } diff --git a/examples/computeparticles/computeparticles.cpp b/examples/computeparticles/computeparticles.cpp index 9b61381f..115e9b06 100644 --- a/examples/computeparticles/computeparticles.cpp +++ b/examples/computeparticles/computeparticles.cpp @@ -166,6 +166,8 @@ public: vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &compute.storageBuffer.buffer, offsets); vkCmdDraw(drawCmdBuffers[i], PARTICLE_COUNT, 1, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); @@ -599,11 +601,11 @@ public: void draw() { - VkSubmitInfo computeSubmitInfo = vks::initializers::submitInfo(); - computeSubmitInfo.commandBufferCount = 1; - computeSubmitInfo.pCommandBuffers = &compute.commandBuffer; + VkSubmitInfo computeSubmitInfo = vks::initializers::submitInfo(); + computeSubmitInfo.commandBufferCount = 1; + computeSubmitInfo.pCommandBuffers = &compute.commandBuffer; - VK_CHECK_RESULT( vkQueueSubmit( compute.queue, 1, &computeSubmitInfo, compute.fence ) ); + VK_CHECK_RESULT( vkQueueSubmit( compute.queue, 1, &computeSubmitInfo, compute.fence ) ); // Submit graphics commands VulkanExampleBase::prepareFrame(); diff --git a/examples/computeshader/computeshader.cpp b/examples/computeshader/computeshader.cpp index 12526268..37d13447 100644 --- a/examples/computeshader/computeshader.cpp +++ b/examples/computeshader/computeshader.cpp @@ -276,6 +276,8 @@ public: vkCmdSetViewport(drawCmdBuffers[i], 0, 1, &viewport); vkCmdDrawIndexed(drawCmdBuffers[i], indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/conservativeraster/conservativeraster.cpp b/examples/conservativeraster/conservativeraster.cpp index a5bd15c4..cd80b350 100644 --- a/examples/conservativeraster/conservativeraster.cpp +++ b/examples/conservativeraster/conservativeraster.cpp @@ -419,6 +419,8 @@ public: vkCmdBindDescriptorSets(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayouts.scene, 0, 1, &descriptorSets.scene, 0, nullptr); vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/debugmarker/debugmarker.cpp b/examples/debugmarker/debugmarker.cpp index c79e84c3..227c0485 100644 --- a/examples/debugmarker/debugmarker.cpp +++ b/examples/debugmarker/debugmarker.cpp @@ -633,6 +633,8 @@ public: } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); // End current debug marker region diff --git a/examples/deferred/deferred.cpp b/examples/deferred/deferred.cpp index 2c9dcce3..10d407e3 100644 --- a/examples/deferred/deferred.cpp +++ b/examples/deferred/deferred.cpp @@ -594,6 +594,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], models.quad.indices.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], 6, 1, 0, 0, 1); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/deferredmultisampling/deferredmultisampling.cpp b/examples/deferredmultisampling/deferredmultisampling.cpp index 648b9d86..24aa1cf6 100644 --- a/examples/deferredmultisampling/deferredmultisampling.cpp +++ b/examples/deferredmultisampling/deferredmultisampling.cpp @@ -558,6 +558,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, useMSAA ? pipelines.deferred : pipelines.deferredNoMSAA); vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/deferredshadows/deferredshadows.cpp b/examples/deferredshadows/deferredshadows.cpp index 084e7c24..aa9801a6 100644 --- a/examples/deferredshadows/deferredshadows.cpp +++ b/examples/deferredshadows/deferredshadows.cpp @@ -525,6 +525,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], 6, LIGHT_COUNT, 0, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/descriptorsets/descriptorsets.cpp b/examples/descriptorsets/descriptorsets.cpp index b905b596..651dd6e3 100644 --- a/examples/descriptorsets/descriptorsets.cpp +++ b/examples/descriptorsets/descriptorsets.cpp @@ -135,6 +135,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.cube.indexCount, 1, 0, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/displacement/displacement.cpp b/examples/displacement/displacement.cpp index b61e249e..57fa64a0 100644 --- a/examples/displacement/displacement.cpp +++ b/examples/displacement/displacement.cpp @@ -193,6 +193,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.solid); vkCmdDrawIndexed(drawCmdBuffers[i], models.object.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/distancefieldfonts/distancefieldfonts.cpp b/examples/distancefieldfonts/distancefieldfonts.cpp index a1a4191e..9ded1f7c 100644 --- a/examples/distancefieldfonts/distancefieldfonts.cpp +++ b/examples/distancefieldfonts/distancefieldfonts.cpp @@ -261,6 +261,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], indexCount, 1, 0, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/dynamicuniformbuffer/dynamicuniformbuffer.cpp b/examples/dynamicuniformbuffer/dynamicuniformbuffer.cpp index 79d0b880..d0457e49 100644 --- a/examples/dynamicuniformbuffer/dynamicuniformbuffer.cpp +++ b/examples/dynamicuniformbuffer/dynamicuniformbuffer.cpp @@ -112,7 +112,7 @@ public: VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) { - title = "Vulkan Example - Dynamic uniform buffers"; + title = "Dynamic uniform buffers"; camera.type = Camera::CameraType::lookat; camera.setPosition(glm::vec3(0.0f, 0.0f, -30.0f)); camera.setRotation(glm::vec3(0.0f)); @@ -188,6 +188,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], indexCount, 1, 0, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/gears/gears.cpp b/examples/gears/gears.cpp index ca17de89..f8ec9dd3 100644 --- a/examples/gears/gears.cpp +++ b/examples/gears/gears.cpp @@ -104,6 +104,8 @@ public: gear->draw(drawCmdBuffers[i], pipelineLayout); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/geometryshader/geometryshader.cpp b/examples/geometryshader/geometryshader.cpp index 4a615e50..e19651be 100644 --- a/examples/geometryshader/geometryshader.cpp +++ b/examples/geometryshader/geometryshader.cpp @@ -169,6 +169,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.object.indexCount, 1, 0, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/hdr/hdr.cpp b/examples/hdr/hdr.cpp index aa768c4d..4b712a13 100644 --- a/examples/hdr/hdr.cpp +++ b/examples/hdr/hdr.cpp @@ -128,7 +128,7 @@ public: VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) { - title = "Hight dynamic range rendering"; + title = "High dynamic range rendering"; camera.type = Camera::CameraType::lookat; camera.setPosition(glm::vec3(0.0f, 0.0f, -4.0f)); camera.setRotation(glm::vec3(0.0f, 180.0f, 0.0f)); @@ -262,6 +262,8 @@ public: vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/indirectdraw/indirectdraw.cpp b/examples/indirectdraw/indirectdraw.cpp index 9e8a5ddd..472d69db 100644 --- a/examples/indirectdraw/indirectdraw.cpp +++ b/examples/indirectdraw/indirectdraw.cpp @@ -241,6 +241,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], models.skysphere.indices.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], models.skysphere.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/inputattachments/inputattachments.cpp b/examples/inputattachments/inputattachments.cpp index d4fcf7f4..ee9224c6 100644 --- a/examples/inputattachments/inputattachments.cpp +++ b/examples/inputattachments/inputattachments.cpp @@ -88,8 +88,6 @@ public: }; std::vector attachments; - VkRenderPass uiRenderPass; - VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) { title = "Input attachments"; @@ -124,8 +122,6 @@ public: vkDestroyDescriptorSetLayout(device, descriptorSetLayouts.attachmentWrite, nullptr); vkDestroyDescriptorSetLayout(device, descriptorSetLayouts.attachmentRead, nullptr); - vkDestroyRenderPass(device, uiRenderPass, nullptr); - scene.destroy(); uniformBuffers.matrices.destroy(); uniformBuffers.params.destroy(); @@ -329,11 +325,6 @@ public: renderPassInfoCI.dependencyCount = static_cast(dependencies.size()); renderPassInfoCI.pDependencies = dependencies.data(); VK_CHECK_RESULT(vkCreateRenderPass(device, &renderPassInfoCI, nullptr, &renderPass)); - - // Create custom overlay render pass - attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; - attachments[0].initialLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - VK_CHECK_RESULT(vkCreateRenderPass(device, &renderPassInfoCI, nullptr, &uiRenderPass)); } void buildCommandBuffers() @@ -401,6 +392,8 @@ public: vks::debugmarker::endRegion(drawCmdBuffers[i]); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); @@ -618,8 +611,6 @@ public: // UI overlay configuration needs to be adjusted for this example (renderpass setup, attachment count, etc.) virtual void OnSetupUIOverlay(vks::UIOverlayCreateInfo &createInfo) { - createInfo.renderPass = uiRenderPass; - createInfo.framebuffers = frameBuffers; createInfo.targetSubpass = 1; createInfo.subpassCount = 2; createInfo.attachmentCount = 1; diff --git a/examples/instancing/instancing.cpp b/examples/instancing/instancing.cpp index 6e0122a9..4e86d64f 100644 --- a/examples/instancing/instancing.cpp +++ b/examples/instancing/instancing.cpp @@ -197,6 +197,8 @@ public: // Render instances vkCmdDrawIndexed(drawCmdBuffers[i], models.rock.indexCount, INSTANCE_COUNT, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/mesh/mesh.cpp b/examples/mesh/mesh.cpp index 438c823d..3b773d54 100644 --- a/examples/mesh/mesh.cpp +++ b/examples/mesh/mesh.cpp @@ -175,6 +175,8 @@ public: // Render mesh vertex buffer using it's indices vkCmdDrawIndexed(drawCmdBuffers[i], model.indices.count, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/multisampling/multisampling.cpp b/examples/multisampling/multisampling.cpp index bf8644e9..a7103d56 100644 --- a/examples/multisampling/multisampling.cpp +++ b/examples/multisampling/multisampling.cpp @@ -83,7 +83,6 @@ public: VkPipelineLayout pipelineLayout; VkDescriptorSet descriptorSet; VkDescriptorSetLayout descriptorSetLayout; - VkRenderPass uiRenderPass; VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) { @@ -101,7 +100,6 @@ public: // Note : Inherited destructor cleans up resources stored in base class vkDestroyPipeline(device, pipelines.MSAA, nullptr); vkDestroyPipeline(device, pipelines.MSAASampleShading, nullptr); - vkDestroyRenderPass(device, uiRenderPass, nullptr); vkDestroyPipelineLayout(device, pipelineLayout, nullptr); vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr); @@ -339,15 +337,6 @@ public: renderPassInfo.pDependencies = dependencies.data(); VK_CHECK_RESULT(vkCreateRenderPass(device, &renderPassInfo, nullptr, &renderPass)); - - // Create custom overlay render pass - colorReference.attachment = 1; - attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; - attachments[1].initialLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - subpass.pResolveAttachments = 0; - subpass.pDepthStencilAttachment = 0; - - VK_CHECK_RESULT(vkCreateRenderPass(device, &renderPassInfo, nullptr, &uiRenderPass)); } // Frame buffer attachments must match with render pass setup, @@ -425,6 +414,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], models.example.indices.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], models.example.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); @@ -741,15 +732,7 @@ public: // UI overlay configuration needs to be adjusted for this example (renderpass setup, attachment count, etc.) virtual void OnSetupUIOverlay(vks::UIOverlayCreateInfo &createInfo) { - createInfo.renderPass = uiRenderPass; - createInfo.framebuffers = frameBuffers; - createInfo.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; - createInfo.attachmentCount = 1; - createInfo.clearValues = { - { { 1.0f, 1.0f, 1.0f, 1.0f } }, - { { 1.0f, 1.0f, 1.0f, 1.0f } }, - { { 1.0f, 0 } }, - }; + createInfo.rasterizationSamples = sampleCount; } virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay) diff --git a/examples/multithreading/multithreading.cpp b/examples/multithreading/multithreading.cpp index 5e1d6136..ecdd0bde 100644 --- a/examples/multithreading/multithreading.cpp +++ b/examples/multithreading/multithreading.cpp @@ -409,6 +409,9 @@ public: // Execute render commands from the secondary command buffer vkCmdExecuteCommands(primaryCommandBuffer, commandBuffers.size(), commandBuffers.data()); + // TODO: Can't call commands in this secondary buffer + // drawUI(primaryCommandBuffer); + vkCmdEndRenderPass(primaryCommandBuffer); VK_CHECK_RESULT(vkEndCommandBuffer(primaryCommandBuffer)); diff --git a/examples/multiview/multiview.cpp b/examples/multiview/multiview.cpp index 9ad2e3c8..3b18a715 100644 --- a/examples/multiview/multiview.cpp +++ b/examples/multiview/multiview.cpp @@ -396,6 +396,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, viewDisplayPipelines[1]); vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); } diff --git a/examples/occlusionquery/occlusionquery.cpp b/examples/occlusionquery/occlusionquery.cpp index 3be49e62..f4305702 100644 --- a/examples/occlusionquery/occlusionquery.cpp +++ b/examples/occlusionquery/occlusionquery.cpp @@ -263,6 +263,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], models.plane.indices.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], models.plane.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/offscreen/offscreen.cpp b/examples/offscreen/offscreen.cpp index a7887677..c40ac38d 100644 --- a/examples/offscreen/offscreen.cpp +++ b/examples/offscreen/offscreen.cpp @@ -460,6 +460,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], models.example.indices.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], models.example.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/parallaxmapping/parallaxmapping.cpp b/examples/parallaxmapping/parallaxmapping.cpp index 6e16c6a2..e11e7c31 100644 --- a/examples/parallaxmapping/parallaxmapping.cpp +++ b/examples/parallaxmapping/parallaxmapping.cpp @@ -178,6 +178,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); vkCmdDrawIndexed(drawCmdBuffers[i], models.quad.indexCount, 1, 0, 0, 1); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/particlefire/particlefire.cpp b/examples/particlefire/particlefire.cpp index ae80f612..94c48141 100644 --- a/examples/particlefire/particlefire.cpp +++ b/examples/particlefire/particlefire.cpp @@ -211,6 +211,8 @@ public: vkCmdBindVertexBuffers(drawCmdBuffers[i], VERTEX_BUFFER_BIND_ID, 1, &particles.buffer, offsets); vkCmdDraw(drawCmdBuffers[i], PARTICLE_COUNT, 1, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/pbrbasic/pbrbasic.cpp b/examples/pbrbasic/pbrbasic.cpp index 09fea60f..8cd0dee4 100644 --- a/examples/pbrbasic/pbrbasic.cpp +++ b/examples/pbrbasic/pbrbasic.cpp @@ -208,6 +208,8 @@ public: } } #endif + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/pbribl/pbribl.cpp b/examples/pbribl/pbribl.cpp index fec3bf34..bc16f0f7 100644 --- a/examples/pbribl/pbribl.cpp +++ b/examples/pbribl/pbribl.cpp @@ -257,6 +257,8 @@ public: } } #endif + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/pbrtexture/main.cpp b/examples/pbrtexture/main.cpp index 5738d526..db0c3f8c 100644 --- a/examples/pbrtexture/main.cpp +++ b/examples/pbrtexture/main.cpp @@ -195,6 +195,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.object.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/pipelines/pipelines.cpp b/examples/pipelines/pipelines.cpp index fe45aa61..4237a2eb 100644 --- a/examples/pipelines/pipelines.cpp +++ b/examples/pipelines/pipelines.cpp @@ -162,6 +162,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.cube.indexCount, 1, 0, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/pipelinestatistics/pipelinestatistics.cpp b/examples/pipelinestatistics/pipelinestatistics.cpp index 95d9419a..7e2fad3a 100644 --- a/examples/pipelinestatistics/pipelinestatistics.cpp +++ b/examples/pipelinestatistics/pipelinestatistics.cpp @@ -219,6 +219,8 @@ public: // End capture of pipeline statistics vkCmdEndQuery(drawCmdBuffers[i], queryPool, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/pushconstants/pushconstants.cpp b/examples/pushconstants/pushconstants.cpp index 4dd6675e..d2330230 100644 --- a/examples/pushconstants/pushconstants.cpp +++ b/examples/pushconstants/pushconstants.cpp @@ -168,6 +168,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.scene.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/pushdescriptors/pushdescriptors.cpp b/examples/pushdescriptors/pushdescriptors.cpp index 20767fe2..6c55a7c0 100644 --- a/examples/pushdescriptors/pushdescriptors.cpp +++ b/examples/pushdescriptors/pushdescriptors.cpp @@ -179,6 +179,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.cube.indexCount, 1, 0, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/radialblur/radialblur.cpp b/examples/radialblur/radialblur.cpp index 88cd29e6..1291b2b5 100644 --- a/examples/radialblur/radialblur.cpp +++ b/examples/radialblur/radialblur.cpp @@ -379,7 +379,7 @@ public: VkDeviceSize offsets[1] = { 0 }; vkCmdBindVertexBuffers(offscreenPass.commandBuffer, VERTEX_BUFFER_BIND_ID, 1, &models.example.vertices.buffer, offsets); vkCmdBindIndexBuffer(offscreenPass.commandBuffer, models.example.indices.buffer, 0, VK_INDEX_TYPE_UINT32); - vkCmdDrawIndexed(offscreenPass.commandBuffer, models.example.indexCount, 1, 0, 0, 0); + vkCmdDrawIndexed(offscreenPass.commandBuffer, models.example.indexCount, 1, 0, 0, 0); vkCmdEndRenderPass(offscreenPass.commandBuffer); @@ -436,6 +436,8 @@ public: vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/raytracing/raytracing.cpp b/examples/raytracing/raytracing.cpp index 777613e1..6b107422 100644 --- a/examples/raytracing/raytracing.cpp +++ b/examples/raytracing/raytracing.cpp @@ -269,6 +269,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, graphics.pipeline); vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/scenerendering/scenerendering.cpp b/examples/scenerendering/scenerendering.cpp index 6a34b122..052d8a86 100644 --- a/examples/scenerendering/scenerendering.cpp +++ b/examples/scenerendering/scenerendering.cpp @@ -640,6 +640,8 @@ public: scene->render(drawCmdBuffers[i], wireframe); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/screenshot/screenshot.cpp b/examples/screenshot/screenshot.cpp index 94e436fd..e1346fe3 100644 --- a/examples/screenshot/screenshot.cpp +++ b/examples/screenshot/screenshot.cpp @@ -116,6 +116,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], model.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/shadowmapping/shadowmapping.cpp b/examples/shadowmapping/shadowmapping.cpp index 44ef556a..e5f6303a 100644 --- a/examples/shadowmapping/shadowmapping.cpp +++ b/examples/shadowmapping/shadowmapping.cpp @@ -429,6 +429,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], scenes[sceneIndex].indices.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], scenes[sceneIndex].indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/shadowmappingcascade/shadowmappingcascade.cpp b/examples/shadowmappingcascade/shadowmappingcascade.cpp index fe0076b4..bdcc0a92 100644 --- a/examples/shadowmappingcascade/shadowmappingcascade.cpp +++ b/examples/shadowmappingcascade/shadowmappingcascade.cpp @@ -491,6 +491,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, (filterPCF) ? pipelines.sceneShadowPCF : pipelines.sceneShadow); renderScene(drawCmdBuffers[i], pipelineLayout, descriptorSet); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/shadowmappingomni/shadowmappingomni.cpp b/examples/shadowmappingomni/shadowmappingomni.cpp index bf305c30..44caa1b8 100644 --- a/examples/shadowmappingomni/shadowmappingomni.cpp +++ b/examples/shadowmappingomni/shadowmappingomni.cpp @@ -598,6 +598,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.scene.indexCount, 1, 0, 0, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/skeletalanimation/skeletalanimation.cpp b/examples/skeletalanimation/skeletalanimation.cpp index 67f0fc31..de2035be 100644 --- a/examples/skeletalanimation/skeletalanimation.cpp +++ b/examples/skeletalanimation/skeletalanimation.cpp @@ -502,6 +502,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], models.floor.indices.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], models.floor.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/specializationconstants/specializationconstants.cpp b/examples/specializationconstants/specializationconstants.cpp index 6dbb44b7..b727e7f1 100644 --- a/examples/specializationconstants/specializationconstants.cpp +++ b/examples/specializationconstants/specializationconstants.cpp @@ -153,6 +153,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.textured); vkCmdDrawIndexed(drawCmdBuffers[i], models.cube.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/sphericalenvmapping/sphericalenvmapping.cpp b/examples/sphericalenvmapping/sphericalenvmapping.cpp index b578ec07..c9beb7ae 100644 --- a/examples/sphericalenvmapping/sphericalenvmapping.cpp +++ b/examples/sphericalenvmapping/sphericalenvmapping.cpp @@ -144,6 +144,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.object.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/ssao/ssao.cpp b/examples/ssao/ssao.cpp index 514f27c8..96036a2c 100644 --- a/examples/ssao/ssao.cpp +++ b/examples/ssao/ssao.cpp @@ -667,6 +667,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.composition); vkCmdDraw(drawCmdBuffers[i], 3, 1, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/stencilbuffer/stencilbuffer.cpp b/examples/stencilbuffer/stencilbuffer.cpp index a2f0671d..e46f9579 100644 --- a/examples/stencilbuffer/stencilbuffer.cpp +++ b/examples/stencilbuffer/stencilbuffer.cpp @@ -125,6 +125,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.outline); vkCmdDrawIndexed(drawCmdBuffers[i], model.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/subpasses/subpasses.cpp b/examples/subpasses/subpasses.cpp index 10ebcb53..b8b77efb 100644 --- a/examples/subpasses/subpasses.cpp +++ b/examples/subpasses/subpasses.cpp @@ -121,8 +121,6 @@ public: FrameBufferAttachment position, normal, albedo; } attachments; - VkRenderPass uiRenderPass; - VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) { title = "Subpasses"; @@ -166,8 +164,6 @@ public: vkDestroyDescriptorSetLayout(device, descriptorSetLayouts.composition, nullptr); vkDestroyDescriptorSetLayout(device, descriptorSetLayouts.transparent, nullptr); - vkDestroyRenderPass(device, uiRenderPass, nullptr); - textures.glass.destroy(); models.scene.destroy(); models.transparent.destroy(); @@ -440,11 +436,6 @@ public: renderPassInfo.pDependencies = dependencies.data(); VK_CHECK_RESULT(vkCreateRenderPass(device, &renderPassInfo, nullptr, &renderPass)); - - // Create custom overlay render pass - attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; - attachments[0].initialLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; - VK_CHECK_RESULT(vkCreateRenderPass(device, &renderPassInfo, nullptr, &uiRenderPass)); } void buildCommandBuffers() @@ -528,6 +519,8 @@ public: vks::debugmarker::endRegion(drawCmdBuffers[i]); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); @@ -1079,17 +1072,7 @@ public: // UI overlay configuration needs to be adjusted for this example (renderpass setup, attachment count, etc.) virtual void OnSetupUIOverlay(vks::UIOverlayCreateInfo &createInfo) { - createInfo.renderPass = uiRenderPass; - createInfo.framebuffers = frameBuffers; - createInfo.subpassCount = 3; - createInfo.attachmentCount = 4; - createInfo.clearValues = { - { { 0.0f, 0.0f, 0.0f, 0.0f } }, - { { 0.0f, 0.0f, 0.0f, 0.0f } }, - { { 0.0f, 0.0f, 0.0f, 0.0f } }, - { { 0.0f, 0.0f, 0.0f, 0.0f } }, - { { 1.0f, 0 } }, - }; + createInfo.targetSubpass = 2; } virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay) diff --git a/examples/terraintessellation/terraintessellation.cpp b/examples/terraintessellation/terraintessellation.cpp index 366a67df..9ac3d66a 100644 --- a/examples/terraintessellation/terraintessellation.cpp +++ b/examples/terraintessellation/terraintessellation.cpp @@ -376,6 +376,8 @@ public: vkCmdEndQuery(drawCmdBuffers[i], queryPool, 0); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/tessellation/tessellation.cpp b/examples/tessellation/tessellation.cpp index a8cf2b97..8c912672 100644 --- a/examples/tessellation/tessellation.cpp +++ b/examples/tessellation/tessellation.cpp @@ -182,6 +182,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, wireframe ? pipelines.wire : pipelines.solid); vkCmdDrawIndexed(drawCmdBuffers[i], models.object.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/texture/texture.cpp b/examples/texture/texture.cpp index 3c1a6a2f..01350edd 100644 --- a/examples/texture/texture.cpp +++ b/examples/texture/texture.cpp @@ -491,6 +491,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/texture3d/texture3d.cpp b/examples/texture3d/texture3d.cpp index e88ae93a..de5dd531 100644 --- a/examples/texture3d/texture3d.cpp +++ b/examples/texture3d/texture3d.cpp @@ -493,6 +493,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/texturearray/texturearray.cpp b/examples/texturearray/texturearray.cpp index be61b0db..6484f4bb 100644 --- a/examples/texturearray/texturearray.cpp +++ b/examples/texturearray/texturearray.cpp @@ -345,6 +345,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], indexCount, layerCount, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/texturecubemap/texturecubemap.cpp b/examples/texturecubemap/texturecubemap.cpp index 660e0361..cbb2fc20 100644 --- a/examples/texturecubemap/texturecubemap.cpp +++ b/examples/texturecubemap/texturecubemap.cpp @@ -384,6 +384,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.reflect); vkCmdDrawIndexed(drawCmdBuffers[i], models.objects[models.objectIndex].indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/texturemipmapgen/texturemipmapgen.cpp b/examples/texturemipmapgen/texturemipmapgen.cpp index 7dc68bc1..471b1914 100644 --- a/examples/texturemipmapgen/texturemipmapgen.cpp +++ b/examples/texturemipmapgen/texturemipmapgen.cpp @@ -406,6 +406,8 @@ public: vkCmdDrawIndexed(drawCmdBuffers[i], models.tunnel.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/texturesparseresidency/texturesparseresidency.cpp b/examples/texturesparseresidency/texturesparseresidency.cpp index 12968f56..1b85fe83 100644 --- a/examples/texturesparseresidency/texturesparseresidency.cpp +++ b/examples/texturesparseresidency/texturesparseresidency.cpp @@ -634,6 +634,8 @@ public: vkCmdBindIndexBuffer(drawCmdBuffers[i], heightMap->indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT32); vkCmdDrawIndexed(drawCmdBuffers[i], heightMap->indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/viewportarray/viewportarray.cpp b/examples/viewportarray/viewportarray.cpp index 8b8a0854..50652e75 100644 --- a/examples/viewportarray/viewportarray.cpp +++ b/examples/viewportarray/viewportarray.cpp @@ -146,6 +146,8 @@ public: vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline); vkCmdDrawIndexed(drawCmdBuffers[i], scene.indexCount, 1, 0, 0, 0); + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i])); diff --git a/examples/vulkanscene/vulkanscene.cpp b/examples/vulkanscene/vulkanscene.cpp index 2013ccb6..a648ed49 100644 --- a/examples/vulkanscene/vulkanscene.cpp +++ b/examples/vulkanscene/vulkanscene.cpp @@ -173,6 +173,8 @@ public: model.draw(drawCmdBuffers[i]); } + drawUI(drawCmdBuffers[i]); + vkCmdEndRenderPass(drawCmdBuffers[i]); VK_CHECK_RESULT(vkEndCommandBuffer(drawCmdBuffers[i]));