Create a simple render pass with a single color attachment.
8{
9 vk::AttachmentDescription color_attachment {};
10 color_attachment.format = color_format;
11 color_attachment.samples = vk::SampleCountFlagBits::e1;
12 color_attachment.loadOp = vk::AttachmentLoadOp::eClear;
13 color_attachment.storeOp = vk::AttachmentStoreOp::eStore;
14 color_attachment.stencilLoadOp = vk::AttachmentLoadOp::eDontCare;
15 color_attachment.stencilStoreOp = vk::AttachmentStoreOp::eDontCare;
16 color_attachment.initialLayout = vk::ImageLayout::eUndefined;
17 color_attachment.finalLayout = vk::ImageLayout::ePresentSrcKHR;
18
19 vk::AttachmentReference color_attachment_ref {};
20 color_attachment_ref.attachment = 0;
21 color_attachment_ref.layout = vk::ImageLayout::eColorAttachmentOptimal;
22
23 vk::SubpassDescription subpass {};
24 subpass.pipelineBindPoint = vk::PipelineBindPoint::eGraphics;
25 subpass.colorAttachmentCount = 1;
26 subpass.pColorAttachments = &color_attachment_ref;
27
28 vk::RenderPassCreateInfo render_pass_info {};
29 render_pass_info.attachmentCount = 1;
30 render_pass_info.pAttachments = &color_attachment;
31 render_pass_info.subpassCount = 1;
32 render_pass_info.pSubpasses = &subpass;
33
34 try {
36 return true;
37 } catch (const vk::SystemError& e) {
39 return false;
40 }
41}
#define MF_ERROR(comp, ctx,...)
vk::RenderPass m_render_pass
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.