single use command buffers
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user