Commit efc551f0 by Geoff Lang

Fix incorrectly named test class members and wrong shader compilation

function being used. TRAC #23776 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods
parent d5ee05cc
#include "ANGLETest.h"
ANGLETest::ANGLETest()
: mClientVersion(2)
, mWidth(1280)
, mHeight(720)
, mRedBits(-1)
, mGreenBits(-1)
, mBlueBits(-1)
, mAlphaBits(-1)
, mDepthBits(-1)
, mStencilBits(-1)
, mMultisample(false)
: mClientVersion(2),
mWidth(1280),
mHeight(720),
mRedBits(-1),
mGreenBits(-1),
mBlueBits(-1),
mAlphaBits(-1),
mDepthBits(-1),
mStencilBits(-1),
mMultisample(false)
{
}
......@@ -69,21 +69,52 @@ void ANGLETest::drawQuad(GLuint program, const std::string& positionAttribName,
glUseProgram(0);
}
GLuint ANGLETest::compileShader(GLenum type, const std::string &source)
{
GLuint shader = glCreateShader(type);
const char *sourceArray[1] = { source.c_str() };
glShaderSource(shader, 1, sourceArray, NULL);
glCompileShader(shader);
GLint compileResult;
glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);
if (compileResult == 0)
{
GLint infoLogLength;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
std::vector<GLchar> infoLog(infoLogLength);
glGetShaderInfoLog(shader, infoLog.size(), NULL, infoLog.data());
std::cerr << "shader compilation failed: " << infoLog.data();
glDeleteShader(shader);
shader = 0;
}
return shader;
}
GLuint ANGLETest::compileProgram(const std::string &vsSource, const std::string &fsSource)
{
GLuint program = glCreateProgram();
GLuint vs = glCreateShader(GL_VERTEX_SHADER);
const char *vsSourceArray[1] = { vsSource.c_str() };
glShaderSource(vs, 1, vsSourceArray, NULL);
glCompileShader(vs);
GLuint vs = compileShader(GL_VERTEX_SHADER, vsSource);
GLuint fs = compileShader(GL_FRAGMENT_SHADER, fsSource);
if (vs == 0 || fs == 0)
{
glDeleteShader(fs);
glDeleteShader(vs);
glDeleteProgram(program);
return 0;
}
glAttachShader(program, vs);
glDeleteShader(vs);
GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
const char *fsSourceArray[1] = { fsSource.c_str() };
glShaderSource(fs, 1, fsSourceArray, NULL);
glCompileShader(fs);
glAttachShader(program, fs);
glDeleteShader(fs);
......@@ -92,10 +123,18 @@ GLuint ANGLETest::compileProgram(const std::string &vsSource, const std::string
GLint linkStatus;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
if (!linkStatus)
if (linkStatus == 0)
{
GLint infoLogLength;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength);
std::vector<GLchar> infoLog(infoLogLength);
glGetProgramInfoLog(program, infoLog.size(), NULL, infoLog.data());
std::cerr << "program link failed: " << infoLog.data();
glDeleteProgram(program);
program = 0;
return 0;
}
return program;
......@@ -122,32 +161,32 @@ void ANGLETest::setWindowHeight(int height)
mHeight = height;
}
void ANGLETest::setRedBits(int bits)
void ANGLETest::setConfigRedBits(int bits)
{
mRedBits = bits;
}
void ANGLETest::setGreenBits(int bits)
void ANGLETest::setConfigGreenBits(int bits)
{
mGreenBits = bits;
}
void ANGLETest::setBlueBits(int bits)
void ANGLETest::setConfigBlueBits(int bits)
{
mBlueBits = bits;
}
void ANGLETest::setAlphaBits(int bits)
void ANGLETest::setConfigAlphaBits(int bits)
{
mAlphaBits = bits;
}
void ANGLETest::setDepthBits(int bits)
void ANGLETest::setConfigDepthBits(int bits)
{
mDepthBits = bits;
}
void ANGLETest::setStencilBits(int bits)
void ANGLETest::setConfigStencilBits(int bits)
{
mStencilBits = bits;
}
......@@ -172,37 +211,37 @@ int ANGLETest::getWindowHeight() const
return mHeight;
}
int ANGLETest::getRedBits() const
int ANGLETest::getConfigRedBits() const
{
return mRedBits;
}
int ANGLETest::getGreenBits() const
int ANGLETest::getConfigGreenBits() const
{
return mGreenBits;
}
int ANGLETest::getBlueBits() const
int ANGLETest::getConfigBlueBits() const
{
return mBlueBits;
}
int ANGLETest::getAlphaBits() const
int ANGLETest::getConfigAlphaBits() const
{
return mAlphaBits;
}
int ANGLETest::getDepthBits() const
int ANGLETest::getConfigDepthBits() const
{
return mDepthBits;
}
int ANGLETest::getStencilBits() const
int ANGLETest::getConfigStencilBits() const
{
return mStencilBits;
}
bool ANGLETest::multisampleEnabled() const
bool ANGLETest::isMultisampleEnabled() const
{
return mMultisample;
}
......
......@@ -54,30 +54,31 @@ class ANGLETest : public testing::Test
virtual void swapBuffers();
static void drawQuad(GLuint program, const std::string& positionAttribName, GLfloat quadDepth);
static GLuint compileShader(GLenum type, const std::string &source);
static GLuint compileProgram(const std::string &vsSource, const std::string &fsSource);
static bool extensionEnabled(const std::string &extName);
void setClientVersion(int clientVersion);
void setWindowWidth(int width);
void setWindowHeight(int height);
void setRedBits(int bits);
void setGreenBits(int bits);
void setBlueBits(int bits);
void setAlphaBits(int bits);
void setDepthBits(int bits);
void setStencilBits(int bits);
void setConfigRedBits(int bits);
void setConfigGreenBits(int bits);
void setConfigBlueBits(int bits);
void setConfigAlphaBits(int bits);
void setConfigDepthBits(int bits);
void setConfigStencilBits(int bits);
void setMultisampleEnabled(bool enabled);
int getClientVersion() const;
int getWindowWidth() const;
int getWindowHeight() const;
int getRedBits() const;
int getGreenBits() const;
int getBlueBits() const;
int getAlphaBits() const;
int getDepthBits() const;
int getStencilBits() const;
bool multisampleEnabled() const;
int getConfigRedBits() const;
int getConfigGreenBits() const;
int getConfigBlueBits() const;
int getConfigAlphaBits() const;
int getConfigDepthBits() const;
int getConfigStencilBits() const;
bool isMultisampleEnabled() const;
private:
bool createEGLContext();
......
......@@ -7,11 +7,11 @@ protected:
{
setWindowWidth(256);
setWindowHeight(256);
setRedBits(8);
setGreenBits(8);
setBlueBits(8);
setAlphaBits(8);
setDepthBits(24);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
mCheckerProgram = 0;
mBlueProgram = 0;
......
......@@ -7,11 +7,11 @@ protected:
{
setWindowWidth(128);
setWindowHeight(128);
setRedBits(8);
setGreenBits(8);
setBlueBits(8);
setAlphaBits(8);
setDepthBits(24);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
}
virtual void SetUp()
......
......@@ -7,11 +7,11 @@ protected:
{
setWindowWidth(128);
setWindowHeight(128);
setRedBits(8);
setGreenBits(8);
setBlueBits(8);
setAlphaBits(8);
setDepthBits(24);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
mProgram = 0;
}
......
......@@ -9,11 +9,11 @@ protected:
{
setWindowWidth(128);
setWindowHeight(128);
setRedBits(8);
setGreenBits(8);
setBlueBits(8);
setAlphaBits(8);
setDepthBits(24);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
mProgram = 0;
}
......
......@@ -7,11 +7,11 @@ protected:
{
setWindowWidth(128);
setWindowHeight(128);
setRedBits(8);
setGreenBits(8);
setBlueBits(8);
setAlphaBits(8);
setDepthBits(24);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
mProgram = 0;
mTestAttrib = -1;
......
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