Don't log when loader_platform_executable_path fails
loader_platform_executable_path is unimplemented on Fuchsia, so it's
expected to fail. Logging an error there was causing problems for clients
that get debug reports from vkCreateInstance.
Change-Id: I4e3c2a1969d726b34cccbe86a04192e3798f0784
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/Vulkan-Loader/+/542181
Reviewed-by: Craig Stout <cstout@google.com>
diff --git a/loader/loader.c b/loader/loader.c
index 28ab7b2..df0f3d7 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2871,6 +2871,8 @@
struct loader_layer_properties *props = &instance_layers->list[i];
if (strcmp(props->info.layerName, VK_OVERRIDE_LAYER_NAME) == 0) {
if (props->num_app_key_paths > 0) { // not the global layer
+ // cur_path is unset on Fuchsia, so app_key_path is not supported.
+#if !defined(__Fuchsia__)
for (uint32_t j = 0; j < props->num_app_key_paths; j++) {
if (strcmp(props->app_key_paths[j], cur_path) == 0) {
if (!found_active_override_layer) {
@@ -2886,6 +2888,7 @@
}
}
}
+#endif
if (!found_active_override_layer) {
// Remove non-global override layers that don't have an app_key that matches cur_path
loaderRemoveLayerInList(inst, instance_layers, i);
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index 5d5f9b1..6478696 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -125,7 +125,13 @@
return buffer;
}
#elif defined(__Fuchsia__) // defined(__APPLE__)
-static inline char *loader_platform_executable_path(char *buffer, size_t size) { return NULL; }
+static inline char *loader_platform_executable_path(char *buffer, size_t size) {
+ if (size < 1)
+ return NULL;
+ // Fuchsia doesn't support getting the executable path. The blank path should match no layers.
+ buffer[0] = '\0';
+ return buffer;
+}
#elif defined(__QNXNTO__)
#define SYSCONFDIR "/etc"