Commit 467f174f by Jamie Madill Committed by Commit Bot

Remove EGLTest.

Consolidate these tests into ANGLETest. Add a new parameter to PlatformParameters that lets us skip normal test setup. This removes the last 'configless' tests from angle_end2end_tests. Bug: angleproject:3393 Change-Id: I87186698ade90f95577534eb8ed1dfd4245f740e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1590467 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 97f0affb
......@@ -8,6 +8,11 @@
// This test will try to use all combinations of context configs and
// surface configs. If the configs are compatible, it checks that simple
// rendering works, otherwise it checks an error is generated one MakeCurrent.
//
// Only run the EGLContextCompatibilityTest on release builds. The execution time of this test
// scales with the square of the number of configs exposed and can time out in some debug builds.
// http://anglebug.com/2121
#include <gtest/gtest.h>
#include <vector>
......@@ -25,15 +30,14 @@ namespace
const EGLint contextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
}
class EGLContextCompatibilityTest : public EGLTest,
public testing::WithParamInterface<PlatformParameters>
class EGLContextCompatibilityTest : public ANGLETest
{
public:
EGLContextCompatibilityTest() : mDisplay(0) {}
void SetUp() override
{
EGLTest::SetUp();
ANGLETest::SetUp();
ASSERT_TRUE(eglGetPlatformDisplayEXT != nullptr);
......@@ -59,6 +63,8 @@ class EGLContextCompatibilityTest : public EGLTest,
{
eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglTerminate(mDisplay);
ANGLETest::TearDown();
}
protected:
......@@ -248,6 +254,8 @@ class EGLContextCompatibilityTest : public EGLTest,
// same config can render.
TEST_P(EGLContextCompatibilityTest, WindowSameConfig)
{
ANGLE_SKIP_TEST_IF(IsDebug()); // http://anglebug.com/2121
for (size_t i = 0; i < mConfigs.size(); i++)
{
EGLConfig config = mConfigs[i];
......@@ -275,6 +283,8 @@ TEST_P(EGLContextCompatibilityTest, WindowSameConfig)
// same config can render.
TEST_P(EGLContextCompatibilityTest, PbufferSameConfig)
{
ANGLE_SKIP_TEST_IF(IsDebug()); // http://anglebug.com/2121
for (size_t i = 0; i < mConfigs.size(); i++)
{
EGLConfig config = mConfigs[i];
......@@ -301,6 +311,8 @@ TEST_P(EGLContextCompatibilityTest, PbufferSameConfig)
// config works or errors according to the EGL compatibility rules
TEST_P(EGLContextCompatibilityTest, WindowDifferentConfig)
{
ANGLE_SKIP_TEST_IF(IsDebug()); // http://anglebug.com/2121
// anglebug.com/2183
// Actually failed only on (IsIntel() && IsWindows() && IsD3D11()),
// but it's impossible to do other tests since GL_RENDERER is NULL
......@@ -348,6 +360,8 @@ TEST_P(EGLContextCompatibilityTest, WindowDifferentConfig)
// config works or errors according to the EGL compatibility rules
TEST_P(EGLContextCompatibilityTest, PbufferDifferentConfig)
{
ANGLE_SKIP_TEST_IF(IsDebug()); // http://anglebug.com/2121
for (size_t i = 0; i < mConfigs.size(); i++)
{
EGLConfig config1 = mConfigs[i];
......@@ -384,14 +398,9 @@ TEST_P(EGLContextCompatibilityTest, PbufferDifferentConfig)
}
}
// Only run the EGLContextCompatibilityTest on release builds. The execution time of this test
// scales with the square of the number of configs exposed and can time out in some debug builds.
// http://anglebug.com/2121
#if defined(NDEBUG)
ANGLE_INSTANTIATE_TEST(EGLContextCompatibilityTest,
ES2_D3D9(),
ES2_D3D11(),
ES2_OPENGL(),
ES2_OPENGLES(),
ES2_VULKAN());
#endif // defined(NDEBUG)
WithNoFixture(ES2_D3D9()),
WithNoFixture(ES2_D3D11()),
WithNoFixture(ES2_OPENGL()),
WithNoFixture(ES2_OPENGLES()),
WithNoFixture(ES2_VULKAN()));
......@@ -22,12 +22,11 @@
using namespace angle;
class EGLDeviceCreationTest : public EGLTest
class EGLDeviceCreationTest : public ANGLETest
{
protected:
EGLDeviceCreationTest()
: mD3D11Available(false),
mD3D11Module(nullptr),
: mD3D11Module(nullptr),
mD3D11CreateDevice(nullptr),
mDevice(nullptr),
mDeviceContext(nullptr),
......@@ -41,7 +40,9 @@ class EGLDeviceCreationTest : public EGLTest
void SetUp() override
{
EGLTest::SetUp();
ANGLETest::SetUp();
ASSERT_TRUE(isD3D11Renderer());
mD3D11Module = LoadLibrary(TEXT("d3d11.dll"));
if (mD3D11Module == nullptr)
......@@ -58,8 +59,6 @@ class EGLDeviceCreationTest : public EGLTest
return;
}
mD3D11Available = true;
const char *extensionString =
static_cast<const char *>(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
if (strstr(extensionString, "EGL_ANGLE_device_creation"))
......@@ -95,11 +94,12 @@ class EGLDeviceCreationTest : public EGLTest
eglTerminate(mDisplay);
mDisplay = EGL_NO_DISPLAY;
}
ANGLETest::TearDown();
}
void CreateD3D11Device()
{
ASSERT_TRUE(mD3D11Available);
ASSERT_EQ(nullptr, mDevice); // The device shouldn't be created twice
HRESULT hr =
......@@ -112,7 +112,6 @@ class EGLDeviceCreationTest : public EGLTest
void CreateD3D11FL9_3Device()
{
ASSERT_TRUE(mD3D11Available);
ASSERT_EQ(nullptr, mDevice);
D3D_FEATURE_LEVEL fl93 = D3D_FEATURE_LEVEL_9_3;
......@@ -176,7 +175,6 @@ class EGLDeviceCreationTest : public EGLTest
ASSERT_TRUE(FAILED(result));
}
bool mD3D11Available;
HMODULE mD3D11Module;
PFN_D3D11_CREATE_DEVICE mD3D11CreateDevice;
......@@ -196,13 +194,9 @@ class EGLDeviceCreationTest : public EGLTest
// Test that creating a EGLDeviceEXT from D3D11 device works, and it can be queried to retrieve
// D3D11 device
TEST_F(EGLDeviceCreationTest, BasicD3D11Device)
TEST_P(EGLDeviceCreationTest, BasicD3D11Device)
{
if (!mDeviceCreationD3D11ExtAvailable || !mD3D11Available)
{
std::cout << "EGLDevice creation and/or D3D11 not available, skipping test" << std::endl;
return;
}
ANGLE_SKIP_TEST_IF(!mDeviceCreationD3D11ExtAvailable);
CreateD3D11Device();
......@@ -223,13 +217,9 @@ TEST_F(EGLDeviceCreationTest, BasicD3D11Device)
// Test that creating a EGLDeviceEXT from D3D11 device works, and it can be queried to retrieve
// D3D11 device
TEST_F(EGLDeviceCreationTest, BasicD3D11DeviceViaFuncPointer)
TEST_P(EGLDeviceCreationTest, BasicD3D11DeviceViaFuncPointer)
{
if (!mDeviceCreationD3D11ExtAvailable || !mD3D11Available)
{
std::cout << "EGLDevice creation and/or D3D11 not available, skipping test" << std::endl;
return;
}
ANGLE_SKIP_TEST_IF(!mDeviceCreationD3D11ExtAvailable);
CreateD3D11Device();
......@@ -249,14 +239,8 @@ TEST_F(EGLDeviceCreationTest, BasicD3D11DeviceViaFuncPointer)
}
// Test that creating a EGLDeviceEXT from D3D11 device works, and can be used for rendering
TEST_F(EGLDeviceCreationTest, RenderingUsingD3D11Device)
TEST_P(EGLDeviceCreationTest, RenderingUsingD3D11Device)
{
if (!mD3D11Available)
{
std::cout << "D3D11 not available, skipping test" << std::endl;
return;
}
CreateD3D11Device();
EGLDeviceEXT eglDevice =
......@@ -283,14 +267,8 @@ TEST_F(EGLDeviceCreationTest, RenderingUsingD3D11Device)
}
// Test that ANGLE doesn't try to recreate a D3D11 device if the inputted one is lost
TEST_F(EGLDeviceCreationTest, D3D11DeviceRecovery)
TEST_P(EGLDeviceCreationTest, D3D11DeviceRecovery)
{
if (!mD3D11Available)
{
std::cout << "D3D11 not available, skipping test" << std::endl;
return;
}
// Force Feature Level 9_3 so we can easily trigger a device lost later
CreateD3D11FL9_3Device();
......@@ -351,14 +329,8 @@ TEST_F(EGLDeviceCreationTest, D3D11DeviceRecovery)
}
// Test that calling eglGetPlatformDisplayEXT with the same device returns the same display
TEST_F(EGLDeviceCreationTest, getPlatformDisplayTwice)
TEST_P(EGLDeviceCreationTest, GetPlatformDisplayTwice)
{
if (!mD3D11Available)
{
std::cout << "D3D11 not available, skipping test" << std::endl;
return;
}
CreateD3D11Device();
EGLDeviceEXT eglDevice =
......@@ -379,13 +351,9 @@ TEST_F(EGLDeviceCreationTest, getPlatformDisplayTwice)
}
// Test that creating a EGLDeviceEXT from an invalid D3D11 device fails
TEST_F(EGLDeviceCreationTest, InvalidD3D11Device)
TEST_P(EGLDeviceCreationTest, InvalidD3D11Device)
{
if (!mDeviceCreationD3D11ExtAvailable || !mD3D11Available)
{
std::cout << "EGLDevice creation and/or D3D11 not available, skipping test" << std::endl;
return;
}
ANGLE_SKIP_TEST_IF(!mDeviceCreationD3D11ExtAvailable);
CreateD3D11Device();
......@@ -397,13 +365,9 @@ TEST_F(EGLDeviceCreationTest, InvalidD3D11Device)
}
// Test that EGLDeviceEXT holds a ref to the D3D11 device
TEST_F(EGLDeviceCreationTest, D3D11DeviceReferenceCounting)
TEST_P(EGLDeviceCreationTest, D3D11DeviceReferenceCounting)
{
if (!mDeviceCreationD3D11ExtAvailable || !mD3D11Available)
{
std::cout << "EGLDevice creation and/or D3D11 not available, skipping test" << std::endl;
return;
}
ANGLE_SKIP_TEST_IF(!mDeviceCreationD3D11ExtAvailable);
CreateD3D11Device();
......@@ -427,13 +391,9 @@ TEST_F(EGLDeviceCreationTest, D3D11DeviceReferenceCounting)
}
// Test that creating a EGLDeviceEXT from a D3D9 device fails
TEST_F(EGLDeviceCreationTest, AnyD3D9Device)
TEST_P(EGLDeviceCreationTest, AnyD3D9Device)
{
if (!mDeviceCreationD3D11ExtAvailable)
{
std::cout << "EGLDevice creation not available, skipping test" << std::endl;
return;
}
ANGLE_SKIP_TEST_IF(!mDeviceCreationD3D11ExtAvailable);
std::string fakeD3DDevice = "This is a string, not a D3D device";
......@@ -562,4 +522,5 @@ TEST_P(EGLDeviceQueryTest, GetPlatformDisplayDeviceReuse)
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
// tests should be run against.
ANGLE_INSTANTIATE_TEST(EGLDeviceCreationTest, WithNoFixture(ES2_D3D11()));
ANGLE_INSTANTIATE_TEST(EGLDeviceQueryTest, ES2_D3D9(), ES2_D3D11());
......@@ -14,7 +14,7 @@
using namespace angle;
class EGLPresentPathD3D11 : public EGLTest, public testing::WithParamInterface<PlatformParameters>
class EGLPresentPathD3D11 : public ANGLETest
{
protected:
EGLPresentPathD3D11()
......@@ -29,7 +29,7 @@ class EGLPresentPathD3D11 : public EGLTest, public testing::WithParamInterface<P
void SetUp() override
{
EGLTest::SetUp();
ANGLETest::SetUp();
mOSWindow = OSWindow::New();
mWindowWidth = 64;
......@@ -170,6 +170,8 @@ class EGLPresentPathD3D11 : public EGLTest, public testing::WithParamInterface<P
mOSWindow->destroy();
OSWindow::Delete(&mOSWindow);
ANGLETest::TearDown();
}
void drawQuadUsingGL()
......@@ -369,4 +371,4 @@ TEST_P(EGLPresentPathD3D11, ClientBufferPresentPathCopy)
checkPixelsUsingD3D(false);
}
ANGLE_INSTANTIATE_TEST(EGLPresentPathD3D11, ES2_D3D11());
\ No newline at end of file
ANGLE_INSTANTIATE_TEST(EGLPresentPathD3D11, WithNoFixture(ES2_D3D11()));
......@@ -10,12 +10,12 @@
using namespace angle;
class EGLQueryContextTest : public EGLTest, public testing::WithParamInterface<PlatformParameters>
class EGLQueryContextTest : public ANGLETest
{
public:
void SetUp() override
{
EGLTest::SetUp();
ANGLETest::SetUp();
int clientVersion = GetParam().majorVersion;
......@@ -59,6 +59,8 @@ class EGLQueryContextTest : public EGLTest, public testing::WithParamInterface<P
eglTerminate(mDisplay);
}
ASSERT_EGL_SUCCESS() << "Error during test TearDown";
ANGLETest::TearDown();
}
EGLDisplay mDisplay;
......@@ -145,9 +147,9 @@ TEST_P(EGLQueryContextTest, BadAttribute)
}
ANGLE_INSTANTIATE_TEST(EGLQueryContextTest,
ES2_D3D9(),
ES2_D3D11(),
ES2_OPENGL(),
ES2_VULKAN(),
ES3_D3D11(),
ES3_OPENGL());
WithNoFixture(ES2_D3D9()),
WithNoFixture(ES2_D3D11()),
WithNoFixture(ES2_OPENGL()),
WithNoFixture(ES2_VULKAN()),
WithNoFixture(ES3_D3D11()),
WithNoFixture(ES3_OPENGL()));
......@@ -5,6 +5,9 @@
//
// EGLRobustnessTest.cpp: tests for EGL_EXT_create_context_robustness
//
// Tests causing GPU resets are disabled, use the following args to run them:
// --gtest_also_run_disabled_tests --gtest_filter=EGLRobustnessTest\*
#include <gtest/gtest.h>
......@@ -13,13 +16,12 @@
using namespace angle;
class EGLRobustnessTest : public EGLTest,
public ::testing::WithParamInterface<angle::PlatformParameters>
class EGLRobustnessTest : public ANGLETest
{
public:
void SetUp() override
{
EGLTest::SetUp();
ANGLETest::SetUp();
mOSWindow = OSWindow::New();
mOSWindow->initialize("EGLRobustnessTest", 500, 500);
......@@ -81,6 +83,8 @@ class EGLRobustnessTest : public EGLTest,
EXPECT_EGL_SUCCESS();
OSWindow::Delete(&mOSWindow);
ANGLETest::TearDown();
}
void createContext(EGLint resetStrategy)
......@@ -154,21 +158,14 @@ class EGLRobustnessTest : public EGLTest,
// Check glGetGraphicsResetStatusEXT returns GL_NO_ERROR if we did nothing
TEST_P(EGLRobustnessTest, NoErrorByDefault)
{
if (!mInitialized)
{
return;
}
ANGLE_SKIP_TEST_IF(!mInitialized);
ASSERT_TRUE(glGetGraphicsResetStatusEXT() == GL_NO_ERROR);
}
// Checks that the application gets no loss with NO_RESET_NOTIFICATION
TEST_P(EGLRobustnessTest, DISABLED_NoResetNotification)
{
if (!mInitialized)
{
return;
}
ANGLE_SKIP_TEST_IF(!mInitialized);
createContext(EGL_NO_RESET_NOTIFICATION_EXT);
if (!IsWindows())
......@@ -190,10 +187,10 @@ TEST_P(EGLRobustnessTest, DISABLED_NoResetNotification)
// the computer is rebooted.
TEST_P(EGLRobustnessTest, DISABLED_ResettingDisplayWorks)
{
if (!mInitialized)
{
return;
}
// Note that on Windows the OpenGL driver fails hard (popup that closes the application)
// on a TDR caused by D3D. Don't run D3D tests at the same time as the OpenGL tests.
ANGLE_SKIP_TEST_IF(IsWindows() && isGLRenderer());
ANGLE_SKIP_TEST_IF(!mInitialized);
createContext(EGL_LOSE_CONTEXT_ON_RESET_EXT);
......@@ -213,14 +210,8 @@ TEST_P(EGLRobustnessTest, DISABLED_ResettingDisplayWorks)
ASSERT_TRUE(glGetGraphicsResetStatusEXT() == GL_NO_ERROR);
}
// Tests causing GPU resets are disabled, use the following args to run them:
// --gtest_also_run_disabled_tests --gtest_filter=EGLRobustnessTest\*
// Note that on Windows the OpenGL driver fails hard (popup that closes the application)
// if there was a TDR caused by D3D so we don't run D3D tests at the same time as the OpenGL tests.
#define D3D_HAS_PRIORITY 1
#if D3D_HAS_PRIORITY && (defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11))
ANGLE_INSTANTIATE_TEST(EGLRobustnessTest, ES2_VULKAN(), ES2_D3D9(), ES2_D3D11());
#else
ANGLE_INSTANTIATE_TEST(EGLRobustnessTest, ES2_VULKAN(), ES2_OPENGL());
#endif
ANGLE_INSTANTIATE_TEST(EGLRobustnessTest,
WithNoFixture(ES2_VULKAN()),
WithNoFixture(ES2_D3D9()),
WithNoFixture(ES2_D3D11()),
WithNoFixture(ES2_OPENGL()));
......@@ -15,11 +15,11 @@
using namespace angle;
class EGLSanityCheckTest : public EGLTest
class EGLSanityCheckTest : public ANGLETest
{};
// Checks the tests are running against ANGLE
TEST_F(EGLSanityCheckTest, IsRunningOnANGLE)
TEST_P(EGLSanityCheckTest, IsRunningOnANGLE)
{
const char *extensionString =
static_cast<const char *>(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
......@@ -27,13 +27,13 @@ TEST_F(EGLSanityCheckTest, IsRunningOnANGLE)
}
// Checks that getting function pointer works
TEST_F(EGLSanityCheckTest, HasGetPlatformDisplayEXT)
TEST_P(EGLSanityCheckTest, HasGetPlatformDisplayEXT)
{
ASSERT_NE(eglGetPlatformDisplayEXT, nullptr);
}
// Checks that calling GetProcAddress for a non-existant function fails.
TEST_F(EGLSanityCheckTest, GetProcAddressNegativeTest)
TEST_P(EGLSanityCheckTest, GetProcAddressNegativeTest)
{
auto check = eglGetProcAddress("WigglyWombats");
EXPECT_EQ(nullptr, check);
......@@ -43,7 +43,7 @@ TEST_F(EGLSanityCheckTest, GetProcAddressNegativeTest)
// We can add specific exceptions here if needed.
// Disabled because it was creating a large number of configs. This could even result
// in a BDOD on Windows.
TEST_F(EGLSanityCheckTest, DISABLED_WhitelistMatchesSupport)
TEST_P(EGLSanityCheckTest, DISABLED_WhitelistMatchesSupport)
{
// Has issues with Vulkan support detection on Android.
ANGLE_SKIP_TEST_IF(IsAndroid());
......@@ -86,4 +86,6 @@ TEST_F(EGLSanityCheckTest, DISABLED_WhitelistMatchesSupport)
check(ES2_NULL());
check(ES3_NULL());
check(ES31_NULL());
}
\ No newline at end of file
}
ANGLE_INSTANTIATE_TEST(EGLSanityCheckTest, WithNoFixture(PlatformParameters()));
\ No newline at end of file
......@@ -30,8 +30,7 @@ using namespace angle;
namespace
{
class EGLSurfaceTest : public EGLTest,
public ::testing::WithParamInterface<angle::PlatformParameters>
class EGLSurfaceTest : public ANGLETest
{
protected:
EGLSurfaceTest()
......@@ -45,7 +44,7 @@ class EGLSurfaceTest : public EGLTest,
void SetUp() override
{
EGLTest::SetUp();
ANGLETest::SetUp();
mOSWindow = OSWindow::New();
mOSWindow->initialize("EGLSurfaceTest", 64, 64);
......@@ -90,6 +89,8 @@ class EGLSurfaceTest : public EGLTest,
OSWindow::Delete(&mOSWindow);
ASSERT_TRUE(mWindowSurface == EGL_NO_SURFACE && mContext == EGL_NO_CONTEXT);
ANGLETest::TearDown();
}
void initializeDisplay()
......@@ -738,15 +739,15 @@ TEST_P(EGLSurfaceTestD3D11, CreateSurfaceWithMSAA)
} // anonymous namespace
ANGLE_INSTANTIATE_TEST(EGLSurfaceTest,
ES2_D3D9(),
ES2_D3D11(),
ES3_D3D11(),
ES2_OPENGL(),
ES3_OPENGL(),
ES2_OPENGLES(),
ES3_OPENGLES(),
ES2_VULKAN());
WithNoFixture(ES2_D3D9()),
WithNoFixture(ES2_D3D11()),
WithNoFixture(ES3_D3D11()),
WithNoFixture(ES2_OPENGL()),
WithNoFixture(ES3_OPENGL()),
WithNoFixture(ES2_OPENGLES()),
WithNoFixture(ES3_OPENGLES()),
WithNoFixture(ES2_VULKAN()));
#if defined(ANGLE_ENABLE_D3D11)
ANGLE_INSTANTIATE_TEST(EGLSurfaceTestD3D11, ES2_D3D11(), ES3_D3D11());
ANGLE_INSTANTIATE_TEST(EGLSurfaceTestD3D11, WithNoFixture(ES2_D3D11()), WithNoFixture(ES3_D3D11()));
#endif
......@@ -18,15 +18,14 @@ using namespace angle;
namespace
{
class EGLSurfacelessContextTest : public EGLTest,
public testing::WithParamInterface<PlatformParameters>
class EGLSurfacelessContextTest : public ANGLETest
{
public:
EGLSurfacelessContextTest() : mDisplay(0) {}
void SetUp() override
{
EGLTest::SetUp();
ANGLETest::SetUp();
EGLint dispattrs[] = {EGL_PLATFORM_ANGLE_TYPE_ANGLE, GetParam().getRenderer(), EGL_NONE};
mDisplay = eglGetPlatformDisplayEXT(
......@@ -72,6 +71,8 @@ class EGLSurfacelessContextTest : public EGLTest,
}
eglTerminate(mDisplay);
ANGLETest::TearDown();
}
protected:
......@@ -261,7 +262,7 @@ TEST_P(EGLSurfacelessContextTest, Switcheroo)
} // anonymous namespace
ANGLE_INSTANTIATE_TEST(EGLSurfacelessContextTest,
ES2_D3D9(),
ES2_D3D11(),
ES2_OPENGL(),
ES2_VULKAN());
WithNoFixture(ES2_D3D9()),
WithNoFixture(ES2_D3D11()),
WithNoFixture(ES2_OPENGL()),
WithNoFixture(ES2_VULKAN()));
......@@ -24,13 +24,12 @@ namespace
const EGLint contextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
}
class EGLX11VisualHintTest : public EGLTest,
public ::testing::WithParamInterface<angle::PlatformParameters>
class EGLX11VisualHintTest : public ANGLETest
{
public:
void SetUp() override
{
EGLTest::SetUp();
ANGLETest::SetUp();
mDisplay = XOpenDisplay(nullptr);
}
......@@ -208,4 +207,4 @@ TEST_P(EGLX11VisualHintTest, InvalidWindowVisualID)
OSWindow::Delete(&osWindow);
}
ANGLE_INSTANTIATE_TEST(EGLX11VisualHintTest, ES2_OPENGL());
ANGLE_INSTANTIATE_TEST(EGLX11VisualHintTest, WithNoFixture(ES2_OPENGL()));
......@@ -332,22 +332,34 @@ ANGLETestBase::ANGLETestBase(const angle::PlatformParameters &params)
angle::PlatformParameters withMethods = params;
withMethods.eglParameters.platformMethods = &gDefaultPlatformMethods;
auto iter = gPlatforms.find(withMethods);
if (iter != gPlatforms.end())
auto iter = gFixtures.find(withMethods);
if (iter != gFixtures.end())
{
mCurrentParams = &iter->first;
mFixture = &iter->second;
mFixture->configParams.reset();
if (!params.noFixture)
{
mFixture = &iter->second;
mFixture->configParams.reset();
}
return;
}
TestFixture platform;
auto insertIter = gPlatforms.emplace(withMethods, platform);
auto insertIter = gFixtures.emplace(withMethods, platform);
mCurrentParams = &insertIter.first->first;
mFixture = &insertIter.first->second;
if (!params.noFixture)
{
mFixture = &insertIter.first->second;
initOSWindow();
}
}
void ANGLETestBase::initOSWindow()
{
std::stringstream windowNameStream;
windowNameStream << "ANGLE Tests - " << params;
windowNameStream << "ANGLE Tests - " << *mCurrentParams;
std::string windowName = windowNameStream.str();
if (mAlwaysForceNewDisplay)
......@@ -369,11 +381,12 @@ ANGLETestBase::ANGLETestBase(const angle::PlatformParameters &params)
// On Linux we must keep the test windows visible. On Windows it doesn't seem to need it.
mFixture->osWindow->setVisible(!angle::IsWindows());
switch (params.driver)
switch (mCurrentParams->driver)
{
case angle::GLESDriverType::AngleEGL:
{
mFixture->eglWindow = EGLWindow::New(params.majorVersion, params.minorVersion);
mFixture->eglWindow =
EGLWindow::New(mCurrentParams->majorVersion, mCurrentParams->minorVersion);
break;
}
......@@ -425,6 +438,25 @@ void ANGLETestBase::ANGLETestSetUp()
gPlatformContext.warningsAsErrors = false;
gPlatformContext.currentTest = this;
if (angle::IsWindows())
{
const auto &info = testing::UnitTest::GetInstance()->current_test_info();
angle::WriteDebugMessage("Entering %s.%s\n", info->test_case_name(), info->name());
}
if (mCurrentParams->noFixture)
{
#if defined(ANGLE_USE_UTIL_LOADER)
PFNEGLGETPROCADDRESSPROC getProcAddress;
ANGLETestEnvironment::GetEGLLibrary()->getAs("eglGetProcAddress", &getProcAddress);
ASSERT_NE(nullptr, getProcAddress);
angle::LoadEGL(getProcAddress);
angle::LoadGLES(getProcAddress);
#endif // defined(ANGLE_USE_UTIL_LOADER)
return;
}
// Resize the window before creating the context so that the first make current
// sets the viewport and scissor box to the right size.
bool needSwap = false;
......@@ -483,17 +515,22 @@ void ANGLETestBase::ANGLETestSetUp()
// taking OpenGL traces can guess the size of the default framebuffer and show it
// in their UIs
glViewport(0, 0, mWidth, mHeight);
const auto &info = testing::UnitTest::GetInstance()->current_test_info();
angle::WriteDebugMessage("Entering %s.%s\n", info->test_case_name(), info->name());
}
void ANGLETestBase::ANGLETestTearDown()
{
gPlatformContext.currentTest = nullptr;
const testing::TestInfo *info = testing::UnitTest::GetInstance()->current_test_info();
angle::WriteDebugMessage("Exiting %s.%s\n", info->test_case_name(), info->name());
if (angle::IsWindows())
{
const testing::TestInfo *info = testing::UnitTest::GetInstance()->current_test_info();
angle::WriteDebugMessage("Exiting %s.%s\n", info->test_case_name(), info->name());
}
if (mCurrentParams->noFixture)
{
return;
}
swapBuffers();
mFixture->osWindow->messageLoop();
......@@ -1062,8 +1099,8 @@ void ANGLETestBase::setRobustResourceInit(bool enabled)
void ANGLETestBase::setContextProgramCacheEnabled(bool enabled,
angle::CacheProgramFunc cacheProgramFunc)
{
mFixture->configParams.contextProgramCacheEnabled = enabled;
gDefaultPlatformMethods.cacheProgram = cacheProgramFunc;
mFixture->configParams.contextProgramCacheEnabled = enabled;
gDefaultPlatformMethods.cacheProgram = cacheProgramFunc;
}
void ANGLETestBase::setContextResetStrategy(EGLenum resetStrategy)
......@@ -1244,7 +1281,7 @@ ANGLETestBase::ScopedIgnorePlatformMessages::~ScopedIgnorePlatformMessages()
}
OSWindow *ANGLETestBase::mOSWindowSingleton = nullptr;
std::map<angle::PlatformParameters, ANGLETestBase::TestFixture> ANGLETestBase::gPlatforms;
std::map<angle::PlatformParameters, ANGLETestBase::TestFixture> ANGLETestBase::gFixtures;
Optional<EGLint> ANGLETestBase::mLastRendererType;
std::unique_ptr<angle::Library> ANGLETestEnvironment::gEGLLibrary;
......@@ -1289,22 +1326,6 @@ void ANGLEProcessTestArgs(int *argc, char *argv[])
}
}
EGLTest::EGLTest() = default;
EGLTest::~EGLTest() = default;
void EGLTest::SetUp()
{
#if defined(ANGLE_USE_UTIL_LOADER)
PFNEGLGETPROCADDRESSPROC getProcAddress;
ANGLETestEnvironment::GetEGLLibrary()->getAs("eglGetProcAddress", &getProcAddress);
ASSERT_NE(nullptr, getProcAddress);
angle::LoadEGL(getProcAddress);
angle::LoadGLES(getProcAddress);
#endif // defined(ANGLE_USE_UTIL_LOADER)
}
bool EnsureGLExtensionEnabled(const std::string &extName)
{
if (IsGLExtensionEnabled("GL_ANGLE_request_extension") && IsGLExtensionRequestable(extName))
......
......@@ -399,6 +399,17 @@ class ANGLETestBase
~ScopedIgnorePlatformMessages();
};
// Can be used before we get a GL context.
bool isGLRenderer() const
{
return mCurrentParams->getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE;
}
bool isD3D11Renderer() const
{
return mCurrentParams->getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
}
private:
void checkD3D11SDKLayersMessages();
......@@ -410,6 +421,8 @@ class ANGLETestBase
bool useInstancedDrawCalls,
GLuint numInstances);
void initOSWindow();
struct TestFixture
{
TestFixture();
......@@ -444,7 +457,7 @@ class ANGLETestBase
// different config. This OSWindow sharing seemed to lead to driver bugs on some platforms.
static OSWindow *mOSWindowSingleton;
static std::map<angle::PlatformParameters, TestFixture> gPlatforms;
static std::map<angle::PlatformParameters, TestFixture> gFixtures;
const angle::PlatformParameters *mCurrentParams;
TestFixture *mFixture;
......@@ -493,16 +506,6 @@ class ANGLETestEnvironment : public testing::Environment
static std::unique_ptr<angle::Library> gWGLLibrary;
};
// This base fixture loads the EGL entry points.
class EGLTest : public testing::Test
{
public:
EGLTest();
~EGLTest();
void SetUp() override;
};
// Driver vendors
bool IsIntel();
bool IsAdreno();
......
......@@ -18,6 +18,7 @@ PlatformParameters::PlatformParameters(EGLint majorVersion,
EGLint minorVersion,
const EGLPlatformParameters &eglPlatformParameters)
: driver(GLESDriverType::AngleEGL),
noFixture(false),
eglParameters(eglPlatformParameters),
majorVersion(majorVersion),
minorVersion(minorVersion)
......@@ -28,7 +29,7 @@ PlatformParameters::PlatformParameters(EGLint majorVersion,
PlatformParameters::PlatformParameters(EGLint majorVersion,
EGLint minorVersion,
GLESDriverType driver)
: driver(driver), majorVersion(majorVersion), minorVersion(minorVersion)
: driver(driver), noFixture(false), majorVersion(majorVersion), minorVersion(minorVersion)
{
initDefaultParameters();
}
......@@ -164,6 +165,11 @@ std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp)
break;
}
if (pp.noFixture)
{
stream << "_NoFixture";
}
if (pp.eglParameters.contextVirtualization == EGL_FALSE)
{
stream << "_NoVirtual";
......
......@@ -47,9 +47,13 @@ struct PlatformParameters
void initDefaultParameters();
auto tie() const { return std::tie(driver, eglParameters, majorVersion, minorVersion); }
auto tie() const
{
return std::tie(driver, noFixture, eglParameters, majorVersion, minorVersion);
}
GLESDriverType driver;
bool noFixture;
EGLPlatformParameters eglParameters;
EGLint majorVersion;
EGLint minorVersion;
......@@ -184,6 +188,12 @@ inline PlatformParameters WithNoVirtualContexts(const PlatformParameters &params
return withNoVirtualContexts;
}
inline PlatformParameters WithNoFixture(const PlatformParameters &params)
{
PlatformParameters withNoFixture = params;
withNoFixture.noFixture = true;
return withNoFixture;
}
} // namespace angle
#endif // ANGLE_TEST_CONFIGS_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