Commit f455f756 by Jamie Madill Committed by Commit Bot

Reuse angle_end2end_test windows and displays.

This both speeds up test execution and cuts down on the number of new windows and displays created for a test config. This feature is only currently enabled for Windows NVIDIA and Intel. On every other config there were blocking issues that would need investigation. Several tests were manually flagged as needed new displays on each iteration to prevent test flakiness. This feature might fix the issues with Intel test flakiness that have been prominent on the ANGLE CQ. WGL configurations have also been removed from ANGLE tests. So this removes more of the code from ANGLETest.cpp. Bug: angleproject:3261 Change-Id: Ic2864d4806ad38e0eeaa3c0afcd54ae1c548090f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1520995 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent 45938b61
...@@ -2869,11 +2869,7 @@ Error ValidateSwapBuffersWithDamageKHR(const Display *display, ...@@ -2869,11 +2869,7 @@ Error ValidateSwapBuffersWithDamageKHR(const Display *display,
EGLint *rects, EGLint *rects,
EGLint n_rects) EGLint n_rects)
{ {
Error error = ValidateSurface(display, surface); ANGLE_TRY(ValidateSurface(display, surface));
if (error.isError())
{
return error;
}
if (!display->getExtensions().swapBuffersWithDamage) if (!display->getExtensions().swapBuffersWithDamage)
{ {
......
...@@ -78,7 +78,11 @@ EGLsizeiANDROID GetBlob(const void *key, ...@@ -78,7 +78,11 @@ EGLsizeiANDROID GetBlob(const void *key,
class EGLBlobCacheTest : public ANGLETest class EGLBlobCacheTest : public ANGLETest
{ {
protected: protected:
EGLBlobCacheTest() : mHasBlobCache(false) {} EGLBlobCacheTest() : mHasBlobCache(false)
{
// Force disply caching off. Blob cache functions require it.
forceNewDisplay();
}
void SetUp() override void SetUp() override
{ {
...@@ -88,8 +92,6 @@ class EGLBlobCacheTest : public ANGLETest ...@@ -88,8 +92,6 @@ class EGLBlobCacheTest : public ANGLETest
mHasBlobCache = eglDisplayExtensionEnabled(display, kEGLExtName); mHasBlobCache = eglDisplayExtensionEnabled(display, kEGLExtName);
} }
void TearDown() override { ANGLETest::TearDown(); }
bool programBinaryAvailable() bool programBinaryAvailable()
{ {
return (getClientMajorVersion() >= 3 || extensionEnabled("GL_OES_get_program_binary")); return (getClientMajorVersion() >= 3 || extensionEnabled("GL_OES_get_program_binary"));
...@@ -103,7 +105,7 @@ TEST_P(EGLBlobCacheTest, Functional) ...@@ -103,7 +105,7 @@ TEST_P(EGLBlobCacheTest, Functional)
{ {
EGLDisplay display = getEGLWindow()->getDisplay(); EGLDisplay display = getEGLWindow()->getDisplay();
EXPECT_EQ(true, mHasBlobCache); EXPECT_TRUE(mHasBlobCache);
eglSetBlobCacheFuncsANDROID(display, SetBlob, GetBlob); eglSetBlobCacheFuncsANDROID(display, SetBlob, GetBlob);
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
...@@ -172,7 +174,7 @@ void main() ...@@ -172,7 +174,7 @@ void main()
// Tests error conditions of the APIs. // Tests error conditions of the APIs.
TEST_P(EGLBlobCacheTest, NegativeAPI) TEST_P(EGLBlobCacheTest, NegativeAPI)
{ {
EXPECT_EQ(true, mHasBlobCache); EXPECT_TRUE(mHasBlobCache);
// Test bad display // Test bad display
eglSetBlobCacheFuncsANDROID(EGL_NO_DISPLAY, nullptr, nullptr); eglSetBlobCacheFuncsANDROID(EGL_NO_DISPLAY, nullptr, nullptr);
......
...@@ -31,25 +31,34 @@ class EGLProgramCacheControlTest : public ANGLETest ...@@ -31,25 +31,34 @@ class EGLProgramCacheControlTest : public ANGLETest
} }
protected: protected:
EGLProgramCacheControlTest() { setDeferContextInit(true); } EGLProgramCacheControlTest()
{
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
setDeferContextInit(true);
}
void SetUp() override void SetUp() override
{ {
mPlatformMethods.cacheProgram = &TestCacheProgram; setContextProgramCacheEnabled(true, &TestCacheProgram);
ANGLETest::SetUp(); ANGLETest::SetUp();
if (extensionAvailable()) if (extensionAvailable())
{ {
EGLDisplay display = getEGLWindow()->getDisplay(); EGLDisplay display = getEGLWindow()->getDisplay();
setContextProgramCacheEnabled(true);
eglProgramCacheResizeANGLE(display, kEnabledCacheSize, EGL_PROGRAM_CACHE_RESIZE_ANGLE); eglProgramCacheResizeANGLE(display, kEnabledCacheSize, EGL_PROGRAM_CACHE_RESIZE_ANGLE);
ASSERT_EGL_SUCCESS();
} }
getEGLWindow()->initializeContext(); ASSERT_TRUE(getEGLWindow()->initializeContext());
} }
void TearDown() override { ANGLETest::TearDown(); } void TearDown() override
{
setContextProgramCacheEnabled(false, angle::DefaultCacheProgram);
ANGLETest::TearDown();
}
bool extensionAvailable() bool extensionAvailable()
{ {
......
...@@ -57,7 +57,7 @@ class DrawBuffersTest : public ANGLETest ...@@ -57,7 +57,7 @@ class DrawBuffersTest : public ANGLETest
} }
// This test seems to fail on an nVidia machine when the window is hidden // This test seems to fail on an nVidia machine when the window is hidden
SetWindowVisible(true); setWindowVisible(true);
glGenFramebuffers(1, &mFBO); glGenFramebuffers(1, &mFBO);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFBO);
......
...@@ -115,7 +115,7 @@ class InstancingTest : public ANGLETest ...@@ -115,7 +115,7 @@ class InstancingTest : public ANGLETest
// TODO: Fix these. http://anglebug.com/3129 // TODO: Fix these. http://anglebug.com/3129
ANGLE_SKIP_TEST_IF(IsD3D9() && draw == Indexed && geometry == Point); ANGLE_SKIP_TEST_IF(IsD3D9() && draw == Indexed && geometry == Point);
ANGLE_SKIP_TEST_IF(IsD3D9() && IsAMD() && geometry == Point); ANGLE_SKIP_TEST_IF(IsD3D9() && IsAMD());
// D3D11 FL9_3 has a special codepath that emulates instanced points rendering // D3D11 FL9_3 has a special codepath that emulates instanced points rendering
// but it has bugs and was only implemented for vertex positions in a buffer object, // but it has bugs and was only implemented for vertex positions in a buffer object,
......
...@@ -28,6 +28,9 @@ class ProgramBinaryTest : public ANGLETest ...@@ -28,6 +28,9 @@ class ProgramBinaryTest : public ANGLETest
setConfigGreenBits(8); setConfigGreenBits(8);
setConfigBlueBits(8); setConfigBlueBits(8);
setConfigAlphaBits(8); setConfigAlphaBits(8);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
} }
void SetUp() override void SetUp() override
...@@ -52,7 +55,6 @@ class ProgramBinaryTest : public ANGLETest ...@@ -52,7 +55,6 @@ class ProgramBinaryTest : public ANGLETest
{ {
glDeleteProgram(mProgram); glDeleteProgram(mProgram);
glDeleteBuffers(1, &mBuffer); glDeleteBuffers(1, &mBuffer);
ANGLETest::TearDown(); ANGLETest::TearDown();
} }
...@@ -259,6 +261,12 @@ ANGLE_INSTANTIATE_TEST(ProgramBinaryTest, ...@@ -259,6 +261,12 @@ ANGLE_INSTANTIATE_TEST(ProgramBinaryTest,
class ProgramBinaryES3Test : public ANGLETest class ProgramBinaryES3Test : public ANGLETest
{ {
protected: protected:
ProgramBinaryES3Test()
{
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
}
void testBinaryAndUBOBlockIndexes(bool drawWithProgramFirst); void testBinaryAndUBOBlockIndexes(bool drawWithProgramFirst);
}; };
...@@ -368,6 +376,9 @@ class ProgramBinaryES31Test : public ANGLETest ...@@ -368,6 +376,9 @@ class ProgramBinaryES31Test : public ANGLETest
setConfigGreenBits(8); setConfigGreenBits(8);
setConfigBlueBits(8); setConfigBlueBits(8);
setConfigAlphaBits(8); setConfigAlphaBits(8);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
} }
}; };
......
...@@ -29,6 +29,9 @@ class RobustBufferAccessBehaviorTest : public ANGLETest ...@@ -29,6 +29,9 @@ class RobustBufferAccessBehaviorTest : public ANGLETest
setConfigGreenBits(8); setConfigGreenBits(8);
setConfigBlueBits(8); setConfigBlueBits(8);
setConfigAlphaBits(8); setConfigAlphaBits(8);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
} }
void TearDown() override void TearDown() override
......
...@@ -204,6 +204,9 @@ class RobustResourceInitTest : public ANGLETest ...@@ -204,6 +204,9 @@ class RobustResourceInitTest : public ANGLETest
setConfigStencilBits(8); setConfigStencilBits(8);
setRobustResourceInit(true); setRobustResourceInit(true);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
} }
bool hasGLExtension() { return extensionEnabled("GL_ANGLE_robust_resource_initialization"); } bool hasGLExtension() { return extensionEnabled("GL_ANGLE_robust_resource_initialization"); }
......
...@@ -65,6 +65,9 @@ class ShaderStorageBufferTest31 : public ANGLETest ...@@ -65,6 +65,9 @@ class ShaderStorageBufferTest31 : public ANGLETest
setConfigGreenBits(8); setConfigGreenBits(8);
setConfigBlueBits(8); setConfigBlueBits(8);
setConfigAlphaBits(8); setConfigAlphaBits(8);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
} }
void runMatrixTest(const MatrixCase &matrixCase) void runMatrixTest(const MatrixCase &matrixCase)
...@@ -1590,6 +1593,9 @@ TEST_P(ShaderStorageBufferTest31, LoadAndStoreBooleanValue) ...@@ -1590,6 +1593,9 @@ TEST_P(ShaderStorageBufferTest31, LoadAndStoreBooleanValue)
// http://anglebug.com/1951 // http://anglebug.com/1951
ANGLE_SKIP_TEST_IF(IsIntel() && IsLinux()); ANGLE_SKIP_TEST_IF(IsIntel() && IsLinux());
// Seems to fail on Windows NVIDIA GL when tests are run without interruption.
ANGLE_SKIP_TEST_IF(IsWindows() && IsNVIDIA() && IsOpenGL());
constexpr char kComputeShaderSource[] = R"(#version 310 es constexpr char kComputeShaderSource[] = R"(#version 310 es
layout (local_size_x=1) in; layout (local_size_x=1) in;
layout(binding=0, std140) buffer Storage0 layout(binding=0, std140) buffer Storage0
......
...@@ -68,7 +68,7 @@ TEST_P(TextureRectangleTest, TexImage2D) ...@@ -68,7 +68,7 @@ TEST_P(TextureRectangleTest, TexImage2D)
// Defining a texture of the max size is allowed // Defining a texture of the max size is allowed
{ {
ScopedIgnorePlatformMessages ignore(this); ScopedIgnorePlatformMessages ignore;
glTexImage2D(GL_TEXTURE_RECTANGLE_ANGLE, 0, GL_RGBA, maxSize, maxSize, 0, GL_RGBA, glTexImage2D(GL_TEXTURE_RECTANGLE_ANGLE, 0, GL_RGBA, maxSize, maxSize, 0, GL_RGBA,
GL_UNSIGNED_BYTE, nullptr); GL_UNSIGNED_BYTE, nullptr);
...@@ -154,7 +154,7 @@ TEST_P(TextureRectangleTest, TexStorage2D) ...@@ -154,7 +154,7 @@ TEST_P(TextureRectangleTest, TexStorage2D)
// Defining a texture of the max size is allowed but still allow for OOM // Defining a texture of the max size is allowed but still allow for OOM
{ {
ScopedIgnorePlatformMessages ignore(this); ScopedIgnorePlatformMessages ignore;
GLTexture tex; GLTexture tex;
glBindTexture(GL_TEXTURE_RECTANGLE_ANGLE, tex); glBindTexture(GL_TEXTURE_RECTANGLE_ANGLE, tex);
......
...@@ -262,9 +262,7 @@ class ANGLETestBase ...@@ -262,9 +262,7 @@ class ANGLETestBase
virtual ~ANGLETestBase(); virtual ~ANGLETestBase();
public: public:
static bool InitTestWindow(); void setWindowVisible(bool isVisible);
static bool DestroyTestWindow();
static void SetWindowVisible(bool isVisible);
static bool eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName); static bool eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName);
virtual void overrideWorkaroundsD3D(angle::WorkaroundsD3D *workaroundsD3D) {} virtual void overrideWorkaroundsD3D(angle::WorkaroundsD3D *workaroundsD3D) {}
...@@ -357,8 +355,9 @@ class ANGLETestBase ...@@ -357,8 +355,9 @@ class ANGLETestBase
void setDebugLayersEnabled(bool enabled); void setDebugLayersEnabled(bool enabled);
void setClientArraysEnabled(bool enabled); void setClientArraysEnabled(bool enabled);
void setRobustResourceInit(bool enabled); void setRobustResourceInit(bool enabled);
void setContextProgramCacheEnabled(bool enabled); void setContextProgramCacheEnabled(bool enabled, angle::CacheProgramFunc cacheProgramFunc);
void setContextVirtualization(bool enabled); void setContextVirtualization(bool enabled);
void forceNewDisplay();
// Some EGL extension tests would like to defer the Context init until the test body. // Some EGL extension tests would like to defer the Context init until the test body.
void setDeferContextInit(bool enabled); void setDeferContextInit(bool enabled);
...@@ -379,28 +378,22 @@ class ANGLETestBase ...@@ -379,28 +378,22 @@ class ANGLETestBase
// Allows a test to be more restrictive about platform warnings. // Allows a test to be more restrictive about platform warnings.
void treatPlatformWarningsAsErrors(); void treatPlatformWarningsAsErrors();
static OSWindow *GetOSWindow() { return mOSWindow; } OSWindow *getOSWindow() { return mCurrentPlatform->osWindow; }
GLuint get2DTexturedQuadProgram(); GLuint get2DTexturedQuadProgram();
// Has a float uniform "u_layer" to choose the 3D texture layer. // Has a float uniform "u_layer" to choose the 3D texture layer.
GLuint get3DTexturedQuadProgram(); GLuint get3DTexturedQuadProgram();
angle::PlatformMethods mPlatformMethods;
class ScopedIgnorePlatformMessages : angle::NonCopyable class ScopedIgnorePlatformMessages : angle::NonCopyable
{ {
public: public:
ScopedIgnorePlatformMessages(ANGLETestBase *test); ScopedIgnorePlatformMessages();
~ScopedIgnorePlatformMessages(); ~ScopedIgnorePlatformMessages();
private:
ANGLETestBase *mTest;
}; };
private: private:
void checkD3D11SDKLayersMessages(); void checkD3D11SDKLayersMessages();
bool hasNVIDIAGPU() const;
void drawQuad(GLuint program, void drawQuad(GLuint program,
const std::string &positionAttribName, const std::string &positionAttribName,
...@@ -410,9 +403,18 @@ class ANGLETestBase ...@@ -410,9 +403,18 @@ class ANGLETestBase
bool useInstancedDrawCalls, bool useInstancedDrawCalls,
GLuint numInstances); GLuint numInstances);
EGLWindow *mEGLWindow; struct Platform
WGLWindow *mWGLWindow; {
ConfigParameters mConfigParameters; Platform();
~Platform();
EGLWindow *eglWindow = nullptr;
WGLWindow *wglWindow = nullptr;
OSWindow *osWindow = nullptr;
ConfigParameters configParams;
uint32_t reuseCounter = 0;
};
int mWidth; int mWidth;
int mHeight; int mHeight;
...@@ -426,11 +428,17 @@ class ANGLETestBase ...@@ -426,11 +428,17 @@ class ANGLETestBase
GLuint m2DTexturedQuadProgram; GLuint m2DTexturedQuadProgram;
GLuint m3DTexturedQuadProgram; GLuint m3DTexturedQuadProgram;
TestPlatformContext mPlatformContext;
bool mDeferContextInit; bool mDeferContextInit;
bool mAlwaysForceNewDisplay;
bool mForceNewDisplay;
// On most systems we force a new display on every test instance. For these configs we can
// share a single OSWindow instance. With display reuse we need a separate OSWindow for each
// different config. This OSWindow sharing seemed to lead to driver bugs on some platforms.
static OSWindow *mOSWindowSingleton;
static OSWindow *mOSWindow; static std::map<angle::PlatformParameters, Platform> gPlatforms;
Platform *mCurrentPlatform;
// Workaround for NVIDIA not being able to share a window with OpenGL and Vulkan. // Workaround for NVIDIA not being able to share a window with OpenGL and Vulkan.
static Optional<EGLint> mLastRendererType; static Optional<EGLint> mLastRendererType;
......
...@@ -114,6 +114,14 @@ void ConfigParameters::reset() ...@@ -114,6 +114,14 @@ void ConfigParameters::reset()
*this = ConfigParameters(); *this = ConfigParameters();
} }
// static
bool ConfigParameters::CanShareDisplay(const ConfigParameters &a, const ConfigParameters &b)
{
return a.debugLayersEnabled == b.debugLayersEnabled &&
a.contextVirtualization == b.contextVirtualization &&
a.platformMethods == b.platformMethods;
}
// GLWindowBase implementation. // GLWindowBase implementation.
GLWindowBase::GLWindowBase(EGLint glesMajorVersion, EGLint glesMinorVersion) GLWindowBase::GLWindowBase(EGLint glesMajorVersion, EGLint glesMinorVersion)
: mClientMajorVersion(glesMajorVersion), mClientMinorVersion(glesMinorVersion) : mClientMajorVersion(glesMajorVersion), mClientMinorVersion(glesMinorVersion)
......
...@@ -33,6 +33,8 @@ struct ANGLE_UTIL_EXPORT ConfigParameters ...@@ -33,6 +33,8 @@ struct ANGLE_UTIL_EXPORT ConfigParameters
void reset(); void reset();
static bool CanShareDisplay(const ConfigParameters &a, const ConfigParameters &b);
// Display parameters. // Display parameters.
Optional<bool> debugLayersEnabled; Optional<bool> debugLayersEnabled;
Optional<bool> contextVirtualization; Optional<bool> contextVirtualization;
......
...@@ -550,7 +550,7 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh ...@@ -550,7 +550,7 @@ bool Win32Window::initialize(const std::string &name, size_t width, size_t heigh
} }
DWORD parentStyle = WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU; DWORD parentStyle = WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU;
DWORD parentExtendedStyle = WS_EX_APPWINDOW; DWORD parentExtendedStyle = WS_EX_APPWINDOW | WS_EX_TOOLWINDOW;
RECT sizeRect = {0, 0, static_cast<LONG>(width), static_cast<LONG>(height)}; RECT sizeRect = {0, 0, static_cast<LONG>(width), static_cast<LONG>(height)};
AdjustWindowRectEx(&sizeRect, parentStyle, FALSE, parentExtendedStyle); AdjustWindowRectEx(&sizeRect, parentStyle, FALSE, parentExtendedStyle);
......
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