From: Mark Young Date: Fri, 10 Feb 2017 18:19:02 +0000 (-0700) Subject: loader: Add env var to disable inst ext filter X-Git-Tag: upstream/1.1.92~1595 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4207f1b068ad78b5738c6917f7d6b59e741bb462;p=platform%2Fupstream%2FVulkan-Tools.git loader: Add env var to disable inst ext filter Add an environmental variable to disable the instance extension filtering. Simply defining VK_LOADER_DISABLE_INST_EXT_FILTER to a non-zero number will disable the functionality. Change-Id: I953814b49e87289a35f154755521d5433474c920 --- diff --git a/loader/loader.c b/loader/loader.c index b6adbb1..3d7180c 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -1238,9 +1238,18 @@ VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance struct loader_extension_list *inst_exts) { struct loader_extension_list icd_exts; VkResult res = VK_SUCCESS; + char *env_value; + bool filter_extensions = true; loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Build ICD instance extension list"); + // Check if a user wants to disable the instance extension filtering behavior + env_value = loader_getenv("VK_LOADER_DISABLE_INST_EXT_FILTER", inst); + if (NULL != env_value && atoi(env_value) != 0) { + filter_extensions = false; + } + loader_free_getenv(env_value, inst); + // traverse scanned icd list adding non-duplicate extensions to the list for (uint32_t i = 0; i < icd_tramp_list->count; i++) { res = loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts, sizeof(VkExtensionProperties)); @@ -1250,24 +1259,26 @@ VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance res = loader_add_instance_extensions(inst, icd_tramp_list->scanned_list[i].EnumerateInstanceExtensionProperties, icd_tramp_list->scanned_list[i].lib_name, &icd_exts); if (VK_SUCCESS == res) { - // Remove any extensions not recognized by the loader - for (int32_t j = 0; j < (int32_t)icd_exts.count; j++) { - // See if the extension is in the list of supported extensions - bool found = false; - for (uint32_t k = 0; LOADER_INSTANCE_EXTENSIONS[k] != NULL; k++) { - if (strcmp(icd_exts.list[j].extensionName, LOADER_INSTANCE_EXTENSIONS[k]) == 0) { - found = true; - break; + if (filter_extensions) { + // Remove any extensions not recognized by the loader + for (int32_t j = 0; j < (int32_t)icd_exts.count; j++) { + // See if the extension is in the list of supported extensions + bool found = false; + for (uint32_t k = 0; LOADER_INSTANCE_EXTENSIONS[k] != NULL; k++) { + if (strcmp(icd_exts.list[j].extensionName, LOADER_INSTANCE_EXTENSIONS[k]) == 0) { + found = true; + break; + } } - } - // If it isn't in the list, remove it - if (!found) { - for (uint32_t k = j + 1; k < icd_exts.count; k++) { - icd_exts.list[k - 1] = icd_exts.list[k]; + // If it isn't in the list, remove it + if (!found) { + for (uint32_t k = j + 1; k < icd_exts.count; k++) { + icd_exts.list[k - 1] = icd_exts.list[k]; + } + --icd_exts.count; + --j; } - --icd_exts.count; - --j; } }