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

◆ allocate_command_buffer()

vk::CommandBuffer MayaFlux::Core::VKCommandManager::allocate_command_buffer ( vk::CommandBufferLevel  level = vk::CommandBufferLevel::ePrimary)

Allocate a command buffer with specified level.

Parameters
levelPrimary or secondary
Returns
Allocated command buffer

Definition at line 67 of file VKCommandManager.cpp.

68{
69 vk::CommandBufferAllocateInfo alloc_info {};
70 alloc_info.commandPool = m_command_pool;
71 alloc_info.level = level;
72 alloc_info.commandBufferCount = 1;
73
74 vk::CommandBuffer cmd_buffer;
75 try {
76 auto result = m_device.allocateCommandBuffers(&alloc_info, &cmd_buffer);
77 if (result != vk::Result::eSuccess) {
79 "Failed to allocate command buffer");
80 return nullptr;
81 }
82 m_allocated_buffers.push_back(cmd_buffer);
83 } catch (const vk::SystemError& e) {
85 "Failed to allocate command buffer: {}", e.what());
86 return nullptr;
87 }
88
90 "Allocated {} command buffer",
91 level == vk::CommandBufferLevel::ePrimary ? "primary" : "secondary");
92
93 return cmd_buffer;
94}
#define MF_ERROR(comp, ctx,...)
#define MF_RT_TRACE(comp, ctx,...)
std::vector< vk::CommandBuffer > m_allocated_buffers
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::GraphicsBackend, m_allocated_buffers, m_command_pool, m_device, MF_ERROR, and MF_RT_TRACE.

Referenced by begin_single_time_commands().

+ Here is the caller graph for this function: