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/287379
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2015-07-22 14:10:19 -04:00
Родитель 0932df6158
Коммит f3357ee2ba
16 изменённых файлов: 39 добавлений и 42 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -48,6 +48,8 @@ class SampleApplication
private:
std::string mName;
size_t mWidth;
size_t mHeight;
bool mRunning;
std::unique_ptr<Timer> mTimer;

Просмотреть файл

@ -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<unsigned int> 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<unsigned int> 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);
}

Просмотреть файл

@ -200,7 +200,7 @@ class ProgramBinariesAcrossPlatforms : public testing::TestWithParam<PlatformsWi
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);
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 )
);
);

Просмотреть файл

@ -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;

Просмотреть файл

@ -60,7 +60,7 @@ struct RenderTestParams : public angle::PlatformParameters
{
virtual std::string suffix() const;
EGLint widowWidth;
EGLint windowWidth;
EGLint windowHeight;
};

Просмотреть файл

@ -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;

Просмотреть файл

@ -24,7 +24,7 @@ struct DrawCallPerfParams final : public RenderTestParams
{
majorVersion = 2;
minorVersion = 0;
widowWidth = 256;
windowWidth = 256;
windowHeight = 256;
iterations = 50;
numTris = 1;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -24,7 +24,7 @@ struct TexSubImageParams final : public RenderTestParams
// Common default parameters
majorVersion = 2;
minorVersion = 0;
widowWidth = 512;
windowWidth = 512;
windowHeight = 512;
imageWidth = 1024;

Просмотреть файл

@ -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

Просмотреть файл

@ -109,6 +109,8 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
bool destroyEGLContext();
EGLWindow *mEGLWindow;
size_t mWidth;
size_t mHeight;
static OSWindow *mOSWindow;
};

Просмотреть файл

@ -63,7 +63,7 @@ bool IsPlatformAvailable(const PlatformParameters &param)
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();

Просмотреть файл

@ -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),

Просмотреть файл

@ -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;