Vulkan: Use environment override to load layers.
Instead of using a compile-time define, use an OS call to override
the environment variable the loader uses to look for layers. This
should allow us to have a run-time override mechanism, so we can
more easily use ANGLE with RenderDoc and other tools that hook
into the layers for debugging and profiling purposes.
This should also allow the developer to install and use their own
layers with ANGLE if desired.
This patch removes the angle_loader.h generation since it is no
longer necessary.
It also fixes an unrelated loader warning that occured when releasing
the current pipeline object.
BUG=angleproject:1898
Change-Id: Ic4a5120a6b73745397451ef9e3897e157da1feda
Reviewed-on: https://chromium-review.googlesource.com/671490
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Frank Henigman <fjhenigman@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp
index bc090b0..8ca9d65 100644
--- a/src/libANGLE/renderer/vulkan/RendererVk.cpp
+++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp
@@ -172,9 +172,23 @@
else
{
previousCWD = cwd.value();
+ const char *exeDir = angle::GetExecutableDirectory();
+ if (!angle::SetCWD(exeDir))
+ {
+ ERR() << "Error setting CWD for Vulkan layers init.";
+ mEnableValidationLayers = false;
+ }
}
- const char *exeDir = angle::GetExecutableDirectory();
- angle::SetCWD(exeDir);
+ }
+
+ // Override environment variable to use the ANGLE layers.
+ if (mEnableValidationLayers)
+ {
+ if (!angle::SetEnvironmentVar(g_VkLoaderLayersPathEnv, ANGLE_VK_LAYERS_DIR))
+ {
+ ERR() << "Error setting environment for Vulkan layers init.";
+ mEnableValidationLayers = false;
+ }
}
// Gather global layer properties.