17 vk::CommandPoolCreateInfo pool_info {};
18 pool_info.queueFamilyIndex = graphics_queue_family;
19 pool_info.flags = vk::CommandPoolCreateFlagBits::eResetCommandBuffer;
23 }
catch (
const vk::SystemError& e) {
25 "Failed to create command pool: {}", e.what());
30 "Command manager initialized");
50 vk::CommandBufferAllocateInfo alloc_info {};
52 alloc_info.level = vk::CommandBufferLevel::ePrimary;
53 alloc_info.commandBufferCount = 1;
56 auto buffers =
m_device.allocateCommandBuffers(alloc_info);
59 }
catch (
const vk::SystemError& e) {
61 "Failed to allocate command buffer: {}", e.what());
68 if (!command_buffer) {
83 vk::CommandBufferBeginInfo begin_info {};
84 begin_info.flags = vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
86 command_buffer.begin(begin_info);
88 return command_buffer;
95 vk::SubmitInfo submit_info {};
96 submit_info.commandBufferCount = 1;
97 submit_info.pCommandBuffers = &command_buffer;
99 if (
auto result = queue.submit(1, &submit_info,
nullptr); result != vk::Result::eSuccess) {
101 "Failed to submit single time command buffer: {}", vk::to_string(result));
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
void reset_pool()
Reset command pool (invalidates all allocated buffers)
uint32_t m_graphics_queue_family
void end_single_time_commands(vk::CommandBuffer command_buffer, vk::Queue queue)
End and submit single-time command.
void free_command_buffer(vk::CommandBuffer command_buffer)
Free a command buffer back to the pool.
bool initialize(vk::Device device, uint32_t graphics_queue_family)
Initialize command manager.
vk::CommandBuffer allocate_command_buffer()
Allocate a command buffer from the pool.
vk::CommandBuffer begin_single_time_commands()
Begin single-time command (for transfers, etc.)
std::vector< vk::CommandBuffer > m_allocated_buffers
void cleanup()
Cleanup all command pools and buffers.
vk::CommandPool m_command_pool
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.