Add support for loading layers from the apk.
Added the vulkan_layer_path interface which is used to set the path from
ThreadedRenderer. The vulkan loader then uses this path to search for layer
libraries that come preinstalled with the app.
Change-Id: Iee7d56c1950296ba5ece3a119741406d705479a8
(cherry picked from commit 1f920c1e52bbd59405761e5403def5dbc22e331b)
diff --git a/vulkan/libvulkan/loader.cpp b/vulkan/libvulkan/loader.cpp
index ca33be1..97ceb4a 100644
--- a/vulkan/libvulkan/loader.cpp
+++ b/vulkan/libvulkan/loader.cpp
@@ -35,6 +35,7 @@
#include <hardware/hwvulkan.h>
#include <log/log.h>
#include <vulkan/vk_debug_report_lunarg.h>
+#include <vulkan/vulkan_loader_data.h>
using namespace vulkan;
@@ -753,13 +754,16 @@
instance->message = VK_NULL_HANDLE;
// Scan layers
- // TODO: Add more directories to scan
UnorderedMap<String, SharedLibraryHandle> layers(
CallbackAllocator<std::pair<String, SharedLibraryHandle> >(
instance->alloc));
CallbackAllocator<char> string_allocator(instance->alloc);
String dir_name("/data/local/tmp/vulkan/", string_allocator);
FindLayersInDirectory(*instance, layers, dir_name);
+ const std::string& path = LoaderData::GetInstance().layer_path;
+ dir_name.assign(path.c_str(), path.size());
+ dir_name.append("/");
+ FindLayersInDirectory(*instance, layers, dir_name);
// Load layers
{