fix seg fault
This commit is contained in:
@@ -45,7 +45,7 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
|||||||
if (vkCreateDevice(deviceInfo.physicalDevice->physicalDevice->device, &deviceCreateInfo, NULL, &outputDevice->outputDevice->device) != VK_SUCCESS)
|
if (vkCreateDevice(deviceInfo.physicalDevice->physicalDevice->device, &deviceCreateInfo, NULL, &outputDevice->outputDevice->device) != VK_SUCCESS)
|
||||||
return GN_FAILED_TO_CREATE_DEVICE;
|
return GN_FAILED_TO_CREATE_DEVICE;
|
||||||
|
|
||||||
outputDevice->outputDevice->queues = malloc(sizeof(VkQueue) * deviceInfo.physicalDevice->physicalDevice->neededQueueCount);
|
outputDevice->outputDevice->queues = malloc(sizeof(vulkanQueue) * deviceInfo.physicalDevice->physicalDevice->neededQueueCount);
|
||||||
uint32_t transferQueue = 0;
|
uint32_t transferQueue = 0;
|
||||||
for (int i = 0; i < deviceInfo.physicalDevice->physicalDevice->neededQueueCount; i++) {
|
for (int i = 0; i < deviceInfo.physicalDevice->physicalDevice->neededQueueCount; i++) {
|
||||||
outputDevice->outputDevice->queues[i].queueInfo = deviceInfo.physicalDevice->physicalDevice->neededQueues[i];
|
outputDevice->outputDevice->queues[i].queueInfo = deviceInfo.physicalDevice->physicalDevice->neededQueues[i];
|
||||||
@@ -61,20 +61,6 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t queueCount = 0;
|
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties(
|
|
||||||
deviceInfo.physicalDevice->physicalDevice->device,
|
|
||||||
&queueCount,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
VkQueueFamilyProperties* queueFamilies = malloc(sizeof(VkQueueFamilyProperties) * queueCount);
|
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties(
|
|
||||||
deviceInfo.physicalDevice->physicalDevice->device,
|
|
||||||
&queueCount,
|
|
||||||
queueFamilies
|
|
||||||
);
|
|
||||||
|
|
||||||
VkCommandPoolCreateInfo poolInfo = {
|
VkCommandPoolCreateInfo poolInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
||||||
.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
|
.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
|
||||||
@@ -84,9 +70,6 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
|||||||
if (vkCreateCommandPool(outputDevice->outputDevice->device, &poolInfo, NULL, &outputDevice->outputDevice->transferCommandPool) != VK_SUCCESS)
|
if (vkCreateCommandPool(outputDevice->outputDevice->device, &poolInfo, NULL, &outputDevice->outputDevice->transferCommandPool) != VK_SUCCESS)
|
||||||
return GN_FAILED_TO_CREATE_COMMAND_POOL;
|
return GN_FAILED_TO_CREATE_COMMAND_POOL;
|
||||||
|
|
||||||
free(queueCreateInfos);
|
|
||||||
free(queueFamilies);
|
|
||||||
|
|
||||||
VkFenceCreateInfo fenceInfo = { .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO };
|
VkFenceCreateInfo fenceInfo = { .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO };
|
||||||
if (vkCreateFence(outputDevice->outputDevice->device, &fenceInfo, NULL, &outputDevice->outputDevice->barrierFence) != VK_SUCCESS) return GN_FAILED_TO_CREATE_FENCE;
|
if (vkCreateFence(outputDevice->outputDevice->device, &fenceInfo, NULL, &outputDevice->outputDevice->barrierFence) != VK_SUCCESS) return GN_FAILED_TO_CREATE_FENCE;
|
||||||
|
|
||||||
|
@@ -8,10 +8,14 @@
|
|||||||
// // float* queuePriority;
|
// // float* queuePriority;
|
||||||
// } gnDeviceQueueInfo;
|
// } gnDeviceQueueInfo;
|
||||||
|
|
||||||
|
typedef struct gnOutputDeviceEnabledFeatures {
|
||||||
|
|
||||||
|
} gnOutputDeviceEnabledFeatures;
|
||||||
|
|
||||||
typedef struct gnOutputDeviceInfo {
|
typedef struct gnOutputDeviceInfo {
|
||||||
// uint32_t queueInfoCount;
|
// uint32_t queueInfoCount;
|
||||||
// gnDeviceQueueInfo* queueInfos;
|
// gnDeviceQueueInfo* queueInfos;
|
||||||
gnPhysicalDeviceFeatures enabledFeatures;
|
gnOutputDeviceEnabledFeatures enabledFeatures;
|
||||||
gnPhysicalDevice physicalDevice;
|
gnPhysicalDevice physicalDevice;
|
||||||
} gnOutputDeviceInfo;
|
} gnOutputDeviceInfo;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user