Commit 18e99f4a by Jamie Madill Committed by Angle LUCI CQ

Add SearchType to OpenSharedLibraryWithExtension.

This fixes a bug in SystemInfo_vulkan where we were using the System search path for the Vulkan loader when we prefer using the custom ANGLE loader. Bug: chromium:1219969 Change-Id: Iedf0fd11fe9ed8cc020b445ea9e12a7936937361 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2988791Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 971ba359
......@@ -120,8 +120,8 @@ SampleApplication::SampleApplication(std::string name,
mDriverType = angle::GLESDriverType::SystemWGL;
#else
mGLWindow = EGLWindow::New(glesMajorVersion, glesMinorVersion);
mEntryPointsLib.reset(
angle::OpenSharedLibraryWithExtension(angle::GetNativeEGLLibraryNameWithExtension()));
mEntryPointsLib.reset(angle::OpenSharedLibraryWithExtension(
angle::GetNativeEGLLibraryNameWithExtension(), angle::SearchType::SystemDir));
mDriverType = angle::GLESDriverType::SystemEGL;
#endif // defined(ANGLE_PLATFORM_WINDOWS)
}
......
......@@ -79,7 +79,7 @@ enum class SearchType
};
Library *OpenSharedLibrary(const char *libraryName, SearchType searchType);
Library *OpenSharedLibraryWithExtension(const char *libraryName);
Library *OpenSharedLibraryWithExtension(const char *libraryName, SearchType searchType);
// Returns true if the process is currently being debugged.
bool IsDebuggerAttached();
......
......@@ -108,6 +108,12 @@ class PosixLibrary : public Library
Library *OpenSharedLibrary(const char *libraryName, SearchType searchType)
{
std::string nameWithExt = std::string(libraryName) + "." + GetSharedLibraryExtension();
return OpenSharedLibraryWithExtension(nameWithExt.c_str(), searchType);
}
Library *OpenSharedLibraryWithExtension(const char *libraryName, SearchType searchType)
{
std::string directory;
if (searchType == SearchType::ApplicationDir)
{
......@@ -125,17 +131,12 @@ Library *OpenSharedLibrary(const char *libraryName, SearchType searchType)
extraFlags = RTLD_NOLOAD;
}
std::string fullPath = directory + libraryName + "." + GetSharedLibraryExtension();
std::string fullPath = directory + libraryName;
#if ANGLE_PLATFORM_IOS
// On iOS, dlopen needs a suffix on the framework name to work.
fullPath = fullPath + "/" + libraryName;
#endif
return new PosixLibrary(fullPath, extraFlags);
}
Library *OpenSharedLibraryWithExtension(const char *libraryName)
{
return new PosixLibrary(libraryName, 0);
return new PosixLibrary(libraryName, extraFlags);
}
bool IsDirectory(const char *filename)
......
......@@ -96,8 +96,8 @@ Library *OpenSharedLibrary(const char *libraryName, SearchType searchType)
}
}
Library *OpenSharedLibraryWithExtension(const char *libraryName)
Library *OpenSharedLibraryWithExtension(const char *libraryName, SearchType searchType)
{
return new Win32Library(libraryName, SearchType::SystemDir);
return new Win32Library(libraryName, searchType);
}
} // namespace angle
......@@ -47,7 +47,7 @@ class VulkanLibrary final : NonCopyable
{
for (const char *libraryName : kLibVulkanNames)
{
mLibVulkan = OpenSharedLibraryWithExtension(libraryName);
mLibVulkan = OpenSharedLibraryWithExtension(libraryName, SearchType::ApplicationDir);
if (mLibVulkan)
{
if (mLibVulkan->getNative())
......
......@@ -605,8 +605,8 @@ ANGLERenderTest::ANGLERenderTest(const std::string &name,
case angle::GLESDriverType::SystemEGL:
#if defined(ANGLE_USE_UTIL_LOADER) && !defined(ANGLE_PLATFORM_WINDOWS)
mGLWindow = EGLWindow::New(testParams.majorVersion, testParams.minorVersion);
mEntryPointsLib.reset(
angle::OpenSharedLibraryWithExtension(GetNativeEGLLibraryNameWithExtension()));
mEntryPointsLib.reset(angle::OpenSharedLibraryWithExtension(
GetNativeEGLLibraryNameWithExtension(), SearchType::SystemDir));
#else
std::cerr << "Not implemented." << std::endl;
mSkipTest = true;
......
......@@ -1488,8 +1488,8 @@ Library *ANGLETestEnvironment::GetSystemEGLLibrary()
#if defined(ANGLE_USE_UTIL_LOADER)
if (!gSystemEGLLibrary)
{
gSystemEGLLibrary.reset(
OpenSharedLibraryWithExtension(GetNativeEGLLibraryNameWithExtension()));
gSystemEGLLibrary.reset(OpenSharedLibraryWithExtension(
GetNativeEGLLibraryNameWithExtension(), SearchType::SystemDir));
}
#endif // defined(ANGLE_USE_UTIL_LOADER)
return gSystemEGLLibrary.get();
......
......@@ -81,7 +81,8 @@ bool IsSystemEGLConfigSupported(const PlatformParameters &param, OSWindow *osWin
#if defined(ANGLE_USE_UTIL_LOADER)
std::unique_ptr<angle::Library> eglLibrary;
eglLibrary.reset(OpenSharedLibraryWithExtension(GetNativeEGLLibraryNameWithExtension()));
eglLibrary.reset(OpenSharedLibraryWithExtension(GetNativeEGLLibraryNameWithExtension(),
SearchType::SystemDir));
EGLWindow *eglWindow = EGLWindow::New(param.majorVersion, param.minorVersion);
ConfigParameters configParams;
......
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