diff options
author | Mark Young <marky@lunarg.com> | 2017-02-10 11:19:02 -0700 |
---|---|---|
committer | Mark Young <marky@lunarg.com> | 2017-02-10 11:19:02 -0700 |
commit | fb670e208a5c44efebebec6f514a95c05098bed6 (patch) | |
tree | b908d180eb7fa298db4af8f33b4f1a6eab62782a /loader | |
parent | f07b961f9ca73f03b3b2b332b1b06828dbed3d96 (diff) |
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
Diffstat (limited to 'loader')
-rw-r--r-- | loader/loader.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/loader/loader.c b/loader/loader.c index b6adbb10..3d7180cf 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; } } |