MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ create()

bool MayaFlux::Core::VKFramebuffer::create ( vk::Device  device,
vk::RenderPass  render_pass,
const std::vector< vk::ImageView > &  attachments,
uint32_t  width,
uint32_t  height,
uint32_t  layers = 1 
)

Create framebuffer.

Parameters
deviceLogical device
render_passRender pass this framebuffer is compatible with
attachmentsImage views to use as attachments (must match render pass)
widthFramebuffer width
heightFramebuffer height
layersNumber of layers (1 for standard 2D rendering)
Returns
True if creation succeeded

Definition at line 7 of file VKFramebuffer.cpp.

13{
14
15 if (attachments.empty()) {
17 "Cannot create framebuffer with no attachments");
18 return false;
19 }
20
21 if (width == 0 || height == 0) {
23 "Cannot create framebuffer with zero dimensions ({}x{})", width, height);
24 return false;
25 }
26
27 m_width = width;
28 m_height = height;
29 m_layers = layers;
30
31 vk::FramebufferCreateInfo framebuffer_info {};
32 framebuffer_info.renderPass = render_pass;
33 framebuffer_info.attachmentCount = static_cast<uint32_t>(attachments.size());
34 framebuffer_info.pAttachments = attachments.data();
35 framebuffer_info.width = width;
36 framebuffer_info.height = height;
37 framebuffer_info.layers = layers;
38
39 try {
40 m_framebuffer = device.createFramebuffer(framebuffer_info);
41
43 "Framebuffer created ({}x{}, {} attachments)",
44 width, height, attachments.size());
45
46 return true;
47 } catch (const vk::SystemError& e) {
49 "Failed to create framebuffer: {}", e.what());
50 return false;
51 }
52}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::GraphicsBackend, m_framebuffer, m_height, m_layers, m_width, MF_ERROR, and MF_INFO.