| 75 | } |
| 76 | |
| 77 | VkCommandBuffer QueueState::PopCommandBuffer() { |
| 78 | if (!commandBuffers.empty()) { |
| 79 | VkCommandBuffer cmd = commandBuffers.back(); |
| 80 | commandBuffers.pop_back(); |
| 81 | return cmd; |
| 82 | } |
| 83 | |
| 84 | // Allocation info |
| 85 | VkCommandBufferAllocateInfo info{VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO}; |
| 86 | info.commandPool = commandPool; |
| 87 | info.commandBufferCount = 1; |
| 88 | info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; |
| 89 | |
| 90 | // Attempt to allocate command buffer |
| 91 | VkCommandBuffer cmd{}; |
| 92 | if (table->next_vkAllocateCommandBuffers(table->object, &info, &cmd) != VK_SUCCESS) { |
| 93 | return nullptr; |
| 94 | } |
| 95 | |
| 96 | // Patch the dispatch table |
| 97 | PatchInternalTable(cmd, table->object); |
| 98 | |
| 99 | // OK |
| 100 | return cmd; |
| 101 | } |
| 102 | |
| 103 | void QueueState::PushCommandBuffer(VkCommandBuffer commandBuffer) { |
| 104 | commandBuffers.push_back(commandBuffer); |
no test coverage detected