Commit 7085305f by Jamie Madill Committed by Commit Bot

Use whitelist to filter test configs.

Before we would try all the configs and filter those which fail to init. Now we gather the System Info and if successful check a list of supported configs. If System Info init fails we fall back to the prior method. This speeds up end2end tests init. It also allows for more reliable profile captures with VTune. It also will cause a test failure if a config unexpectedly fails. Previously we would silently pass without running the config's test. Includes a few changes: * D3D reference tests are disabled. They don't appear to be working. * Mac ES 3.1 is disabled due to lack of support. * WGL on AMD Windows is disabled due to lack of ES compatibility. * ES 3.2 contexts are explicitly disabled. * Vulkan is limited to ES 2.0. * The Windows GLES back-end is limited to NVIDIA with ES 2.0 & 3.0. * A unit test that verifies the whitelist matches availability. Bug: angleproject:2472 Change-Id: Ib72214bfbbff13c124fa15a6494d0aabb52f2e62 Reviewed-on: https://chromium-review.googlesource.com/c/1436168 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent 7dafe3eb
......@@ -173,6 +173,7 @@ if (is_win || is_linux || is_mac || is_android) {
deps = [
":angle_end2end_tests_main",
"${angle_root}:angle_gpu_info_util",
"${angle_root}:angle_image_util",
"${angle_root}:angle_util",
"${angle_root}:angle_util_loader_headers",
......@@ -270,6 +271,7 @@ if (is_win || is_linux || is_android || is_mac) {
":angle_perftests_main",
"${angle_jsoncpp_dir}:jsoncpp",
"${angle_root}:angle_common",
"${angle_root}:angle_gpu_info_util",
"${angle_root}:angle_system_utils",
"${angle_root}:angle_util",
"${angle_root}:angle_util_loader_headers",
......
......@@ -9,7 +9,11 @@
#include <gtest/gtest.h>
#include "gpu_info_util/SystemInfo.h"
#include "test_utils/ANGLETest.h"
#include "test_utils/angle_test_instantiate.h"
using namespace angle;
class EGLSanityCheckTest : public EGLTest
{};
......@@ -33,4 +37,48 @@ TEST_F(EGLSanityCheckTest, GetProcAddressNegativeTest)
{
auto check = eglGetProcAddress("WigglyWombats");
EXPECT_EQ(nullptr, check);
}
// Tests that our whitelist function generally maps to our support function.
// We can add specific exceptions here if needed.
TEST_F(EGLSanityCheckTest, WhitelistMatchesSupport)
{
// Cannot make any useful checks if SystemInfo is not supported.
SystemInfo systemInfo;
ANGLE_SKIP_TEST_IF(!GetSystemInfo(&systemInfo));
auto check = [&systemInfo](const PlatformParameters &params) {
EXPECT_EQ(IsConfigWhitelisted(systemInfo, params), IsConfigSupported(params)) << params;
};
check(ES1_OPENGL());
check(ES2_OPENGL());
check(ES3_OPENGL());
check(ES31_OPENGL());
check(ES1_OPENGLES());
check(ES2_OPENGLES());
check(ES3_OPENGLES());
check(ES31_OPENGLES());
check(ES1_D3D9());
check(ES2_D3D9());
check(ES1_D3D11());
check(ES2_D3D11());
check(ES3_D3D11());
check(ES31_D3D11());
check(ES1_VULKAN());
check(ES2_VULKAN());
check(ES3_VULKAN());
check(ES1_VULKAN_NULL());
check(ES2_VULKAN_NULL());
check(ES3_VULKAN_NULL());
check(ES1_NULL());
check(ES2_NULL());
check(ES3_NULL());
check(ES31_NULL());
}
\ No newline at end of file
......@@ -312,6 +312,5 @@ ANGLE_INSTANTIATE_TEST(PbufferTest,
ES2_D3D11(),
ES2_OPENGL(),
ES2_D3D11_WARP(),
ES2_D3D11_REFERENCE(),
ES2_OPENGLES(),
ES2_VULKAN());
......@@ -175,7 +175,6 @@ TEST_P(RendererTest, SimpleOperation)
ANGLE_INSTANTIATE_TEST(RendererTest,
// ES2 on top of D3D9
ES2_D3D9(),
ES2_D3D9_REFERENCE(),
// ES2 on top of D3D11 feature level 9.3 to 11.0
ES2_D3D11(),
......@@ -191,13 +190,6 @@ ANGLE_INSTANTIATE_TEST(RendererTest,
ES2_D3D11_FL10_0_WARP(),
ES2_D3D11_FL9_3_WARP(),
// ES2 on top of D3D11 reference feature level 9.3 to 11.0
ES2_D3D11_REFERENCE(),
ES2_D3D11_FL11_0_REFERENCE(),
ES2_D3D11_FL10_1_REFERENCE(),
ES2_D3D11_FL10_0_REFERENCE(),
ES2_D3D11_FL9_3_REFERENCE(),
// ES3 on top of D3D11.
ES3_D3D11(),
ES3_D3D11_FL11_0(),
......@@ -208,11 +200,6 @@ ANGLE_INSTANTIATE_TEST(RendererTest,
ES3_D3D11_FL11_0_WARP(),
ES3_D3D11_FL10_1_WARP(),
// ES3 on top of the D3D11 reference rasterizer.
ES3_D3D11_REFERENCE(),
ES3_D3D11_FL11_0_REFERENCE(),
ES3_D3D11_FL10_1_REFERENCE(),
// ES2 on top of desktop OpenGL versions 2.1 to 4.5
ES2_OPENGL(),
ES2_OPENGL(2, 1),
......
......@@ -1521,7 +1521,6 @@ TEST_P(UniformBufferTest, DependentBufferChange)
ANGLE_INSTANTIATE_TEST(UniformBufferTest,
ES3_D3D11(),
ES3_D3D11_FL11_1(),
ES3_D3D11_FL11_1_REFERENCE(),
ES3_OPENGL(),
ES3_OPENGLES());
ANGLE_INSTANTIATE_TEST(UniformBufferTest31, ES31_D3D11(), ES31_OPENGL(), ES31_OPENGLES());
......
......@@ -1219,15 +1219,6 @@ bool IsNULL()
return (rendererString.find("NULL") != std::string::npos);
}
bool IsAndroid()
{
#if defined(ANGLE_PLATFORM_ANDROID)
return true;
#else
return false;
#endif
}
bool IsVulkan()
{
const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
......@@ -1235,42 +1226,6 @@ bool IsVulkan()
return (rendererString.find("Vulkan") != std::string::npos);
}
bool IsOzone()
{
#if defined(USE_OZONE)
return true;
#else
return false;
#endif
}
bool IsLinux()
{
#if defined(ANGLE_PLATFORM_LINUX)
return true;
#else
return false;
#endif
}
bool IsOSX()
{
#if defined(ANGLE_PLATFORM_APPLE)
return true;
#else
return false;
#endif
}
bool IsWindows()
{
#if defined(ANGLE_PLATFORM_WINDOWS)
return true;
#else
return false;
#endif
}
bool IsDebug()
{
#if !defined(NDEBUG)
......
......@@ -476,14 +476,7 @@ bool IsD3DSM3();
bool IsDesktopOpenGL();
bool IsOpenGLES();
bool IsOpenGL();
bool IsOzone();
bool IsNULL();
// Operating systems
bool IsAndroid();
bool IsLinux();
bool IsOSX();
bool IsWindows();
bool IsVulkan();
// Debug/Release
......
......@@ -382,11 +382,6 @@ PlatformParameters ES2_D3D9()
return PlatformParameters(2, 0, egl_platform::D3D9());
}
PlatformParameters ES2_D3D9_REFERENCE()
{
return PlatformParameters(2, 0, egl_platform::D3D9_REFERENCE());
}
PlatformParameters ES1_D3D11()
{
return PlatformParameters(1, 0, egl_platform::D3D11());
......@@ -527,26 +522,6 @@ PlatformParameters ES3_D3D11_FL10_1_WARP()
return PlatformParameters(3, 0, egl_platform::D3D11_FL10_1_WARP());
}
PlatformParameters ES3_D3D11_REFERENCE()
{
return PlatformParameters(3, 0, egl_platform::D3D11_REFERENCE());
}
PlatformParameters ES3_D3D11_FL11_1_REFERENCE()
{
return PlatformParameters(3, 0, egl_platform::D3D11_FL11_1_REFERENCE());
}
PlatformParameters ES3_D3D11_FL11_0_REFERENCE()
{
return PlatformParameters(3, 0, egl_platform::D3D11_FL11_0_REFERENCE());
}
PlatformParameters ES3_D3D11_FL10_1_REFERENCE()
{
return PlatformParameters(3, 0, egl_platform::D3D11_FL10_1_REFERENCE());
}
PlatformParameters ES1_OPENGLES()
{
return PlatformParameters(1, 0, egl_platform::OPENGLES());
......
......@@ -108,7 +108,6 @@ EGLPlatformParameters VULKAN_NULL();
// ANGLE tests platforms
PlatformParameters ES1_D3D9();
PlatformParameters ES2_D3D9();
PlatformParameters ES2_D3D9_REFERENCE();
PlatformParameters ES1_D3D11();
PlatformParameters ES2_D3D11();
......@@ -143,11 +142,6 @@ PlatformParameters ES3_D3D11_FL11_1_WARP();
PlatformParameters ES3_D3D11_FL11_0_WARP();
PlatformParameters ES3_D3D11_FL10_1_WARP();
PlatformParameters ES3_D3D11_REFERENCE();
PlatformParameters ES3_D3D11_FL11_1_REFERENCE();
PlatformParameters ES3_D3D11_FL11_0_REFERENCE();
PlatformParameters ES3_D3D11_FL10_1_REFERENCE();
PlatformParameters ES1_OPENGL();
PlatformParameters ES2_OPENGL();
PlatformParameters ES2_OPENGL(EGLint major, EGLint minor);
......
......@@ -14,6 +14,7 @@
#include "angle_gl.h"
#include "common/platform.h"
#include "gpu_info_util/SystemInfo.h"
#include "test_utils/angle_test_configs.h"
#include "util/EGLWindow.h"
#include "util/OSWindow.h"
......@@ -27,6 +28,17 @@ namespace angle
{
namespace
{
SystemInfo *GetTestSystemInfo()
{
static SystemInfo *sSystemInfo = nullptr;
if (sSystemInfo == nullptr)
{
sSystemInfo = new SystemInfo;
GetSystemInfo(sSystemInfo);
}
return sSystemInfo;
}
bool IsANGLEConfigSupported(const PlatformParameters &param, OSWindow *osWindow)
{
std::unique_ptr<angle::Library> eglLibrary;
......@@ -65,6 +77,201 @@ bool IsNativeConfigSupported(const PlatformParameters &param, OSWindow *osWindow
}
} // namespace
bool IsAndroid()
{
#if defined(ANGLE_PLATFORM_ANDROID)
return true;
#else
return false;
#endif
}
bool IsLinux()
{
#if defined(ANGLE_PLATFORM_LINUX)
return true;
#else
return false;
#endif
}
bool IsOSX()
{
#if defined(ANGLE_PLATFORM_APPLE)
return true;
#else
return false;
#endif
}
bool IsOzone()
{
#if defined(USE_OZONE)
return true;
#else
return false;
#endif
}
bool IsWindows()
{
#if defined(ANGLE_PLATFORM_WINDOWS)
return true;
#else
return false;
#endif
}
bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters &param)
{
VendorID vendorID = systemInfo.gpus[systemInfo.primaryGPUIndex].vendorId;
// We support the default and null back-ends on every platform.
if (param.driver == GLESDriverType::AngleEGL)
{
if (param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE)
return true;
if (param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE)
return true;
}
// Vulkan ES 3.0 is not yet supported.
if (param.majorVersion > 2 && param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE)
{
return false;
}
if (IsWindows())
{
switch (param.driver)
{
case GLESDriverType::AngleEGL:
switch (param.getRenderer())
{
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE:
return true;
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
// ES 3.1+ back-end is not supported properly.
if (param.eglParameters.majorVersion == 3 &&
param.eglParameters.minorVersion > 0)
{
return false;
}
// Win ES emulation is currently only supported on NVIDIA.
return vendorID == kVendorID_Nvidia;
default:
return false;
}
case GLESDriverType::SystemWGL:
// AMD does not support the ES compatibility extensions.
return vendorID != kVendorID_AMD;
default:
return false;
}
}
else if (IsOSX())
{
// Currently we only support the OpenGL back-end on OSX.
if (param.driver != GLESDriverType::AngleEGL)
{
return false;
}
// OSX does not support ES 3.1 features.
if (param.majorVersion == 3 && param.minorVersion > 0)
{
return false;
}
return (param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE);
}
else if (IsLinux())
{
// Currently we support the OpenGL and Vulkan back-ends on Linux.
if (param.driver != GLESDriverType::AngleEGL)
{
return false;
}
switch (param.getRenderer())
{
case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE:
// Note that system info collection depends on Vulkan support.
return true;
default:
return false;
}
}
else if (IsOzone())
{
// Currently we only support the GLES back-end on Ozone.
if (param.driver != GLESDriverType::AngleEGL)
return false;
return (param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE);
}
else if (IsAndroid())
{
// Currently we support the GLES and Vulkan back-ends on Linux.
if (param.driver != GLESDriverType::AngleEGL)
{
return false;
}
// Some Android devices don't support backing 3.2 contexts. We should refine this to only
// exclude the problematic devices.
if (param.eglParameters.majorVersion == 3 && param.eglParameters.minorVersion == 2)
{
return false;
}
switch (param.getRenderer())
{
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE:
return true;
default:
return false;
}
}
else
{
// Unknown platform.
return false;
}
}
bool IsConfigSupported(const PlatformParameters &param)
{
OSWindow *osWindow = OSWindow::New();
bool result = false;
if (osWindow->initialize("CONFIG_TESTER", 1, 1))
{
switch (param.driver)
{
case GLESDriverType::AngleEGL:
result = IsANGLEConfigSupported(param, osWindow);
break;
case GLESDriverType::SystemEGL:
result = IsNativeConfigSupported(param, osWindow);
break;
case GLESDriverType::SystemWGL:
result = IsWGLConfigSupported(param, osWindow);
break;
}
osWindow->destroy();
}
OSWindow::Delete(&osWindow);
return result;
}
bool IsPlatformAvailable(const PlatformParameters &param)
{
switch (param.getRenderer())
......@@ -120,26 +327,17 @@ bool IsPlatformAvailable(const PlatformParameters &param)
}
else
{
OSWindow *osWindow = OSWindow::New();
bool result = osWindow->initialize("CONFIG_TESTER", 1, 1);
if (result)
const SystemInfo *systemInfo = GetTestSystemInfo();
bool result = false;
if (systemInfo)
{
switch (param.driver)
{
case GLESDriverType::AngleEGL:
result = IsANGLEConfigSupported(param, osWindow);
break;
case GLESDriverType::SystemEGL:
result = IsNativeConfigSupported(param, osWindow);
break;
case GLESDriverType::SystemWGL:
result = IsWGLConfigSupported(param, osWindow);
break;
}
result = IsConfigWhitelisted(*systemInfo, param);
}
else
{
result = IsConfigSupported(param);
}
osWindow->destroy();
OSWindow::Delete(&osWindow);
paramAvailabilityCache[param] = result;
......@@ -152,5 +350,4 @@ bool IsPlatformAvailable(const PlatformParameters &param)
return result;
}
}
} // namespace angle
......@@ -14,9 +14,16 @@
namespace angle
{
struct SystemInfo;
struct PlatformParameters;
// Operating systems
bool IsAndroid();
bool IsLinux();
bool IsOSX();
bool IsOzone();
bool IsWindows();
bool IsPlatformAvailable(const PlatformParameters &param);
// This functions is used to filter which tests should be registered,
......@@ -52,6 +59,12 @@ std::vector<T> FilterTestParams(const std::vector<T> &params)
testName##params, ArraySize(testName##params))), \
testing::PrintToStringParamName())
// Checks if a config is expected to be supported by checking a system-based white list.
bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters &param);
// Determines if a config is supported by trying to initialize it. Does not require SystemInfo.
bool IsConfigSupported(const PlatformParameters &param);
} // namespace angle
#endif // ANGLE_TEST_INSTANTIATE_H_
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