render/vulkan: drop wlr_vk_instance.extensions

This was unused. Even if it was, it'd be better to have bool fields
instead.
This commit is contained in:
Simon Ser 2022-10-10 14:39:47 +02:00
parent 650f955507
commit 221ee83d44
2 changed files with 10 additions and 12 deletions

View file

@ -18,10 +18,6 @@ struct wlr_vk_instance {
VkInstance instance;
VkDebugUtilsMessengerEXT messenger;
// enabled extensions
size_t extension_count;
const char **extensions;
struct {
PFN_vkCreateDebugUtilsMessengerEXT createDebugUtilsMessengerEXT;
PFN_vkDestroyDebugUtilsMessengerEXT destroyDebugUtilsMessengerEXT;

View file

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