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,
EGLint *rects,
EGLint n_rects)
{
Error error = ValidateSurface(display, surface);
if (error.isError())
{
return error;
}
ANGLE_TRY(ValidateSurface(display, surface));
if (!display->getExtensions().swapBuffersWithDamage)
{
......
......@@ -78,7 +78,11 @@ EGLsizeiANDROID GetBlob(const void *key,
class EGLBlobCacheTest : public ANGLETest
{
protected:
EGLBlobCacheTest() : mHasBlobCache(false) {}
EGLBlobCacheTest() : mHasBlobCache(false)
{
// Force disply caching off. Blob cache functions require it.
forceNewDisplay();
}
void SetUp() override
{
......@@ -88,8 +92,6 @@ class EGLBlobCacheTest : public ANGLETest
mHasBlobCache = eglDisplayExtensionEnabled(display, kEGLExtName);
}
void TearDown() override { ANGLETest::TearDown(); }
bool programBinaryAvailable()
{
return (getClientMajorVersion() >= 3 || extensionEnabled("GL_OES_get_program_binary"));
......@@ -103,7 +105,7 @@ TEST_P(EGLBlobCacheTest, Functional)
{
EGLDisplay display = getEGLWindow()->getDisplay();
EXPECT_EQ(true, mHasBlobCache);
EXPECT_TRUE(mHasBlobCache);
eglSetBlobCacheFuncsANDROID(display, SetBlob, GetBlob);
ASSERT_EGL_SUCCESS();
......@@ -172,7 +174,7 @@ void main()
// Tests error conditions of the APIs.
TEST_P(EGLBlobCacheTest, NegativeAPI)
{
EXPECT_EQ(true, mHasBlobCache);
EXPECT_TRUE(mHasBlobCache);
// Test bad display
eglSetBlobCacheFuncsANDROID(EGL_NO_DISPLAY, nullptr, nullptr);
......
......@@ -31,25 +31,34 @@ class EGLProgramCacheControlTest : public ANGLETest
}
protected:
EGLProgramCacheControlTest() { setDeferContextInit(true); }
EGLProgramCacheControlTest()
{
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
setDeferContextInit(true);
}
void SetUp() override
{
mPlatformMethods.cacheProgram = &TestCacheProgram;
setContextProgramCacheEnabled(true, &TestCacheProgram);
ANGLETest::SetUp();
if (extensionAvailable())
{
EGLDisplay display = getEGLWindow()->getDisplay();
setContextProgramCacheEnabled(true);
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()
{
......
......@@ -57,7 +57,7 @@ class DrawBuffersTest : public ANGLETest
}
// This test seems to fail on an nVidia machine when the window is hidden
SetWindowVisible(true);
setWindowVisible(true);
glGenFramebuffers(1, &mFBO);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mFBO);
......
......@@ -115,7 +115,7 @@ class InstancingTest : public ANGLETest
// TODO: Fix these. http://anglebug.com/3129
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
// but it has bugs and was only implemented for vertex positions in a buffer object,
......
......@@ -28,6 +28,9 @@ class ProgramBinaryTest : public ANGLETest
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
}
void SetUp() override
......@@ -52,7 +55,6 @@ class ProgramBinaryTest : public ANGLETest
{
glDeleteProgram(mProgram);
glDeleteBuffers(1, &mBuffer);
ANGLETest::TearDown();
}
......@@ -259,6 +261,12 @@ ANGLE_INSTANTIATE_TEST(ProgramBinaryTest,
class ProgramBinaryES3Test : public ANGLETest
{
protected:
ProgramBinaryES3Test()
{
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
}
void testBinaryAndUBOBlockIndexes(bool drawWithProgramFirst);
};
......@@ -368,6 +376,9 @@ class ProgramBinaryES31Test : public ANGLETest
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
}
};
......
......@@ -29,6 +29,9 @@ class RobustBufferAccessBehaviorTest : public ANGLETest
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
}
void TearDown() override
......
......@@ -204,6 +204,9 @@ class RobustResourceInitTest : public ANGLETest
setConfigStencilBits(8);
setRobustResourceInit(true);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
}
bool hasGLExtension() { return extensionEnabled("GL_ANGLE_robust_resource_initialization"); }
......
......@@ -65,6 +65,9 @@ class ShaderStorageBufferTest31 : public ANGLETest
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
// Test flakiness was noticed when reusing displays.
forceNewDisplay();
}
void runMatrixTest(const MatrixCase &matrixCase)
......@@ -1590,6 +1593,9 @@ TEST_P(ShaderStorageBufferTest31, LoadAndStoreBooleanValue)
// http://anglebug.com/1951
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
layout (local_size_x=1) in;
layout(binding=0, std140) buffer Storage0
......
......@@ -68,7 +68,7 @@ TEST_P(TextureRectangleTest, TexImage2D)
// 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,
GL_UNSIGNED_BYTE, nullptr);
......@@ -154,7 +154,7 @@ TEST_P(TextureRectangleTest, TexStorage2D)
// Defining a texture of the max size is allowed but still allow for OOM
{
ScopedIgnorePlatformMessages ignore(this);
ScopedIgnorePlatformMessages ignore;
GLTexture tex;
glBindTexture(GL_TEXTURE_RECTANGLE_ANGLE, tex);
......
......@@ -262,9 +262,7 @@ class ANGLETestBase
virtual ~ANGLETestBase();
public:
static bool InitTestWindow();
static bool DestroyTestWindow();
static void SetWindowVisible(bool isVisible);
void setWindowVisible(bool isVisible);
static bool eglDisplayExtensionEnabled(EGLDisplay display, const std::string &extName);
virtual void overrideWorkaroundsD3D(angle::WorkaroundsD3D *workaroundsD3D) {}
......@@ -357,8 +355,9 @@ class ANGLETestBase
void setDebugLayersEnabled(bool enabled);
void setClientArraysEnabled(bool enabled);
void setRobustResourceInit(bool enabled);
void setContextProgramCacheEnabled(bool enabled);
void setContextProgramCacheEnabled(bool enabled, angle::CacheProgramFunc cacheProgramFunc);
void setContextVirtualization(bool enabled);
void forceNewDisplay();
// Some EGL extension tests would like to defer the Context init until the test body.
void setDeferContextInit(bool enabled);
......@@ -379,28 +378,22 @@ class ANGLETestBase
// Allows a test to be more restrictive about platform warnings.
void treatPlatformWarningsAsErrors();
static OSWindow *GetOSWindow() { return mOSWindow; }
OSWindow *getOSWindow() { return mCurrentPlatform->osWindow; }
GLuint get2DTexturedQuadProgram();
// Has a float uniform "u_layer" to choose the 3D texture layer.
GLuint get3DTexturedQuadProgram();
angle::PlatformMethods mPlatformMethods;
class ScopedIgnorePlatformMessages : angle::NonCopyable
{
public:
ScopedIgnorePlatformMessages(ANGLETestBase *test);
ScopedIgnorePlatformMessages();
~ScopedIgnorePlatformMessages();
private:
ANGLETestBase *mTest;
};
private:
void checkD3D11SDKLayersMessages();
bool hasNVIDIAGPU() const;
void drawQuad(GLuint program,
const std::string &positionAttribName,
......@@ -410,9 +403,18 @@ class ANGLETestBase
bool useInstancedDrawCalls,
GLuint numInstances);
EGLWindow *mEGLWindow;
WGLWindow *mWGLWindow;
ConfigParameters mConfigParameters;
struct Platform
{
Platform();
~Platform();
EGLWindow *eglWindow = nullptr;
WGLWindow *wglWindow = nullptr;
OSWindow *osWindow = nullptr;
ConfigParameters configParams;
uint32_t reuseCounter = 0;
};
int mWidth;
int mHeight;
......@@ -426,11 +428,17 @@ class ANGLETestBase
GLuint m2DTexturedQuadProgram;
GLuint m3DTexturedQuadProgram;
TestPlatformContext mPlatformContext;
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.
static Optional<EGLint> mLastRendererType;
......
......@@ -114,6 +114,14 @@ void ConfigParameters::reset()
*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::GLWindowBase(EGLint glesMajorVersion, EGLint glesMinorVersion)
: mClientMajorVersion(glesMajorVersion), mClientMinorVersion(glesMinorVersion)
......
......@@ -33,6 +33,8 @@ struct ANGLE_UTIL_EXPORT ConfigParameters
void reset();
static bool CanShareDisplay(const ConfigParameters &a, const ConfigParameters &b);
// Display parameters.
Optional<bool> debugLayersEnabled;
Optional<bool> contextVirtualization;
......
......@@ -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 parentExtendedStyle = WS_EX_APPWINDOW;
DWORD parentExtendedStyle = WS_EX_APPWINDOW | WS_EX_TOOLWINDOW;
RECT sizeRect = {0, 0, static_cast<LONG>(width), static_cast<LONG>(height)};
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