mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[vulkan] Use per-frame command buffer pools
Command buffer pools can't be reset until the commands have all been executed. Having per-frame pools makes keeping track of pool lifetime fairly easy.
This commit is contained in:
parent
f0d32ba956
commit
503013dd38
2 changed files with 12 additions and 9 deletions
|
@ -15,6 +15,7 @@ typedef struct vulkan_frame_s {
|
|||
VkSemaphore imageAvailableSemaphore;
|
||||
VkSemaphore renderDoneSemaphore;
|
||||
VkCommandBuffer cmdBuffer;
|
||||
VkCommandPool command_pool;
|
||||
} vulkan_frame_t;
|
||||
|
||||
typedef struct vulkan_frameset_s
|
||||
|
|
|
@ -964,15 +964,6 @@ init_job (vulkan_ctx_t *ctx, objcount_t *counts, objstate_t s)
|
|||
for (uint32_t i = 0; i < job->num_steps; i++) {
|
||||
init_step (i, &jp, &s);
|
||||
}
|
||||
|
||||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
VkCommandPoolCreateInfo poolCInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
||||
.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT,
|
||||
.queueFamilyIndex = device->queue.queueFamily,
|
||||
};
|
||||
dfunc->vkCreateCommandPool (device->dev, &poolCInfo, 0, &job->command_pool);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1134,6 +1125,17 @@ create_objects (vulkan_ctx_t *ctx, objcount_t *counts)
|
|||
|
||||
counts->num_descriptorsets = s.inds.num_descriptorsets;
|
||||
init_job (ctx, counts, s);
|
||||
|
||||
for (uint32_t i = 0; i < ctx->frames.size; i++) {
|
||||
VkCommandPoolCreateInfo poolCInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
||||
.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT,
|
||||
.queueFamilyIndex = device->queue.queueFamily,
|
||||
};
|
||||
auto frame = &ctx->frames.a[i];
|
||||
dfunc->vkCreateCommandPool (device->dev, &poolCInfo, 0,
|
||||
&frame->command_pool);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue