current_pool->in_use = true;
}
- VkCommandBufferAllocateInfo alloc_info = { };
- alloc_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
- alloc_info.commandPool = handle_cast<::VkCommandPool>(current_pool->pool);
- alloc_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
- alloc_info.commandBufferCount = 1;
+ if(current_pool->next_buffer>=current_pool->buffers.size())
+ {
+ VkCommandBufferAllocateInfo alloc_info = { };
+ alloc_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
+ alloc_info.commandPool = handle_cast<::VkCommandPool>(current_pool->pool);
+ alloc_info.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
+ alloc_info.commandBufferCount = 1;
+
+ VkCommandBuffer buffer;
+ vk.AllocateCommandBuffers(alloc_info, &buffer);
+ current_pool->buffers.push_back(buffer);
+ }
- vk.AllocateCommandBuffers(alloc_info, ¤t_buffer);
+ current_buffer = current_pool->buffers[current_pool->next_buffer++];
VkCommandBufferBeginInfo begin_info = { };
begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
current_pool->fence.wait();
vk.ResetCommandPool(current_pool->pool, 0);
current_pool->in_use = false;
+ current_pool->next_buffer = 0;
}
}