зеркало из https://github.com/AvaloniaUI/angle.git
Add support for testing with Mesa + Zink.
To run a trace test with zink, use --use-gl=zink. Bug: angleproject:7689 Change-Id: I70073756f903db1c224fe6175d55be4cad637aca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3899382 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
d19f872529
Коммит
a986811024
19
BUILD.gn
19
BUILD.gn
|
@ -222,6 +222,10 @@ config("internal_config") {
|
|||
if (angle_debug_layers_enabled) {
|
||||
defines += [ "ANGLE_DEBUG_LAYERS_ENABLED" ]
|
||||
}
|
||||
|
||||
if (angle_build_mesa) {
|
||||
defines += [ "ANGLE_HAS_MESA" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("constructor_and_destructor_warnings") {
|
||||
|
@ -1260,17 +1264,20 @@ config("library_name_config") {
|
|||
"ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}.cr\"",
|
||||
"ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}.cr\"",
|
||||
]
|
||||
} else if (angle_expose_wgl_entry_points) {
|
||||
defines = [
|
||||
"ANGLE_EGL_LIBRARY_NAME=\"libEGL\"",
|
||||
"ANGLE_GLESV2_LIBRARY_NAME=\"opengl32\"",
|
||||
]
|
||||
} else {
|
||||
glesv2_library_name = "libGLESv2"
|
||||
if (angle_expose_wgl_entry_points) {
|
||||
glesv2_library_name = "opengl32"
|
||||
}
|
||||
defines = [
|
||||
"ANGLE_EGL_LIBRARY_NAME=\"libEGL${angle_libs_suffix}\"",
|
||||
"ANGLE_GLESV2_LIBRARY_NAME=\"libGLESv2${angle_libs_suffix}\"",
|
||||
"ANGLE_GLESV2_LIBRARY_NAME=\"${glesv2_library_name}${angle_libs_suffix}\"",
|
||||
]
|
||||
}
|
||||
defines += [
|
||||
"ANGLE_MESA_EGL_LIBRARY_NAME=\"mesa/src/egl/libEGL\"",
|
||||
"ANGLE_MESA_GLESV2_LIBRARY_NAME=\"mesa/src/mapi/es2api/libGLESv2\"",
|
||||
]
|
||||
}
|
||||
|
||||
# This config controls export definitions on ANGLE API calls.
|
||||
|
|
|
@ -295,6 +295,10 @@ if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) {
|
|||
"$angle_root:libGLESv2",
|
||||
]
|
||||
|
||||
if (angle_build_mesa) {
|
||||
data_deps += [ "$angle_root/third_party/mesa" ]
|
||||
}
|
||||
|
||||
if (angle_enable_vulkan) {
|
||||
sources += [
|
||||
"gl_tests/VulkanExternalImageTest.cpp",
|
||||
|
@ -489,6 +493,10 @@ if (build_angle_perftests) {
|
|||
"//testing:run_perf_test",
|
||||
]
|
||||
|
||||
if (angle_build_mesa) {
|
||||
data_deps += [ "$angle_root/third_party/mesa" ]
|
||||
}
|
||||
|
||||
if (is_win || is_linux || is_chromeos) {
|
||||
data_deps += [ "${angle_root}/third_party/glmark2:glmark2_angle" ]
|
||||
}
|
||||
|
|
|
@ -673,6 +673,9 @@ std::string RenderTestParams::backend() const
|
|||
case GLESDriverType::SystemEGL:
|
||||
strstr << "_native";
|
||||
break;
|
||||
case GLESDriverType::ZinkEGL:
|
||||
strstr << "_zink";
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
return "_unk";
|
||||
|
@ -801,6 +804,12 @@ ANGLERenderTest::ANGLERenderTest(const std::string &name,
|
|||
skipTest("WGL driver not available.");
|
||||
#endif // defined(ANGLE_USE_UTIL_LOADER) && defined(ANGLE_PLATFORM_WINDOWS)
|
||||
break;
|
||||
case GLESDriverType::ZinkEGL:
|
||||
mGLWindow = EGLWindow::New(testParams.clientType, testParams.majorVersion,
|
||||
testParams.minorVersion, testParams.profileMask);
|
||||
mEntryPointsLib.reset(
|
||||
OpenSharedLibrary(ANGLE_MESA_EGL_LIBRARY_NAME, SearchType::ModuleDir));
|
||||
break;
|
||||
default:
|
||||
skipTest("Error in switch.");
|
||||
break;
|
||||
|
|
|
@ -101,6 +101,14 @@ ParamsT EGL(const ParamsT &in)
|
|||
return out;
|
||||
}
|
||||
|
||||
template <typename ParamsT>
|
||||
ParamsT Zink(const ParamsT &in)
|
||||
{
|
||||
ParamsT out = in;
|
||||
out.driver = angle::GLESDriverType::ZinkEGL;
|
||||
return out;
|
||||
}
|
||||
|
||||
template <typename ParamsT>
|
||||
ParamsT Native(const ParamsT &in)
|
||||
{
|
||||
|
|
|
@ -551,6 +551,7 @@ void ANGLETestBase::initOSWindow()
|
|||
{
|
||||
case GLESDriverType::AngleEGL:
|
||||
case GLESDriverType::SystemEGL:
|
||||
case GLESDriverType::ZinkEGL:
|
||||
{
|
||||
mFixture->eglWindow =
|
||||
EGLWindow::New(mCurrentParams->clientType, mCurrentParams->majorVersion,
|
||||
|
@ -1519,6 +1520,7 @@ Optional<EGLint> ANGLETestBase::mLastRendererType;
|
|||
Optional<angle::GLESDriverType> ANGLETestBase::mLastLoadedDriver;
|
||||
|
||||
std::unique_ptr<Library> ANGLETestEnvironment::gAngleEGLLibrary;
|
||||
std::unique_ptr<Library> ANGLETestEnvironment::gMesaEGLLibrary;
|
||||
std::unique_ptr<Library> ANGLETestEnvironment::gSystemEGLLibrary;
|
||||
std::unique_ptr<Library> ANGLETestEnvironment::gSystemWGLLibrary;
|
||||
|
||||
|
@ -1540,6 +1542,8 @@ Library *ANGLETestEnvironment::GetDriverLibrary(angle::GLESDriverType driver)
|
|||
return GetSystemEGLLibrary();
|
||||
case angle::GLESDriverType::SystemWGL:
|
||||
return GetSystemWGLLibrary();
|
||||
case angle::GLESDriverType::ZinkEGL:
|
||||
return GetMesaEGLLibrary();
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1557,6 +1561,19 @@ Library *ANGLETestEnvironment::GetAngleEGLLibrary()
|
|||
return gAngleEGLLibrary.get();
|
||||
}
|
||||
|
||||
// static
|
||||
Library *ANGLETestEnvironment::GetMesaEGLLibrary()
|
||||
{
|
||||
#if defined(ANGLE_USE_UTIL_LOADER)
|
||||
if (!gMesaEGLLibrary)
|
||||
{
|
||||
gMesaEGLLibrary.reset(
|
||||
OpenSharedLibrary(ANGLE_MESA_EGL_LIBRARY_NAME, SearchType::ModuleDir));
|
||||
}
|
||||
#endif // defined(ANGLE_USE_UTIL_LOADER)
|
||||
return gMesaEGLLibrary.get();
|
||||
}
|
||||
|
||||
// static
|
||||
Library *ANGLETestEnvironment::GetSystemEGLLibrary()
|
||||
{
|
||||
|
|
|
@ -669,11 +669,13 @@ class ANGLETestEnvironment : public testing::Environment
|
|||
|
||||
private:
|
||||
static angle::Library *GetAngleEGLLibrary();
|
||||
static angle::Library *GetMesaEGLLibrary();
|
||||
static angle::Library *GetSystemEGLLibrary();
|
||||
static angle::Library *GetSystemWGLLibrary();
|
||||
|
||||
// For loading entry points.
|
||||
static std::unique_ptr<angle::Library> gAngleEGLLibrary;
|
||||
static std::unique_ptr<angle::Library> gMesaEGLLibrary;
|
||||
static std::unique_ptr<angle::Library> gSystemEGLLibrary;
|
||||
static std::unique_ptr<angle::Library> gSystemWGLLibrary;
|
||||
};
|
||||
|
|
|
@ -221,6 +221,9 @@ std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp)
|
|||
case GLESDriverType::SystemEGL:
|
||||
stream << "EGL";
|
||||
break;
|
||||
case GLESDriverType::ZinkEGL:
|
||||
stream << "Zink";
|
||||
break;
|
||||
default:
|
||||
stream << "Error";
|
||||
break;
|
||||
|
@ -887,4 +890,30 @@ PlatformParameters ES3_EGL()
|
|||
{
|
||||
return PlatformParameters(EGL_OPENGL_ES_API, 3, 0, 0, GLESDriverType::SystemEGL);
|
||||
}
|
||||
|
||||
PlatformParameters ES1_Zink()
|
||||
{
|
||||
return PlatformParameters(EGL_OPENGL_ES_API, 1, 0, 0, GLESDriverType::ZinkEGL);
|
||||
}
|
||||
|
||||
PlatformParameters ES2_Zink()
|
||||
{
|
||||
return PlatformParameters(EGL_OPENGL_ES_API, 2, 0, 0, GLESDriverType::ZinkEGL);
|
||||
}
|
||||
|
||||
PlatformParameters ES3_Zink()
|
||||
{
|
||||
return PlatformParameters(EGL_OPENGL_ES_API, 3, 0, 0, GLESDriverType::ZinkEGL);
|
||||
}
|
||||
|
||||
PlatformParameters ES31_Zink()
|
||||
{
|
||||
return PlatformParameters(EGL_OPENGL_ES_API, 3, 1, 0, GLESDriverType::ZinkEGL);
|
||||
}
|
||||
|
||||
PlatformParameters ES32_Zink()
|
||||
{
|
||||
return PlatformParameters(EGL_OPENGL_ES_API, 3, 2, 0, GLESDriverType::ZinkEGL);
|
||||
}
|
||||
|
||||
} // namespace angle
|
||||
|
|
|
@ -219,6 +219,12 @@ PlatformParameters ES1_EGL();
|
|||
PlatformParameters ES2_EGL();
|
||||
PlatformParameters ES3_EGL();
|
||||
|
||||
PlatformParameters ES1_Zink();
|
||||
PlatformParameters ES2_Zink();
|
||||
PlatformParameters ES3_Zink();
|
||||
PlatformParameters ES31_Zink();
|
||||
PlatformParameters ES32_Zink();
|
||||
|
||||
const char *GetNativeEGLLibraryNameWithExtension();
|
||||
|
||||
inline PlatformParameters WithNoFixture(const PlatformParameters ¶ms)
|
||||
|
|
|
@ -100,6 +100,27 @@ bool IsSystemEGLConfigSupported(const PlatformParameters ¶m, OSWindow *osWin
|
|||
#endif
|
||||
}
|
||||
|
||||
bool IsZinkEGLConfigSupported(const PlatformParameters ¶m, OSWindow *osWindow)
|
||||
{
|
||||
std::unique_ptr<angle::Library> eglLibrary;
|
||||
|
||||
#if defined(ANGLE_USE_UTIL_LOADER)
|
||||
eglLibrary.reset(
|
||||
angle::OpenSharedLibrary(ANGLE_MESA_EGL_LIBRARY_NAME, angle::SearchType::ModuleDir));
|
||||
#endif
|
||||
|
||||
EGLWindow *eglWindow =
|
||||
EGLWindow::New(param.clientType, param.majorVersion, param.minorVersion, param.profileMask);
|
||||
ConfigParameters configParams;
|
||||
bool result =
|
||||
eglWindow->initializeGL(osWindow, eglLibrary.get(), angle::GLESDriverType::ZinkEGL,
|
||||
param.eglParameters, configParams);
|
||||
eglWindow->destroyGL();
|
||||
EGLWindow::Delete(&eglWindow);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsAndroidDevice(const std::string &deviceName)
|
||||
{
|
||||
if (!IsAndroid())
|
||||
|
@ -412,6 +433,15 @@ bool Is64Bit()
|
|||
#endif // defined(ANGLE_IS_64_BIT_CPU)
|
||||
}
|
||||
|
||||
bool HasMesa()
|
||||
{
|
||||
#if defined(ANGLE_HAS_MESA)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif // defined(ANGLE_HAS_MESA)
|
||||
}
|
||||
|
||||
bool IsConfigAllowlisted(const SystemInfo &systemInfo, const PlatformParameters ¶m)
|
||||
{
|
||||
VendorID vendorID =
|
||||
|
@ -567,6 +597,8 @@ bool IsConfigAllowlisted(const SystemInfo &systemInfo, const PlatformParameters
|
|||
return param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
|
||||
case GLESDriverType::SystemWGL:
|
||||
return false;
|
||||
case GLESDriverType::ZinkEGL:
|
||||
return HasMesa();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -649,6 +681,9 @@ bool IsConfigSupported(const PlatformParameters ¶m)
|
|||
case GLESDriverType::SystemWGL:
|
||||
result = IsSystemWGLConfigSupported(param, osWindow);
|
||||
break;
|
||||
case GLESDriverType::ZinkEGL:
|
||||
result = IsZinkEGLConfigSupported(param, osWindow);
|
||||
break;
|
||||
}
|
||||
|
||||
osWindow->destroy();
|
||||
|
@ -811,6 +846,11 @@ GLESDriverType GetDriverTypeFromString(const char *driverName, GLESDriverType de
|
|||
return GLESDriverType::AngleEGL;
|
||||
}
|
||||
|
||||
if (strcmp(driverName, "zink") == 0)
|
||||
{
|
||||
return GLESDriverType::ZinkEGL;
|
||||
}
|
||||
|
||||
if (strcmp(driverName, "native") == 0 || strcmp(driverName, "system") == 0)
|
||||
{
|
||||
if (IsWindows())
|
||||
|
|
|
@ -55,6 +55,7 @@ bool IsSwiftshaderDevice();
|
|||
bool IsIntelUHD630Mobile();
|
||||
|
||||
bool Is64Bit();
|
||||
bool HasMesa();
|
||||
|
||||
bool IsPlatformAvailable(const PlatformParameters ¶m);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ enum class GLESDriverType
|
|||
AngleEGL,
|
||||
SystemEGL,
|
||||
SystemWGL,
|
||||
ZinkEGL,
|
||||
};
|
||||
|
||||
GLESDriverType GetDriverTypeFromString(const char *driverName, GLESDriverType defaultDriverType);
|
||||
|
|
|
@ -152,6 +152,19 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow,
|
|||
angle::GLESDriverType driverType,
|
||||
const EGLPlatformParameters ¶ms)
|
||||
{
|
||||
if (driverType == angle::GLESDriverType::ZinkEGL)
|
||||
{
|
||||
std::stringstream driDirStream;
|
||||
char s = angle::GetPathSeparator();
|
||||
driDirStream << angle::GetModuleDirectory() << "mesa" << s << "src" << s << "gallium" << s
|
||||
<< "targets" << s << "dri";
|
||||
|
||||
std::string driDir = driDirStream.str();
|
||||
|
||||
angle::SetEnvironmentVar("MESA_LOADER_DRIVER_OVERRIDE", "zink");
|
||||
angle::SetEnvironmentVar("LIBGL_DRIVERS_PATH", driDir.c_str());
|
||||
}
|
||||
|
||||
#if defined(ANGLE_USE_UTIL_LOADER)
|
||||
PFNEGLGETPROCADDRESSPROC getProcAddress;
|
||||
glWindowingLibrary->getAs("eglGetProcAddress", &getProcAddress);
|
||||
|
|
Загрузка…
Ссылка в новой задаче