Commit 93a703e2 authored by Jamie Madill's avatar Jamie Madill Committed by Commit Bot

When loading SwiftShader also search CWD.

This will allow moving the SwiftShader Vulkan module to the root
out folder. This in turn will enable more easily running TSAN and
ASAN testers.

Bug: angleproject:3876
Bug: angleproject:3912
Bug: b/140251624
Change-Id: I3ed8598ca396a445f46d5cddc4d19f997f4e61f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1811317Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697749}
parent 9604c580
......@@ -33,6 +33,15 @@ class ScopedUnsetDisplay {
DISALLOW_COPY_AND_ASSIGN(ScopedUnsetDisplay);
};
bool InitializeVulkanFunctionPointers(
const base::FilePath& path,
VulkanFunctionPointers* vulkan_function_pointers) {
base::NativeLibraryLoadError native_library_load_error;
vulkan_function_pointers->vulkan_loader_library_ =
base::LoadNativeLibrary(path, &native_library_load_error);
return vulkan_function_pointers->vulkan_loader_library_;
}
} // namespace
VulkanImplementationX11::VulkanImplementationX11(bool use_swiftshader)
......@@ -61,21 +70,26 @@ bool VulkanImplementationX11::InitializeVulkanInstance(bool using_surface) {
VulkanFunctionPointers* vulkan_function_pointers =
gpu::GetVulkanFunctionPointers();
base::FilePath path;
if (use_swiftshader()) {
base::FilePath path;
if (!base::PathService::Get(base::DIR_MODULE, &path))
return false;
path = path.Append("swiftshader/libvk_swiftshader.so");
base::FilePath root_path = path.Append("libvk_swiftshader.so");
if (!InitializeVulkanFunctionPointers(root_path,
vulkan_function_pointers)) {
base::FilePath rel_path = path.Append("swiftshader/libvk_swiftshader.so");
if (!InitializeVulkanFunctionPointers(rel_path,
vulkan_function_pointers)) {
return false;
}
}
} else {
path = base::FilePath("libvulkan.so.1");
base::FilePath path = base::FilePath("libvulkan.so.1");
if (!InitializeVulkanFunctionPointers(path, vulkan_function_pointers))
return false;
}
base::NativeLibraryLoadError native_library_load_error;
vulkan_function_pointers->vulkan_loader_library_ =
base::LoadNativeLibrary(path, &native_library_load_error);
if (!vulkan_function_pointers->vulkan_loader_library_)
return false;
if (!vulkan_instance_.Initialize(required_extensions, {}))
return false;
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment