create seperate transfer queue on vulkan
This commit is contained in:
@@ -46,21 +46,37 @@ gnReturnCode gnCreateOutputDeviceFn(gnOutputDeviceHandle outputDevice, gnInstanc
|
|||||||
vkGetDeviceQueue(outputDevice->outputDevice->device, deviceInfo.queueInfos[i].queueIndex, 0, &outputDevice->outputDevice->queues[i]);
|
vkGetDeviceQueue(outputDevice->outputDevice->device, deviceInfo.queueInfos[i].queueIndex, 0, &outputDevice->outputDevice->queues[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// {
|
uint32_t queueCount = 0;
|
||||||
// QueueFamilyIndices queueFamilyIndices = findQueueFamilies(
|
vkGetPhysicalDeviceQueueFamilyProperties(
|
||||||
// outputDevice->physicalOutputDevice->physicalOutputDevice->instance->instance->window_surface,
|
deviceInfo.physicalDevice.physicalDevice->device,
|
||||||
// outputDevice->physicalOutputDevice->physicalOutputDevice->device
|
&queueCount,
|
||||||
// );
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
// VkCommandPoolCreateInfo poolInfo{};
|
VkQueueFamilyProperties* queueFamilies = malloc(sizeof(VkQueueFamilyProperties) * queueCount);
|
||||||
// poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
vkGetPhysicalDeviceQueueFamilyProperties(
|
||||||
// poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
|
deviceInfo.physicalDevice.physicalDevice->device,
|
||||||
// poolInfo.queueFamilyIndex = queueFamilyIndices.graphicsFamily.value();
|
&queueCount,
|
||||||
|
queueFamilies
|
||||||
|
);
|
||||||
|
|
||||||
// if (vkCreateCommandPool(outputDevice->outputDevice->device, &poolInfo, nullptr, &outputDevice->outputDevice->commandPool) != VK_SUCCESS) {
|
uint32_t transferQueueIndex = 0;
|
||||||
// return GN_FAILED;
|
for (int i = 0; i < queueCount; i++) {
|
||||||
// }
|
if ((queueFamilies[i].queueFlags & VK_QUEUE_TRANSFER_BIT) == VK_QUEUE_TRANSFER_BIT) {
|
||||||
// }
|
transferQueueIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VkCommandPoolCreateInfo poolInfo = {
|
||||||
|
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
||||||
|
.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
|
||||||
|
.queueFamilyIndex = transferQueueIndex
|
||||||
|
};
|
||||||
|
|
||||||
|
if (vkCreateCommandPool(outputDevice->outputDevice->device, &poolInfo, NULL, &outputDevice->outputDevice->transferQueue) != VK_SUCCESS) {
|
||||||
|
return GN_FAILED_TO_CREATE_COMMAND_POOL;
|
||||||
|
}
|
||||||
|
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -70,6 +86,7 @@ void gnWaitForDeviceFn(const gnOutputDeviceHandle device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gnDestroyOutputDeviceFn(gnOutputDeviceHandle device) {
|
void gnDestroyOutputDeviceFn(gnOutputDeviceHandle device) {
|
||||||
|
vkDestroyCommandPool(device->outputDevice->device, device->outputDevice->transferQueue, NULL);
|
||||||
vkDestroyDevice(device->outputDevice->device, NULL);
|
vkDestroyDevice(device->outputDevice->device, NULL);
|
||||||
free(device->outputDevice);
|
free(device->outputDevice);
|
||||||
}
|
}
|
||||||
|
@@ -4,11 +4,7 @@
|
|||||||
|
|
||||||
typedef struct gnPlatformOutputDevice_t {
|
typedef struct gnPlatformOutputDevice_t {
|
||||||
VkDevice device;
|
VkDevice device;
|
||||||
|
|
||||||
uint32_t queueCount;
|
uint32_t queueCount;
|
||||||
VkQueue* queues;
|
VkQueue* queues;
|
||||||
|
VkCommandPool transferQueue;
|
||||||
// VkQueue presentQueue;
|
|
||||||
// VkQueue graphicsQueue;
|
|
||||||
// VkCommandPool commandPool;
|
|
||||||
} gnPlatformOutputDevice;
|
} gnPlatformOutputDevice;
|
||||||
|
Reference in New Issue
Block a user