diff --git a/samples/sample_util/SampleApplication.cpp b/samples/sample_util/SampleApplication.cpp index 268df6433..5a3746a31 100644 --- a/samples/sample_util/SampleApplication.cpp +++ b/samples/sample_util/SampleApplication.cpp @@ -10,9 +10,11 @@ SampleApplication::SampleApplication(const std::string& name, size_t width, size_t height, EGLint glesMajorVersion, EGLint requestedRenderer) : mName(name), + mWidth(width), + mHeight(height), mRunning(false) { - mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, EGLPlatformParameters(requestedRenderer))); + mEGLWindow.reset(new EGLWindow(glesMajorVersion, EGLPlatformParameters(requestedRenderer))); mTimer.reset(CreateTimer()); mOSWindow.reset(CreateOSWindow()); @@ -80,7 +82,7 @@ EGLContext SampleApplication::getContext() const int SampleApplication::run() { - if (!mOSWindow->initialize(mName, mEGLWindow->getWidth(), mEGLWindow->getHeight())) + if (!mOSWindow->initialize(mName, mWidth, mHeight)) { return -1; } diff --git a/samples/sample_util/SampleApplication.h b/samples/sample_util/SampleApplication.h index 3acfb5985..74a87017c 100644 --- a/samples/sample_util/SampleApplication.h +++ b/samples/sample_util/SampleApplication.h @@ -48,6 +48,8 @@ class SampleApplication private: std::string mName; + size_t mWidth; + size_t mHeight; bool mRunning; std::unique_ptr mTimer; diff --git a/src/tests/gl_tests/PbufferTest.cpp b/src/tests/gl_tests/PbufferTest.cpp index 7bfde322c..35d91c962 100644 --- a/src/tests/gl_tests/PbufferTest.cpp +++ b/src/tests/gl_tests/PbufferTest.cpp @@ -130,7 +130,7 @@ TEST_P(PbufferTest, Clearing) glClearColor(0.0f, 0.0f, 1.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); ASSERT_GL_NO_ERROR(); - EXPECT_PIXEL_EQ(window->getWidth() / 2, window->getHeight() / 2, 0, 0, 255, 255); + EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 0, 0, 255, 255); // Apply the Pbuffer and clear it to purple and verify eglMakeCurrent(window->getDisplay(), mPbuffer, mPbuffer, window->getContext()); @@ -145,7 +145,7 @@ TEST_P(PbufferTest, Clearing) // Rebind the window surface and verify that it is still blue eglMakeCurrent(window->getDisplay(), window->getSurface(), window->getSurface(), window->getContext()); ASSERT_EGL_SUCCESS(); - EXPECT_PIXEL_EQ(window->getWidth() / 2, window->getHeight() / 2, 0, 0, 255, 255); + EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 0, 0, 255, 255); } // Bind the Pbuffer to a texture and verify it renders correctly @@ -190,7 +190,7 @@ TEST_P(PbufferTest, BindTexImage) EXPECT_GL_NO_ERROR(); eglBindTexImage(window->getDisplay(), mPbuffer, EGL_BACK_BUFFER); - glViewport(0, 0, window->getWidth(), window->getHeight()); + glViewport(0, 0, getWindowWidth(), getWindowHeight()); ASSERT_EGL_SUCCESS(); // Draw a quad and verify that it is purple @@ -205,7 +205,7 @@ TEST_P(PbufferTest, BindTexImage) ASSERT_EGL_SUCCESS(); // Verify that purple was drawn - EXPECT_PIXEL_EQ(window->getWidth() / 2, window->getHeight() / 2, 255, 0, 255, 255); + EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 255, 0, 255, 255); glDeleteTextures(1, &texture); } @@ -308,13 +308,13 @@ TEST_P(PbufferTest, BindTexImageAndRedefineTexture) EXPECT_GL_NO_ERROR(); eglBindTexImage(window->getDisplay(), mPbuffer, EGL_BACK_BUFFER); - glViewport(0, 0, window->getWidth(), window->getHeight()); + glViewport(0, 0, getWindowWidth(), getWindowHeight()); ASSERT_EGL_SUCCESS(); // Redefine the texture unsigned int pixelValue = 0xFFFF00FF; - std::vector pixelData(window->getWidth() * window->getHeight(), pixelValue); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, window->getWidth(), window->getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixelData[0]); + std::vector pixelData(getWindowWidth() * getWindowHeight(), pixelValue); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindowWidth(), getWindowHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixelData[0]); // Draw a quad and verify that it is magenta glUseProgram(mTextureProgram); @@ -324,7 +324,7 @@ TEST_P(PbufferTest, BindTexImageAndRedefineTexture) EXPECT_GL_NO_ERROR(); // Verify that magenta was drawn - EXPECT_PIXEL_EQ(window->getWidth() / 2, window->getHeight() / 2, 255, 0, 255, 255); + EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 255, 0, 255, 255); glDeleteTextures(1, &texture); } diff --git a/src/tests/gl_tests/ProgramBinaryTest.cpp b/src/tests/gl_tests/ProgramBinaryTest.cpp index 6ad5ba538..6bd63e66b 100644 --- a/src/tests/gl_tests/ProgramBinaryTest.cpp +++ b/src/tests/gl_tests/ProgramBinaryTest.cpp @@ -200,7 +200,7 @@ class ProgramBinariesAcrossPlatforms : public testing::TestWithParaminitializeGL(mOSWindow); if (result == false) { @@ -438,4 +438,4 @@ ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms, // TODO: ANGLE issue 523 // Compiling a program with client version 3, saving the binary, then loading it with client version 2 should not work // PlatformsWithLinkResult(ES3_D3D11(), ES2_D3D11(), false ) - ); \ No newline at end of file + ); diff --git a/src/tests/perf_tests/ANGLEPerfTest.cpp b/src/tests/perf_tests/ANGLEPerfTest.cpp index b38be746c..28b0ba00d 100644 --- a/src/tests/perf_tests/ANGLEPerfTest.cpp +++ b/src/tests/perf_tests/ANGLEPerfTest.cpp @@ -105,13 +105,10 @@ ANGLERenderTest::~ANGLERenderTest() void ANGLERenderTest::SetUp() { mOSWindow = CreateOSWindow(); - mEGLWindow = new EGLWindow(mTestParams.widowWidth, - mTestParams.windowHeight, - mTestParams.majorVersion, - mTestParams.eglParameters); + mEGLWindow = new EGLWindow(mTestParams.majorVersion, mTestParams.eglParameters); mEGLWindow->setSwapInterval(0); - if (!mOSWindow->initialize(mName, mEGLWindow->getWidth(), mEGLWindow->getHeight())) + if (!mOSWindow->initialize(mName, mTestParams.windowWidth, mTestParams.windowHeight)) { FAIL() << "Failed initializing OSWindow"; return; diff --git a/src/tests/perf_tests/ANGLEPerfTest.h b/src/tests/perf_tests/ANGLEPerfTest.h index a08933e18..dc1eff50a 100644 --- a/src/tests/perf_tests/ANGLEPerfTest.h +++ b/src/tests/perf_tests/ANGLEPerfTest.h @@ -60,7 +60,7 @@ struct RenderTestParams : public angle::PlatformParameters { virtual std::string suffix() const; - EGLint widowWidth; + EGLint windowWidth; EGLint windowHeight; }; diff --git a/src/tests/perf_tests/BufferSubData.cpp b/src/tests/perf_tests/BufferSubData.cpp index 7dcb91ff6..c141eda84 100644 --- a/src/tests/perf_tests/BufferSubData.cpp +++ b/src/tests/perf_tests/BufferSubData.cpp @@ -24,7 +24,7 @@ struct BufferSubDataParams final : public RenderTestParams // Common default values majorVersion = 2; minorVersion = 0; - widowWidth = 512; + windowWidth = 512; windowHeight = 512; updateSize = 3000; bufferSize = 40000000; diff --git a/src/tests/perf_tests/DrawCallPerf.cpp b/src/tests/perf_tests/DrawCallPerf.cpp index b7984fefc..8e4d95415 100644 --- a/src/tests/perf_tests/DrawCallPerf.cpp +++ b/src/tests/perf_tests/DrawCallPerf.cpp @@ -24,7 +24,7 @@ struct DrawCallPerfParams final : public RenderTestParams { majorVersion = 2; minorVersion = 0; - widowWidth = 256; + windowWidth = 256; windowHeight = 256; iterations = 50; numTris = 1; diff --git a/src/tests/perf_tests/IndexConversionPerf.cpp b/src/tests/perf_tests/IndexConversionPerf.cpp index 85ca9683f..514037434 100644 --- a/src/tests/perf_tests/IndexConversionPerf.cpp +++ b/src/tests/perf_tests/IndexConversionPerf.cpp @@ -185,7 +185,7 @@ IndexConversionPerfParams IndexConversionPerfD3D11Params() params.eglParameters = egl_platform::D3D11_NULL(); params.majorVersion = 2; params.minorVersion = 0; - params.widowWidth = 256; + params.windowWidth = 256; params.windowHeight = 256; params.iterations = 15; params.numIndexTris = 3000; diff --git a/src/tests/perf_tests/PointSprites.cpp b/src/tests/perf_tests/PointSprites.cpp index e69b2b82b..1e85f139f 100644 --- a/src/tests/perf_tests/PointSprites.cpp +++ b/src/tests/perf_tests/PointSprites.cpp @@ -27,7 +27,7 @@ struct PointSpritesParams final : public RenderTestParams // Common default params majorVersion = 2; minorVersion = 0; - widowWidth = 1280; + windowWidth = 1280; windowHeight = 720; iterations = 10; count = 10; diff --git a/src/tests/perf_tests/TexSubImage.cpp b/src/tests/perf_tests/TexSubImage.cpp index 5f595adf9..9f43f0a4a 100644 --- a/src/tests/perf_tests/TexSubImage.cpp +++ b/src/tests/perf_tests/TexSubImage.cpp @@ -24,7 +24,7 @@ struct TexSubImageParams final : public RenderTestParams // Common default parameters majorVersion = 2; minorVersion = 0; - widowWidth = 512; + windowWidth = 512; windowHeight = 512; imageWidth = 1024; diff --git a/src/tests/test_utils/ANGLETest.cpp b/src/tests/test_utils/ANGLETest.cpp index 5221a6ab0..2e6fdbd08 100644 --- a/src/tests/test_utils/ANGLETest.cpp +++ b/src/tests/test_utils/ANGLETest.cpp @@ -3,9 +3,11 @@ #include "OSWindow.h" ANGLETest::ANGLETest() - : mEGLWindow(nullptr) + : mEGLWindow(nullptr), + mWidth(0), + mHeight(0) { - mEGLWindow = new EGLWindow(1280, 720, GetParam().majorVersion, GetParam().eglParameters); + mEGLWindow = new EGLWindow(GetParam().majorVersion, GetParam().eglParameters); } ANGLETest::~ANGLETest() @@ -15,7 +17,7 @@ ANGLETest::~ANGLETest() void ANGLETest::SetUp() { - if (!ResizeWindow(mEGLWindow->getWidth(), mEGLWindow->getHeight())) + if (!ResizeWindow(mWidth, mHeight)) { FAIL() << "Failed to resize ANGLE test window."; } @@ -33,7 +35,7 @@ void ANGLETest::SetUp() // This Viewport command is not strictly necessary but we add it so that programs // taking OpenGL traces can guess the size of the default framebuffer and show it // in their UIs - glViewport(0, 0, mEGLWindow->getWidth(), mEGLWindow->getHeight()); + glViewport(0, 0, mWidth, mHeight); } void ANGLETest::TearDown() @@ -144,12 +146,12 @@ bool ANGLETest::eglClientExtensionEnabled(const std::string &extName) void ANGLETest::setWindowWidth(int width) { - mEGLWindow->setWidth(width); + mWidth = width; } void ANGLETest::setWindowHeight(int height) { - mEGLWindow->setHeight(height); + mHeight = height; } void ANGLETest::setConfigRedBits(int bits) @@ -199,12 +201,12 @@ EGLWindow *ANGLETest::getEGLWindow() const int ANGLETest::getWindowWidth() const { - return mEGLWindow->getWidth(); + return mWidth; } int ANGLETest::getWindowHeight() const { - return mEGLWindow->getHeight(); + return mHeight; } bool ANGLETest::isMultisampleEnabled() const diff --git a/src/tests/test_utils/ANGLETest.h b/src/tests/test_utils/ANGLETest.h index 5897670c5..675d556f7 100644 --- a/src/tests/test_utils/ANGLETest.h +++ b/src/tests/test_utils/ANGLETest.h @@ -109,6 +109,8 @@ class ANGLETest : public ::testing::TestWithParam bool destroyEGLContext(); EGLWindow *mEGLWindow; + size_t mWidth; + size_t mHeight; static OSWindow *mOSWindow; }; diff --git a/src/tests/test_utils/angle_test_instantiate.cpp b/src/tests/test_utils/angle_test_instantiate.cpp index 28092158d..3e6537515 100644 --- a/src/tests/test_utils/angle_test_instantiate.cpp +++ b/src/tests/test_utils/angle_test_instantiate.cpp @@ -63,7 +63,7 @@ bool IsPlatformAvailable(const PlatformParameters ¶m) if (result) { - EGLWindow *eglWindow = new EGLWindow(1, 1, param.majorVersion, param.eglParameters); + EGLWindow *eglWindow = new EGLWindow(param.majorVersion, param.eglParameters); result = eglWindow->initializeGL(osWindow); eglWindow->destroyGL(); diff --git a/util/EGLWindow.cpp b/util/EGLWindow.cpp index a7c34a3f7..278e82434 100644 --- a/util/EGLWindow.cpp +++ b/util/EGLWindow.cpp @@ -69,14 +69,12 @@ bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b) (a.deviceType == b.deviceType); } -EGLWindow::EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform) +EGLWindow::EGLWindow(EGLint glesMajorVersion, const EGLPlatformParameters &platform) : mDisplay(EGL_NO_DISPLAY), mSurface(EGL_NO_SURFACE), mContext(EGL_NO_CONTEXT), mClientVersion(glesMajorVersion), mPlatform(platform), - mWidth(width), - mHeight(height), mRedBits(-1), mGreenBits(-1), mBlueBits(-1), diff --git a/util/EGLWindow.h b/util/EGLWindow.h index 5da5993ec..30d0ecafc 100644 --- a/util/EGLWindow.h +++ b/util/EGLWindow.h @@ -50,13 +50,11 @@ bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b); class EGLWindow : angle::NonCopyable { public: - EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform); + EGLWindow(EGLint glesMajorVersion, const EGLPlatformParameters &platform); ~EGLWindow(); void setClientVersion(EGLint glesMajorVersion) { mClientVersion = glesMajorVersion; } - void setWidth(size_t width) { mWidth = width; } - void setHeight(size_t height) { mHeight = height; } void setConfigRedBits(int bits) { mRedBits = bits; } void setConfigGreenBits(int bits) { mGreenBits = bits; } void setConfigBlueBits(int bits) { mBlueBits = bits; } @@ -76,8 +74,6 @@ class EGLWindow : angle::NonCopyable EGLDisplay getDisplay() const; EGLSurface getSurface() const; EGLContext getContext() const; - size_t getWidth() const { return mWidth; } - size_t getHeight() const { return mHeight; } int getConfigRedBits() const { return mRedBits; } int getConfigGreenBits() const { return mGreenBits; } int getConfigBlueBits() const { return mBlueBits; } @@ -99,8 +95,6 @@ class EGLWindow : angle::NonCopyable EGLint mClientVersion; EGLPlatformParameters mPlatform; - size_t mWidth; - size_t mHeight; int mRedBits; int mGreenBits; int mBlueBits;