aboutsummaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
Diffstat (limited to 'loader')
-rw-r--r--loader/loader.c21
-rw-r--r--loader/vk_loader_platform.h8
2 files changed, 21 insertions, 8 deletions
diff --git a/loader/loader.c b/loader/loader.c
index 17c2f557..59572474 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2182,11 +2182,12 @@ loader_add_layer_properties(const struct loader_instance *inst,
* Linux Layer| dirs | dirs
*/
static void loader_get_manifest_files(const struct loader_instance *inst,
- const char *env_override, bool is_layer,
+ const char *env_override,
+ const char *source_override, bool is_layer,
const char *location,
const char *home_location,
struct loader_manifest_files *out_files) {
- char *override = NULL;
+ const char *override = NULL;
char *loc;
char *file, *next_file, *name;
size_t alloced_count = 64;
@@ -2198,7 +2199,9 @@ static void loader_get_manifest_files(const struct loader_instance *inst,
out_files->count = 0;
out_files->filename_list = NULL;
- if (env_override != NULL && (override = loader_getenv(env_override))) {
+ if (source_override != NULL) {
+ override = source_override;
+ } else if (env_override != NULL && (override = loader_getenv(env_override))) {
#if !defined(_WIN32)
if (geteuid() != getuid() || getegid() != getgid()) {
/* Don't allow setuid apps to use the env var: */
@@ -2260,7 +2263,9 @@ static void loader_get_manifest_files(const struct loader_instance *inst,
return;
}
strcpy(loc, override);
- loader_free_getenv(override);
+ if (source_override == NULL) {
+ loader_free_getenv(override);
+ }
}
// Print out the paths being searched if debugging is enabled
@@ -2410,7 +2415,7 @@ void loader_icd_scan(const struct loader_instance *inst,
loader_scanned_icd_init(inst, icds);
// Get a list of manifest files for ICDs
- loader_get_manifest_files(inst, "VK_ICD_FILENAMES", false,
+ loader_get_manifest_files(inst, "VK_ICD_FILENAMES", NULL, false,
DEFAULT_VK_DRIVERS_INFO, HOME_VK_DRIVERS_INFO,
&manifest_files);
if (manifest_files.count == 0)
@@ -2525,12 +2530,12 @@ void loader_layer_scan(const struct loader_instance *inst,
uint32_t implicit;
// Get a list of manifest files for explicit layers
- loader_get_manifest_files(inst, LAYERS_PATH_ENV, true,
+ loader_get_manifest_files(inst, LAYERS_PATH_ENV, LAYERS_SOURCE_PATH, true,
DEFAULT_VK_ELAYERS_INFO, HOME_VK_ELAYERS_INFO,
&manifest_files[0]);
// Pass NULL for environment variable override - implicit layers are not
// overridden by LAYERS_PATH_ENV
- loader_get_manifest_files(inst, NULL, true, DEFAULT_VK_ILAYERS_INFO,
+ loader_get_manifest_files(inst, NULL, NULL, true, DEFAULT_VK_ILAYERS_INFO,
HOME_VK_ILAYERS_INFO, &manifest_files[1]);
if (manifest_files[0].count == 0 && manifest_files[1].count == 0)
return;
@@ -2585,7 +2590,7 @@ void loader_implicit_layer_scan(const struct loader_instance *inst,
// Pass NULL for environment variable override - implicit layers are not
// overridden by LAYERS_PATH_ENV
- loader_get_manifest_files(inst, NULL, true, DEFAULT_VK_ILAYERS_INFO,
+ loader_get_manifest_files(inst, NULL, NULL, true, DEFAULT_VK_ILAYERS_INFO,
HOME_VK_ILAYERS_INFO, &manifest_files);
if (manifest_files.count == 0) {
return;
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index aed0a703..c94e33c0 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -106,6 +106,9 @@
"/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" \
"/usr/" DATADIR VULKAN_ILAYERCONF_DIR
#define DEFAULT_VK_LAYERS_PATH ""
+#if !defined(LAYERS_SOURCE_PATH)
+#define LAYERS_SOURCE_PATH NULL
+#endif
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
#define HOME_VK_DRIVERS_INFO "/.local/share" VULKAN_ICDCONF_DIR
#define HOME_VK_ELAYERS_INFO "/.local/share" VULKAN_ELAYERCONF_DIR
@@ -250,7 +253,12 @@ using namespace std;
#define DEFAULT_VK_DRIVERS_PATH ""
#define DEFAULT_VK_ELAYERS_INFO "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers"
#define DEFAULT_VK_ILAYERS_INFO "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers"
+#if !defined(DEFAULT_VK_LAYERS_PATH)
#define DEFAULT_VK_LAYERS_PATH ""
+#endif
+#if !defined(LAYERS_SOURCE_PATH)
+#define LAYERS_SOURCE_PATH NULL
+#endif
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
#define HOME_VK_DRIVERS_INFO ""
#define HOME_VK_ELAYERS_INFO ""