diff --git a/samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.cpp b/samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.cpp index 7118f1a0a..d5f129bed 100644 --- a/samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.cpp +++ b/samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.cpp @@ -686,15 +686,7 @@ void DynamicRenderingLocalRead::prepare_pipelines() pipeline_rendering_create_info.stencilAttachmentFormat = depth_format; } - VkRenderingInputAttachmentIndexInfo rendering_attachment_index_info{VK_STRUCTURE_TYPE_RENDERING_INPUT_ATTACHMENT_INDEX_INFO}; pipeline_rendering_create_info.pNext = &rendering_attachment_index_info; - - std::array colorAttachments = {VK_ATTACHMENT_UNUSED, 0, 1, 2}; - rendering_attachment_index_info.pNext = nullptr; - rendering_attachment_index_info.colorAttachmentCount = colorAttachments.size(); - rendering_attachment_index_info.pColorAttachmentInputIndices = colorAttachments.data(); - rendering_attachment_index_info.pDepthInputAttachmentIndex = nullptr; - rendering_attachment_index_info.pStencilInputAttachmentIndex = nullptr; #else pipeline_create_info.subpass = 0; #endif @@ -902,6 +894,9 @@ void DynamicRenderingLocalRead::build_command_buffers() VkRect2D scissor = vkb::initializers::rect2D(width, height, 0, 0); vkCmdSetScissor(cmd, 0, 1, &scissor); + // Set input attachment indices for the composition and transparent passes + vkCmdSetRenderingInputAttachmentIndicesKHR(cmd, &rendering_attachment_index_info); + /* First draw Fills the G-Buffer attachments containing image data for the deferred composition (color+depth, normals, albedo) diff --git a/samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.h b/samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.h index 37b4c1e99..dd0b7a023 100644 --- a/samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.h +++ b/samples/extensions/dynamic_rendering_local_read/dynamic_rendering_local_read.h @@ -98,6 +98,12 @@ class DynamicRenderingLocalRead : public ApiVulkanSample int32_t attachment_width{0}; int32_t attachment_height{0}; + std::array color_attachment_input_indices{VK_ATTACHMENT_UNUSED, 0, 1, 2}; + VkRenderingInputAttachmentIndexInfo rendering_attachment_index_info{VK_STRUCTURE_TYPE_RENDERING_INPUT_ATTACHMENT_INDEX_INFO_KHR, + nullptr, + static_cast(color_attachment_input_indices.size()), + color_attachment_input_indices.data()}; + void setup_framebuffer() override; void setup_render_pass() override; void prepare_gui() override;