|
|
|
@ -579,19 +579,57 @@ VkResult create_logical_device(VkPhysicalDevice physical_device, VkSurfaceKHR su
|
|
|
|
|
return VK_ERROR_INITIALIZATION_FAILED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t family_indices[] = {
|
|
|
|
|
transfer_queue->family,
|
|
|
|
|
graphics_queue->family,
|
|
|
|
|
present_queue->family,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
VkDeviceQueueCreateInfo queue_create_info[3] = {};
|
|
|
|
|
uint32_t queue_count = 0;
|
|
|
|
|
float default_queue_priority = 1.0f;
|
|
|
|
|
for(uint32_t i = 0; i < 3; i++) {
|
|
|
|
|
queue_create_info[i].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[i].queueFamilyIndex = family_indices[i];
|
|
|
|
|
queue_create_info[i].queueCount = 1;
|
|
|
|
|
queue_create_info[i].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
if(graphics_queue->family == present_queue->family && graphics_queue->family == transfer_queue->family) {
|
|
|
|
|
queue_count = 1;
|
|
|
|
|
|
|
|
|
|
queue_create_info[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[0].queueFamilyIndex = graphics_queue->family;
|
|
|
|
|
queue_create_info[0].queueCount = 2;
|
|
|
|
|
queue_create_info[0].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
} else if (graphics_queue->family == present_queue->family) {
|
|
|
|
|
queue_count = 2;
|
|
|
|
|
|
|
|
|
|
queue_create_info[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[0].queueFamilyIndex = graphics_queue->family;
|
|
|
|
|
queue_create_info[0].queueCount = 1;
|
|
|
|
|
queue_create_info[0].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
|
|
|
|
|
queue_create_info[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[1].queueFamilyIndex = transfer_queue->family;
|
|
|
|
|
queue_create_info[1].queueCount = 1;
|
|
|
|
|
queue_create_info[1].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
} else if (graphics_queue->family == transfer_queue->family) {
|
|
|
|
|
queue_count = 2;
|
|
|
|
|
|
|
|
|
|
queue_create_info[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[0].queueFamilyIndex = graphics_queue->family;
|
|
|
|
|
queue_create_info[0].queueCount = 2;
|
|
|
|
|
queue_create_info[0].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
|
|
|
|
|
queue_create_info[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[1].queueFamilyIndex = present_queue->family;
|
|
|
|
|
queue_create_info[1].queueCount = 1;
|
|
|
|
|
queue_create_info[1].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
} else {
|
|
|
|
|
queue_count = 3;
|
|
|
|
|
|
|
|
|
|
queue_create_info[0].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[0].queueFamilyIndex = graphics_queue->family;
|
|
|
|
|
queue_create_info[0].queueCount = 1;
|
|
|
|
|
queue_create_info[0].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
|
|
|
|
|
queue_create_info[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[1].queueFamilyIndex = present_queue->family;
|
|
|
|
|
queue_create_info[1].queueCount = 1;
|
|
|
|
|
queue_create_info[1].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
|
|
|
|
|
queue_create_info[1].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
|
|
|
|
queue_create_info[1].queueFamilyIndex = transfer_queue->family;
|
|
|
|
|
queue_create_info[1].queueCount = 1;
|
|
|
|
|
queue_create_info[1].pQueuePriorities = &default_queue_priority;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VkPhysicalDeviceVulkan12Features features_12 = {
|
|
|
|
@ -612,7 +650,7 @@ VkResult create_logical_device(VkPhysicalDevice physical_device, VkSurfaceKHR su
|
|
|
|
|
VkDeviceCreateInfo device_create_info = {
|
|
|
|
|
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
|
|
|
|
.pQueueCreateInfos = queue_create_info,
|
|
|
|
|
.queueCreateInfoCount = 3,
|
|
|
|
|
.queueCreateInfoCount = queue_count,
|
|
|
|
|
.pEnabledFeatures = &device_features,
|
|
|
|
|
.enabledExtensionCount = device_extension_count,
|
|
|
|
|
.ppEnabledExtensionNames = device_extensions,
|
|
|
|
@ -1460,6 +1498,7 @@ Object create_renderable(Mesh* mesh, GraphicsPipeline* pipeline) {
|
|
|
|
|
return object;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Structure representing a descriptor set for an array of VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
|
|
|
|
|
typedef struct TextureSetStruct {
|
|
|
|
|
uint32_t max_images;
|
|
|
|
|
Texture** textures;
|
|
|
|
|