xo-imgui: refactor ex4a: create_command_buffers()

This commit is contained in:
Roland Conybeare 2025-11-11 10:28:16 -05:00
commit adb97b12c8
2 changed files with 25 additions and 17 deletions

View file

@ -322,4 +322,20 @@ MinimalImGuiVulkan::create_command_pool()
}
}
void
MinimalImGuiVulkan::create_command_buffers()
{
command_buffers_.resize(MAX_FRAMES_IN_FLIGHT);
VkCommandBufferAllocateInfo alloc_info{};
alloc_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
alloc_info.commandPool = command_pool_;
alloc_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
alloc_info.commandBufferCount = static_cast<uint32_t>(command_buffers_.size());
if (vkAllocateCommandBuffers(device_, &alloc_info, command_buffers_.data()) != VK_SUCCESS) {
throw std::runtime_error("Failed to allocate command buffers!");
}
}
/* end VulkanApp.cpp */