xo-imgui: refactor ex4a: begin_single_time_commands()

This commit is contained in:
Roland Conybeare 2025-11-11 10:53:58 -05:00
commit 876d90a816
2 changed files with 26 additions and 19 deletions

View file

@ -93,24 +93,10 @@ private:
/* setup imgui "framework" */
void init_imgui();
VkCommandBuffer beginSingleTimeCommands() {
VkCommandBufferAllocateInfo allocInfo{};
allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
allocInfo.commandPool = command_pool_;
allocInfo.commandBufferCount = 1;
VkCommandBuffer commandBuffer;
vkAllocateCommandBuffers(device_, &allocInfo, &commandBuffer);
VkCommandBufferBeginInfo beginInfo{};
beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
vkBeginCommandBuffer(commandBuffer, &beginInfo);
return commandBuffer;
}
/* Allocate buffer for 'single-time' commands (to be run once?).
* Pair with call to end_single_time_commands()
*/
VkCommandBuffer begin_single_time_commands();
void endSingleTimeCommands(VkCommandBuffer commandBuffer) {
vkEndCommandBuffer(commandBuffer);