vulkan-guide
vulkan-guide copied to clipboard
`vkinit::rendering_info` is never mentioned, but first used in IMGUI setup
I'm following along starting with a blank project, and when I get to https://vkguide.dev/docs/new_chapter_2/vulkan_imgui_setup/#dynamic-rendering it says:
src/vulkan/vk_engine.cpp: In member function ‘void VulkanEngine::draw_imgui(VkCommandBuffer, VkImageView)’:
src/vulkan/vk_engine.cpp:472:46: error: ‘rendering_info’ is not a member of ‘vkinit’
472 | VkRenderingInfo renderInfo = vkinit::rendering_info(_swapchainExtent, &colorAttachment, nullptr);
At first I thought I'd simply missed something, but google says I haven't and github search concurs, it's just missing.
It's mentioned a couple more times in chapter 3, but again there's no definition or declaration, just usage.
Make sure you have included #include <vk_initializers.h>. It should be defined there (line 30 in the header, line 160 in the cpp).
Source is included as part of the Starting point project files
For the convenience of anyone else hitting this, its definition is this
VkRenderingInfo vkinit::rendering_info(VkExtent2D renderExtent, VkRenderingAttachmentInfo* colorAttachment,
VkRenderingAttachmentInfo* depthAttachment)
{
VkRenderingInfo renderInfo {};
renderInfo.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
renderInfo.pNext = nullptr;
renderInfo.renderArea = VkRect2D { VkOffset2D { 0, 0 }, renderExtent };
renderInfo.layerCount = 1;
renderInfo.colorAttachmentCount = 1;
renderInfo.pColorAttachments = colorAttachment;
renderInfo.pDepthAttachment = depthAttachment;
renderInfo.pStencilAttachment = nullptr;
return renderInfo;
}