|
|
@ -131,9 +131,9 @@ struct wlr_vk_instance *vulkan_instance_create(size_t ext_count,
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool debug_utils_found = false;
|
|
|
|
size_t extensions_len = 0;
|
|
|
|
ini->extensions = calloc(1 + ext_count, sizeof(*ini->extensions));
|
|
|
|
const char **extensions = calloc(1 + ext_count, sizeof(*extensions));
|
|
|
|
if (!ini->extensions) {
|
|
|
|
if (extensions) {
|
|
|
|
wlr_log_errno(WLR_ERROR, "allocation failed");
|
|
|
|
wlr_log_errno(WLR_ERROR, "allocation failed");
|
|
|
|
goto error;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -146,14 +146,15 @@ struct wlr_vk_instance *vulkan_instance_create(size_t ext_count,
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ini->extensions[ini->extension_count++] = exts[i];
|
|
|
|
extensions[extensions_len++] = exts[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool debug_utils_found = false;
|
|
|
|
if (debug) {
|
|
|
|
if (debug) {
|
|
|
|
const char *name = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
|
|
|
const char *name = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
|
|
|
|
if (find_extensions(avail_ext_props, avail_extc, &name, 1) == NULL) {
|
|
|
|
if (find_extensions(avail_ext_props, avail_extc, &name, 1) == NULL) {
|
|
|
|
debug_utils_found = true;
|
|
|
|
debug_utils_found = true;
|
|
|
|
ini->extensions[ini->extension_count++] = name;
|
|
|
|
extensions[extensions_len++] = name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -174,8 +175,8 @@ struct wlr_vk_instance *vulkan_instance_create(size_t ext_count,
|
|
|
|
VkInstanceCreateInfo instance_info = {0};
|
|
|
|
VkInstanceCreateInfo instance_info = {0};
|
|
|
|
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
|
|
|
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
|
|
|
instance_info.pApplicationInfo = &application_info;
|
|
|
|
instance_info.pApplicationInfo = &application_info;
|
|
|
|
instance_info.enabledExtensionCount = ini->extension_count;
|
|
|
|
instance_info.enabledExtensionCount = extensions_len;
|
|
|
|
instance_info.ppEnabledExtensionNames = ini->extensions;
|
|
|
|
instance_info.ppEnabledExtensionNames = extensions;
|
|
|
|
instance_info.enabledLayerCount = layer_count;
|
|
|
|
instance_info.enabledLayerCount = layer_count;
|
|
|
|
instance_info.ppEnabledLayerNames = layers;
|
|
|
|
instance_info.ppEnabledLayerNames = layers;
|
|
|
|
|
|
|
|
|
|
|
@ -209,6 +210,8 @@ struct wlr_vk_instance *vulkan_instance_create(size_t ext_count,
|
|
|
|
goto error;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
free(extensions);
|
|
|
|
|
|
|
|
|
|
|
|
// debug callback
|
|
|
|
// debug callback
|
|
|
|
if (debug_utils_found) {
|
|
|
|
if (debug_utils_found) {
|
|
|
|
ini->api.createDebugUtilsMessengerEXT =
|
|
|
|
ini->api.createDebugUtilsMessengerEXT =
|
|
|
@ -247,7 +250,6 @@ void vulkan_instance_destroy(struct wlr_vk_instance *ini) {
|
|
|
|
vkDestroyInstance(ini->instance, NULL);
|
|
|
|
vkDestroyInstance(ini->instance, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
free(ini->extensions);
|
|
|
|
|
|
|
|
free(ini);
|
|
|
|
free(ini);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|