vulkan: fix crash when only non-global layers are enabled
We fail to set up get_instance_proc_addr_ and get_device_proc_addr_ when
there are layers but only non-global ones.
Bug: 28990561
Change-Id: I82704f946deb5a76640f9dfb792e6fd118c78aa7
diff --git a/vulkan/libvulkan/api.cpp b/vulkan/libvulkan/api.cpp
index 8053668..b699fe9 100644
--- a/vulkan/libvulkan/api.cpp
+++ b/vulkan/libvulkan/api.cpp
@@ -602,6 +602,13 @@
new (&layers_[layer_count_++]) ActiveLayer{GetLayerRef(l), {}};
}
+ // this may happen when all layers are non-global ones
+ if (!layer_count_) {
+ get_instance_proc_addr_ = driver::GetInstanceProcAddr;
+ get_device_proc_addr_ = driver::GetDeviceProcAddr;
+ return VK_SUCCESS;
+ }
+
SetupLayerLinks();
return VK_SUCCESS;