MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / Framebuffer

Method Framebuffer

framework/core/framebuffer.cpp:35–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35Framebuffer::Framebuffer(vkb::core::DeviceC &device, const vkb::rendering::RenderTargetC &render_target, const RenderPass &render_pass) :
36 device{device},
37 extent{render_target.get_extent()}
38{
39 std::vector<VkImageView> attachments;
40
41 for (auto &view : render_target.get_views())
42 {
43 attachments.emplace_back(view.get_handle());
44 }
45
46 VkFramebufferCreateInfo create_info{VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO};
47
48 create_info.renderPass = render_pass.get_handle();
49 create_info.attachmentCount = to_u32(attachments.size());
50 create_info.pAttachments = attachments.data();
51 create_info.width = extent.width;
52 create_info.height = extent.height;
53 create_info.layers = 1;
54
55 auto result = vkCreateFramebuffer(device.get_handle(), &create_info, nullptr, &handle);
56
57 if (result != VK_SUCCESS)
58 {
59 throw VulkanException{result, "Cannot create Framebuffer"};
60 }
61}
62
63Framebuffer::Framebuffer(Framebuffer &&other) :
64 device{other.device},

Callers

nothing calls this directly

Calls 3

to_u32Function · 0.85
sizeMethod · 0.80
get_handleMethod · 0.45

Tested by

no test coverage detected