xo-imgui: refactor ex4a: end_single_time_commands()
This commit is contained in:
parent
876d90a816
commit
3c87645998
2 changed files with 21 additions and 14 deletions
|
|
@ -424,7 +424,7 @@ MinimalImGuiVulkan::init_imgui()
|
|||
// Upload Fonts
|
||||
VkCommandBuffer command_buffer = begin_single_time_commands();
|
||||
ImGui_ImplVulkan_CreateFontsTexture();
|
||||
endSingleTimeCommands(command_buffer);
|
||||
this->end_single_time_commands(command_buffer);
|
||||
|
||||
//ImGui_ImplVulkan_DestroyFontUploadObjects();
|
||||
}
|
||||
|
|
@ -450,4 +450,20 @@ MinimalImGuiVulkan::begin_single_time_commands()
|
|||
return cmdbuf;
|
||||
}
|
||||
|
||||
void
|
||||
MinimalImGuiVulkan::end_single_time_commands(VkCommandBuffer commandBuffer)
|
||||
{
|
||||
vkEndCommandBuffer(commandBuffer);
|
||||
|
||||
VkSubmitInfo submit_info{};
|
||||
submit_info.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
submit_info.commandBufferCount = 1;
|
||||
submit_info.pCommandBuffers = &commandBuffer;
|
||||
|
||||
vkQueueSubmit(graphics_queue_, 1, &submit_info, VK_NULL_HANDLE);
|
||||
vkQueueWaitIdle(graphics_queue_);
|
||||
|
||||
vkFreeCommandBuffers(device_, command_pool_, 1, &commandBuffer);
|
||||
}
|
||||
|
||||
/* end VulkanApp.cpp */
|
||||
|
|
|
|||
|
|
@ -98,19 +98,10 @@ private:
|
|||
*/
|
||||
VkCommandBuffer begin_single_time_commands();
|
||||
|
||||
void endSingleTimeCommands(VkCommandBuffer commandBuffer) {
|
||||
vkEndCommandBuffer(commandBuffer);
|
||||
|
||||
VkSubmitInfo submitInfo{};
|
||||
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
submitInfo.commandBufferCount = 1;
|
||||
submitInfo.pCommandBuffers = &commandBuffer;
|
||||
|
||||
vkQueueSubmit(graphics_queue_, 1, &submitInfo, VK_NULL_HANDLE);
|
||||
vkQueueWaitIdle(graphics_queue_);
|
||||
|
||||
vkFreeCommandBuffers(device_, command_pool_, 1, &commandBuffer);
|
||||
}
|
||||
/* complete command buffer begun with begin_single_time_commands();
|
||||
* also submit, wait for completion + cleanup
|
||||
*/
|
||||
void end_single_time_commands(VkCommandBuffer commandBuffer);
|
||||
|
||||
void main_loop() {
|
||||
SDL_Event event;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue