diff --git a/examples/dynamicrenderinglocalread/dynamicrenderinglocalread.cpp b/examples/dynamicrenderinglocalread/dynamicrenderinglocalread.cpp index 7a8e1434d..5121f42a1 100644 --- a/examples/dynamicrenderinglocalread/dynamicrenderinglocalread.cpp +++ b/examples/dynamicrenderinglocalread/dynamicrenderinglocalread.cpp @@ -157,7 +157,7 @@ class VulkanExample : public VulkanExampleBase } // Enable physical device features required for this example - virtual void getEnabledFeatures() + virtual void getEnabledFeatures() override { // Enable anisotropic filtering if supported if (deviceFeatures.samplerAnisotropy) { @@ -441,7 +441,7 @@ class VulkanExample : public VulkanExampleBase } } - void prepare() + void prepare() override { VulkanExampleBase::prepare(); // Since we use an extension, we need to expliclity load the function pointers for extension related Vulkan commands @@ -566,6 +566,15 @@ class VulkanExample : public VulkanExampleBase vkCmdBindDescriptorSets(cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, passes.composition.pipelineLayout, 0, 1, &passes.composition.descriptorSet, 0, nullptr); vkCmdDraw(cmdBuffer, 3, 1, 0, 0); + vkCmdEndRenderingKHR(cmdBuffer); + + // Update renderingInfo to specify and preserve the current swapchain image as the single color attachment for the UI + colorAttachments[0].imageView = swapChain.imageViews[currentImageIndex]; + colorAttachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; + renderingInfo.colorAttachmentCount = 1; + + vkCmdBeginRenderingKHR(cmdBuffer, &renderingInfo); + drawUI(cmdBuffer); vkCmdEndRenderingKHR(cmdBuffer); @@ -585,7 +594,7 @@ class VulkanExample : public VulkanExampleBase VK_CHECK_RESULT(vkEndCommandBuffer(cmdBuffer)); } - virtual void render() + virtual void render() override { if (!prepared) return;