MayaFlux 0.2.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 48 of file VKCommandManager.cpp.

49{
50 vk::CommandBufferAllocateInfo alloc_info {};
51 alloc_info.commandPool = m_command_pool;
52 alloc_info.level = level;
53 alloc_info.commandBufferCount = 1;
54
55 vk::CommandBuffer cmd_buffer;
56 try {
57 auto result = m_device.allocateCommandBuffers(&alloc_info, &cmd_buffer);
58 if (result != vk::Result::eSuccess) {
60 "Failed to allocate command buffer");
61 return nullptr;
62 }
63 m_allocated_buffers.push_back(cmd_buffer);
64 } catch (const vk::SystemError& e) {
66 "Failed to allocate command buffer: {}", e.what());
67 return nullptr;
68 }
69
71 "Allocated {} command buffer",
72 level == vk::CommandBufferLevel::ePrimary ? "primary" : "secondary");
73
74 return cmd_buffer;
75}
#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: