update command buffers
This commit is contained in:
@@ -13,15 +13,14 @@ gnReturnCode allocateCommandBuffers(gnCommandBufferHandle* commandBuffers, uint3
|
||||
|
||||
VkCommandBuffer* buffers = malloc(sizeof(VkCommandBuffer) * count);
|
||||
|
||||
if (vkAllocateCommandBuffers(pool->device->outputDevice->device, &allocInfo, buffers) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_ALLOCATE_OBJECT;
|
||||
|
||||
VkResult allocationResult = vkAllocateCommandBuffers(pool->device->outputDevice->device, &allocInfo, buffers);
|
||||
if (allocationResult == VK_SUCCESS)
|
||||
for (int i = 0; i < count; i++) {
|
||||
commandBuffers[i]->commandBuffer = malloc(sizeof(gnPlatformCommandBuffer));
|
||||
commandBuffers[i]->commandBuffer->buffer = buffers[i];
|
||||
}
|
||||
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(allocationResult);
|
||||
}
|
||||
|
||||
void resetCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "vulkan_command_pool.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include "instance/gryphn_instance.h"
|
||||
#include "vulkan_result_converter.h"
|
||||
|
||||
gnReturnCode createCommandPool(gnCommandPool commandPool, gnDevice device, gnCommandPoolInfo info) {
|
||||
commandPool->commandPool = malloc(sizeof(gnPlatformCommandPool));
|
||||
@@ -11,11 +12,7 @@ gnReturnCode createCommandPool(gnCommandPool commandPool, gnDevice device, gnCom
|
||||
.queueFamilyIndex = info.queueFamilyIndex,
|
||||
};
|
||||
if (!device->instance->enabledExtensions[GN_EXT_QUEUES]) poolInfo.queueFamilyIndex = device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queueInfo.queueIndex;
|
||||
|
||||
if (vkCreateCommandPool(device->outputDevice->device, &poolInfo, NULL, &commandPool->commandPool->commandPool) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_COMMAND_POOL;
|
||||
|
||||
return GN_SUCCESS;
|
||||
return VkResultToGnReturnCode(vkCreateCommandPool(device->outputDevice->device, &poolInfo, NULL, &commandPool->commandPool->commandPool));
|
||||
}
|
||||
|
||||
void destroyCommandPool(gnCommandPool commandPool) {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <core/gryphn_return_code.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
gnReturnCode VkResultToGnReturnCode(VkResult result) {
|
||||
static inline gnReturnCode VkResultToGnReturnCode(VkResult result) {
|
||||
switch (result) {
|
||||
case VK_SUCCESS: return GN_SUCCESS;
|
||||
// case VK_NOT_READY: return ;
|
||||
|
Reference in New Issue
Block a user