Commit f3357ee2 by Corentin Wallez

EGLWindow: remove the unused width and height

EGLWindow does nothing with it per se, but some code was relying on it to store it. Add width and height to ANGLETest and SampleApplication instead. Also fix a typo in PerfTestParams, widowWidth -> windowWidth. BUG=angleproject:1105 Change-Id: I26da607a2e6342864b508a50ee3cf8944608f868 Reviewed-on: https://chromium-review.googlesource.com/287379Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 0932df61
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
SampleApplication::SampleApplication(const std::string& name, size_t width, size_t height, SampleApplication::SampleApplication(const std::string& name, size_t width, size_t height,
EGLint glesMajorVersion, EGLint requestedRenderer) EGLint glesMajorVersion, EGLint requestedRenderer)
: mName(name), : mName(name),
mWidth(width),
mHeight(height),
mRunning(false) mRunning(false)
{ {
mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, EGLPlatformParameters(requestedRenderer))); mEGLWindow.reset(new EGLWindow(glesMajorVersion, EGLPlatformParameters(requestedRenderer)));
mTimer.reset(CreateTimer()); mTimer.reset(CreateTimer());
mOSWindow.reset(CreateOSWindow()); mOSWindow.reset(CreateOSWindow());
...@@ -80,7 +82,7 @@ EGLContext SampleApplication::getContext() const ...@@ -80,7 +82,7 @@ EGLContext SampleApplication::getContext() const
int SampleApplication::run() int SampleApplication::run()
{ {
if (!mOSWindow->initialize(mName, mEGLWindow->getWidth(), mEGLWindow->getHeight())) if (!mOSWindow->initialize(mName, mWidth, mHeight))
{ {
return -1; return -1;
} }
......
...@@ -48,6 +48,8 @@ class SampleApplication ...@@ -48,6 +48,8 @@ class SampleApplication
private: private:
std::string mName; std::string mName;
size_t mWidth;
size_t mHeight;
bool mRunning; bool mRunning;
std::unique_ptr<Timer> mTimer; std::unique_ptr<Timer> mTimer;
......
...@@ -130,7 +130,7 @@ TEST_P(PbufferTest, Clearing) ...@@ -130,7 +130,7 @@ TEST_P(PbufferTest, Clearing)
glClearColor(0.0f, 0.0f, 1.0f, 1.0f); glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
ASSERT_GL_NO_ERROR(); 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 // Apply the Pbuffer and clear it to purple and verify
eglMakeCurrent(window->getDisplay(), mPbuffer, mPbuffer, window->getContext()); eglMakeCurrent(window->getDisplay(), mPbuffer, mPbuffer, window->getContext());
...@@ -145,7 +145,7 @@ TEST_P(PbufferTest, Clearing) ...@@ -145,7 +145,7 @@ TEST_P(PbufferTest, Clearing)
// Rebind the window surface and verify that it is still blue // Rebind the window surface and verify that it is still blue
eglMakeCurrent(window->getDisplay(), window->getSurface(), window->getSurface(), window->getContext()); eglMakeCurrent(window->getDisplay(), window->getSurface(), window->getSurface(), window->getContext());
ASSERT_EGL_SUCCESS(); 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 // Bind the Pbuffer to a texture and verify it renders correctly
...@@ -190,7 +190,7 @@ TEST_P(PbufferTest, BindTexImage) ...@@ -190,7 +190,7 @@ TEST_P(PbufferTest, BindTexImage)
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
eglBindTexImage(window->getDisplay(), mPbuffer, EGL_BACK_BUFFER); eglBindTexImage(window->getDisplay(), mPbuffer, EGL_BACK_BUFFER);
glViewport(0, 0, window->getWidth(), window->getHeight()); glViewport(0, 0, getWindowWidth(), getWindowHeight());
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
// Draw a quad and verify that it is purple // Draw a quad and verify that it is purple
...@@ -205,7 +205,7 @@ TEST_P(PbufferTest, BindTexImage) ...@@ -205,7 +205,7 @@ TEST_P(PbufferTest, BindTexImage)
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
// Verify that purple was drawn // 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); glDeleteTextures(1, &texture);
} }
...@@ -308,13 +308,13 @@ TEST_P(PbufferTest, BindTexImageAndRedefineTexture) ...@@ -308,13 +308,13 @@ TEST_P(PbufferTest, BindTexImageAndRedefineTexture)
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
eglBindTexImage(window->getDisplay(), mPbuffer, EGL_BACK_BUFFER); eglBindTexImage(window->getDisplay(), mPbuffer, EGL_BACK_BUFFER);
glViewport(0, 0, window->getWidth(), window->getHeight()); glViewport(0, 0, getWindowWidth(), getWindowHeight());
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
// Redefine the texture // Redefine the texture
unsigned int pixelValue = 0xFFFF00FF; unsigned int pixelValue = 0xFFFF00FF;
std::vector<unsigned int> pixelData(window->getWidth() * window->getHeight(), pixelValue); std::vector<unsigned int> pixelData(getWindowWidth() * getWindowHeight(), pixelValue);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, window->getWidth(), window->getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixelData[0]); 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 // Draw a quad and verify that it is magenta
glUseProgram(mTextureProgram); glUseProgram(mTextureProgram);
...@@ -324,7 +324,7 @@ TEST_P(PbufferTest, BindTexImageAndRedefineTexture) ...@@ -324,7 +324,7 @@ TEST_P(PbufferTest, BindTexImageAndRedefineTexture)
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Verify that magenta was drawn // 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); glDeleteTextures(1, &texture);
} }
......
...@@ -200,7 +200,7 @@ class ProgramBinariesAcrossPlatforms : public testing::TestWithParam<PlatformsWi ...@@ -200,7 +200,7 @@ class ProgramBinariesAcrossPlatforms : public testing::TestWithParam<PlatformsWi
EGLWindow *createAndInitEGLWindow(angle::PlatformParameters &param) EGLWindow *createAndInitEGLWindow(angle::PlatformParameters &param)
{ {
EGLWindow *eglWindow = new EGLWindow(1, 1, param.majorVersion, param.eglParameters); EGLWindow *eglWindow = new EGLWindow(param.majorVersion, param.eglParameters);
bool result = eglWindow->initializeGL(mOSWindow); bool result = eglWindow->initializeGL(mOSWindow);
if (result == false) if (result == false)
{ {
...@@ -438,4 +438,4 @@ ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms, ...@@ -438,4 +438,4 @@ ANGLE_INSTANTIATE_TEST(ProgramBinariesAcrossPlatforms,
// TODO: ANGLE issue 523 // TODO: ANGLE issue 523
// Compiling a program with client version 3, saving the binary, then loading it with client version 2 should not work // 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 ) // PlatformsWithLinkResult(ES3_D3D11(), ES2_D3D11(), false )
); );
\ No newline at end of file
...@@ -105,13 +105,10 @@ ANGLERenderTest::~ANGLERenderTest() ...@@ -105,13 +105,10 @@ ANGLERenderTest::~ANGLERenderTest()
void ANGLERenderTest::SetUp() void ANGLERenderTest::SetUp()
{ {
mOSWindow = CreateOSWindow(); mOSWindow = CreateOSWindow();
mEGLWindow = new EGLWindow(mTestParams.widowWidth, mEGLWindow = new EGLWindow(mTestParams.majorVersion, mTestParams.eglParameters);
mTestParams.windowHeight,
mTestParams.majorVersion,
mTestParams.eglParameters);
mEGLWindow->setSwapInterval(0); mEGLWindow->setSwapInterval(0);
if (!mOSWindow->initialize(mName, mEGLWindow->getWidth(), mEGLWindow->getHeight())) if (!mOSWindow->initialize(mName, mTestParams.windowWidth, mTestParams.windowHeight))
{ {
FAIL() << "Failed initializing OSWindow"; FAIL() << "Failed initializing OSWindow";
return; return;
......
...@@ -60,7 +60,7 @@ struct RenderTestParams : public angle::PlatformParameters ...@@ -60,7 +60,7 @@ struct RenderTestParams : public angle::PlatformParameters
{ {
virtual std::string suffix() const; virtual std::string suffix() const;
EGLint widowWidth; EGLint windowWidth;
EGLint windowHeight; EGLint windowHeight;
}; };
......
...@@ -24,7 +24,7 @@ struct BufferSubDataParams final : public RenderTestParams ...@@ -24,7 +24,7 @@ struct BufferSubDataParams final : public RenderTestParams
// Common default values // Common default values
majorVersion = 2; majorVersion = 2;
minorVersion = 0; minorVersion = 0;
widowWidth = 512; windowWidth = 512;
windowHeight = 512; windowHeight = 512;
updateSize = 3000; updateSize = 3000;
bufferSize = 40000000; bufferSize = 40000000;
......
...@@ -24,7 +24,7 @@ struct DrawCallPerfParams final : public RenderTestParams ...@@ -24,7 +24,7 @@ struct DrawCallPerfParams final : public RenderTestParams
{ {
majorVersion = 2; majorVersion = 2;
minorVersion = 0; minorVersion = 0;
widowWidth = 256; windowWidth = 256;
windowHeight = 256; windowHeight = 256;
iterations = 50; iterations = 50;
numTris = 1; numTris = 1;
......
...@@ -185,7 +185,7 @@ IndexConversionPerfParams IndexConversionPerfD3D11Params() ...@@ -185,7 +185,7 @@ IndexConversionPerfParams IndexConversionPerfD3D11Params()
params.eglParameters = egl_platform::D3D11_NULL(); params.eglParameters = egl_platform::D3D11_NULL();
params.majorVersion = 2; params.majorVersion = 2;
params.minorVersion = 0; params.minorVersion = 0;
params.widowWidth = 256; params.windowWidth = 256;
params.windowHeight = 256; params.windowHeight = 256;
params.iterations = 15; params.iterations = 15;
params.numIndexTris = 3000; params.numIndexTris = 3000;
......
...@@ -27,7 +27,7 @@ struct PointSpritesParams final : public RenderTestParams ...@@ -27,7 +27,7 @@ struct PointSpritesParams final : public RenderTestParams
// Common default params // Common default params
majorVersion = 2; majorVersion = 2;
minorVersion = 0; minorVersion = 0;
widowWidth = 1280; windowWidth = 1280;
windowHeight = 720; windowHeight = 720;
iterations = 10; iterations = 10;
count = 10; count = 10;
......
...@@ -24,7 +24,7 @@ struct TexSubImageParams final : public RenderTestParams ...@@ -24,7 +24,7 @@ struct TexSubImageParams final : public RenderTestParams
// Common default parameters // Common default parameters
majorVersion = 2; majorVersion = 2;
minorVersion = 0; minorVersion = 0;
widowWidth = 512; windowWidth = 512;
windowHeight = 512; windowHeight = 512;
imageWidth = 1024; imageWidth = 1024;
......
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
#include "OSWindow.h" #include "OSWindow.h"
ANGLETest::ANGLETest() 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() ANGLETest::~ANGLETest()
...@@ -15,7 +17,7 @@ ANGLETest::~ANGLETest() ...@@ -15,7 +17,7 @@ ANGLETest::~ANGLETest()
void ANGLETest::SetUp() void ANGLETest::SetUp()
{ {
if (!ResizeWindow(mEGLWindow->getWidth(), mEGLWindow->getHeight())) if (!ResizeWindow(mWidth, mHeight))
{ {
FAIL() << "Failed to resize ANGLE test window."; FAIL() << "Failed to resize ANGLE test window.";
} }
...@@ -33,7 +35,7 @@ void ANGLETest::SetUp() ...@@ -33,7 +35,7 @@ void ANGLETest::SetUp()
// This Viewport command is not strictly necessary but we add it so that programs // 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 // taking OpenGL traces can guess the size of the default framebuffer and show it
// in their UIs // in their UIs
glViewport(0, 0, mEGLWindow->getWidth(), mEGLWindow->getHeight()); glViewport(0, 0, mWidth, mHeight);
} }
void ANGLETest::TearDown() void ANGLETest::TearDown()
...@@ -144,12 +146,12 @@ bool ANGLETest::eglClientExtensionEnabled(const std::string &extName) ...@@ -144,12 +146,12 @@ bool ANGLETest::eglClientExtensionEnabled(const std::string &extName)
void ANGLETest::setWindowWidth(int width) void ANGLETest::setWindowWidth(int width)
{ {
mEGLWindow->setWidth(width); mWidth = width;
} }
void ANGLETest::setWindowHeight(int height) void ANGLETest::setWindowHeight(int height)
{ {
mEGLWindow->setHeight(height); mHeight = height;
} }
void ANGLETest::setConfigRedBits(int bits) void ANGLETest::setConfigRedBits(int bits)
...@@ -199,12 +201,12 @@ EGLWindow *ANGLETest::getEGLWindow() const ...@@ -199,12 +201,12 @@ EGLWindow *ANGLETest::getEGLWindow() const
int ANGLETest::getWindowWidth() const int ANGLETest::getWindowWidth() const
{ {
return mEGLWindow->getWidth(); return mWidth;
} }
int ANGLETest::getWindowHeight() const int ANGLETest::getWindowHeight() const
{ {
return mEGLWindow->getHeight(); return mHeight;
} }
bool ANGLETest::isMultisampleEnabled() const bool ANGLETest::isMultisampleEnabled() const
......
...@@ -109,6 +109,8 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters> ...@@ -109,6 +109,8 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
bool destroyEGLContext(); bool destroyEGLContext();
EGLWindow *mEGLWindow; EGLWindow *mEGLWindow;
size_t mWidth;
size_t mHeight;
static OSWindow *mOSWindow; static OSWindow *mOSWindow;
}; };
......
...@@ -63,7 +63,7 @@ bool IsPlatformAvailable(const PlatformParameters &param) ...@@ -63,7 +63,7 @@ bool IsPlatformAvailable(const PlatformParameters &param)
if (result) if (result)
{ {
EGLWindow *eglWindow = new EGLWindow(1, 1, param.majorVersion, param.eglParameters); EGLWindow *eglWindow = new EGLWindow(param.majorVersion, param.eglParameters);
result = eglWindow->initializeGL(osWindow); result = eglWindow->initializeGL(osWindow);
eglWindow->destroyGL(); eglWindow->destroyGL();
......
...@@ -69,14 +69,12 @@ bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b) ...@@ -69,14 +69,12 @@ bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b)
(a.deviceType == b.deviceType); (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), : mDisplay(EGL_NO_DISPLAY),
mSurface(EGL_NO_SURFACE), mSurface(EGL_NO_SURFACE),
mContext(EGL_NO_CONTEXT), mContext(EGL_NO_CONTEXT),
mClientVersion(glesMajorVersion), mClientVersion(glesMajorVersion),
mPlatform(platform), mPlatform(platform),
mWidth(width),
mHeight(height),
mRedBits(-1), mRedBits(-1),
mGreenBits(-1), mGreenBits(-1),
mBlueBits(-1), mBlueBits(-1),
......
...@@ -50,13 +50,11 @@ bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b); ...@@ -50,13 +50,11 @@ bool operator==(const EGLPlatformParameters &a, const EGLPlatformParameters &b);
class EGLWindow : angle::NonCopyable class EGLWindow : angle::NonCopyable
{ {
public: public:
EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform); EGLWindow(EGLint glesMajorVersion, const EGLPlatformParameters &platform);
~EGLWindow(); ~EGLWindow();
void setClientVersion(EGLint glesMajorVersion) { mClientVersion = glesMajorVersion; } 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 setConfigRedBits(int bits) { mRedBits = bits; }
void setConfigGreenBits(int bits) { mGreenBits = bits; } void setConfigGreenBits(int bits) { mGreenBits = bits; }
void setConfigBlueBits(int bits) { mBlueBits = bits; } void setConfigBlueBits(int bits) { mBlueBits = bits; }
...@@ -76,8 +74,6 @@ class EGLWindow : angle::NonCopyable ...@@ -76,8 +74,6 @@ class EGLWindow : angle::NonCopyable
EGLDisplay getDisplay() const; EGLDisplay getDisplay() const;
EGLSurface getSurface() const; EGLSurface getSurface() const;
EGLContext getContext() const; EGLContext getContext() const;
size_t getWidth() const { return mWidth; }
size_t getHeight() const { return mHeight; }
int getConfigRedBits() const { return mRedBits; } int getConfigRedBits() const { return mRedBits; }
int getConfigGreenBits() const { return mGreenBits; } int getConfigGreenBits() const { return mGreenBits; }
int getConfigBlueBits() const { return mBlueBits; } int getConfigBlueBits() const { return mBlueBits; }
...@@ -99,8 +95,6 @@ class EGLWindow : angle::NonCopyable ...@@ -99,8 +95,6 @@ class EGLWindow : angle::NonCopyable
EGLint mClientVersion; EGLint mClientVersion;
EGLPlatformParameters mPlatform; EGLPlatformParameters mPlatform;
size_t mWidth;
size_t mHeight;
int mRedBits; int mRedBits;
int mGreenBits; int mGreenBits;
int mBlueBits; int mBlueBits;
......
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