Skip to content

Commit 639f392

Browse files
Correctly check if settings file exists on windows
While there was logic to check if the vk_loader_settings.json file existed, it was not being run at an appropriate time and with another expression that caused the check to never happen. This commit also logs that the loader fails to find the loader settings file, and if it finds a registry entry, if the file doesn't exist.
1 parent 684dcee commit 639f392

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

loader/loader_windows.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,12 +1194,15 @@ VkResult get_settings_path_if_exists_in_registry_key(const struct loader_instanc
11941194
}
11951195
}
11961196

1197-
// Make sure the path exists first
1198-
if (*out_path && !loader_platform_file_exists(name)) {
1199-
return VK_ERROR_INITIALIZATION_FAILED;
1200-
}
1201-
12021197
if (strcmp(VK_LOADER_SETTINGS_FILENAME, &(name[start_of_path_filename])) == 0) {
1198+
// Make sure the path exists first
1199+
if (!loader_platform_file_exists(name)) {
1200+
loader_log(
1201+
inst, VULKAN_LOADER_DEBUG_BIT, 0,
1202+
"Registry contained entry to vk_loader_settings.json but the corresponding file does not exist, ignoring");
1203+
return VK_ERROR_INITIALIZATION_FAILED;
1204+
}
1205+
12031206
*out_path = loader_instance_heap_calloc(inst, name_size + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
12041207
if (*out_path == NULL) {
12051208
return VK_ERROR_OUT_OF_HOST_MEMORY;

loader/settings.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,16 @@ VkResult get_loader_settings(const struct loader_instance* inst, loader_settings
315315
#if defined(WIN32)
316316
res = windows_get_loader_settings_file_path(inst, &settings_file_path);
317317
if (res != VK_SUCCESS) {
318+
loader_log(inst, VULKAN_LOADER_INFO_BIT, 0,
319+
"No valid vk_loader_settings.json file found, no loader settings will be active");
318320
goto out;
319321
}
320322

321323
#elif COMMON_UNIX_PLATFORMS
322324
res = get_unix_settings_path(inst, &settings_file_path);
323325
if (res != VK_SUCCESS) {
326+
loader_log(inst, VULKAN_LOADER_INFO_BIT, 0,
327+
"No valid vk_loader_settings.json file found, no loader settings will be active");
324328
goto out;
325329
}
326330
#else

0 commit comments

Comments
 (0)