From 2ac2835a1f1c3cce887b03645ed4ffd7ba1f54e0 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 4 Nov 2022 14:12:38 +0100 Subject: render/vulkan: remove exts arg from vulkan_instance_create() --- render/vulkan/renderer.c | 2 +- render/vulkan/vulkan.c | 24 ++++-------------------- 2 files changed, 5 insertions(+), 21 deletions(-) (limited to 'render') diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index 304f5e41..3a0cfde4 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -1713,7 +1713,7 @@ struct wlr_renderer *wlr_vk_renderer_create_with_drm_fd(int drm_fd) { // NOTE: we could add functionality to allow the compositor passing its // name and version to this function. Just use dummies until then, // shouldn't be relevant to the driver anyways - struct wlr_vk_instance *ini = vulkan_instance_create(0, NULL, default_debug); + struct wlr_vk_instance *ini = vulkan_instance_create(default_debug); if (!ini) { wlr_log(WLR_ERROR, "creating vulkan instance for renderer failed"); return NULL; diff --git a/render/vulkan/vulkan.c b/render/vulkan/vulkan.c index 7f8eb580..034c160c 100644 --- a/render/vulkan/vulkan.c +++ b/render/vulkan/vulkan.c @@ -84,8 +84,7 @@ static VkBool32 debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT severity, // instance -struct wlr_vk_instance *vulkan_instance_create(size_t ext_count, - const char **exts, bool debug) { +struct wlr_vk_instance *vulkan_instance_create(bool debug) { // we require vulkan 1.1 PFN_vkEnumerateInstanceVersion pfEnumInstanceVersion = (PFN_vkEnumerateInstanceVersion) @@ -132,22 +131,7 @@ struct wlr_vk_instance *vulkan_instance_create(size_t ext_count, } 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; - } - - // find extensions - for (unsigned i = 0; i < ext_count; ++i) { - if (find_extensions(avail_ext_props, avail_extc, &exts[i], 1)) { - wlr_log(WLR_DEBUG, "vulkan instance extension %s not found", - exts[i]); - continue; - } - - extensions[extensions_len++] = exts[i]; - } + const char *extensions[1] = {0}; bool debug_utils_found = false; if (debug) { @@ -158,6 +142,8 @@ struct wlr_vk_instance *vulkan_instance_create(size_t ext_count, } } + assert(extensions_len <= sizeof(extensions) / sizeof(extensions[0])); + VkApplicationInfo application_info = {0}; application_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; application_info.pEngineName = "wlroots"; @@ -210,8 +196,6 @@ struct wlr_vk_instance *vulkan_instance_create(size_t ext_count, goto error; } - free(extensions); - // debug callback if (debug_utils_found) { ini->api.createDebugUtilsMessengerEXT = -- cgit v1.2.3