single use command buffers

This commit is contained in:
Greg Wells
2025-07-06 06:49:33 -04:00
parent 1614885de3
commit df954d8522
2 changed files with 5 additions and 3 deletions

View File

@@ -30,9 +30,13 @@ void resetCommandBuffer(gnCommandBufferHandle commandBuffer) {
gnReturnCode beginCommandBuffer(gnCommandBufferHandle commandBuffer) { gnReturnCode beginCommandBuffer(gnCommandBufferHandle commandBuffer) {
VkCommandBufferBeginInfo beginInfo = { VkCommandBufferBeginInfo beginInfo = {
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
.flags = 0
}; };
if ((commandBuffer->commandPool->info.flags & GN_REUSE_COMMAND_BUFFERS) != GN_REUSE_COMMAND_BUFFERS)
beginInfo.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
if (vkBeginCommandBuffer(commandBuffer->commandBuffer->buffer, &beginInfo) != VK_SUCCESS) { if (vkBeginCommandBuffer(commandBuffer->commandBuffer->buffer, &beginInfo) != VK_SUCCESS) {
return GN_FAILED_TO_BEGIN_RECORDING; return GN_FAILED_TO_BEGIN_RECORDING;
} }

View File

@@ -10,8 +10,6 @@ gnReturnCode createCommandPool(gnCommandPool commandPool, gnDevice device, gnCom
.queueFamilyIndex = info.queueIndex, .queueFamilyIndex = info.queueIndex,
}; };
if ((info.flags & GN_REUSE_COMMAND_BUFFERS) != GN_REUSE_COMMAND_BUFFERS) poolInfo.flags |= VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
if (vkCreateCommandPool(device->outputDevice->device, &poolInfo, NULL, &commandPool->commandPool->commandPool) != VK_SUCCESS) { if (vkCreateCommandPool(device->outputDevice->device, &poolInfo, NULL, &commandPool->commandPool->commandPool) != VK_SUCCESS) {
return GN_FAILED_TO_CREATE_COMMAND_POOL; return GN_FAILED_TO_CREATE_COMMAND_POOL;
} }