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
diff --git a/tests/angle_tests/ANGLETest.cpp b/tests/angle_tests/ANGLETest.cpp
index ecb9de9..b246b0c 100644
--- a/tests/angle_tests/ANGLETest.cpp
+++ b/tests/angle_tests/ANGLETest.cpp
@@ -1,16 +1,16 @@
#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 @@
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 @@
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 @@
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 @@
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;
}
diff --git a/tests/angle_tests/ANGLETest.h b/tests/angle_tests/ANGLETest.h
index 9441967..205fc3a 100644
--- a/tests/angle_tests/ANGLETest.h
+++ b/tests/angle_tests/ANGLETest.h
@@ -54,30 +54,31 @@
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();
diff --git a/tests/angle_tests/BlitFramebufferANGLETest.cpp b/tests/angle_tests/BlitFramebufferANGLETest.cpp
index cce73cc..c40a28b 100644
--- a/tests/angle_tests/BlitFramebufferANGLETest.cpp
+++ b/tests/angle_tests/BlitFramebufferANGLETest.cpp
@@ -7,11 +7,11 @@
{
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;
diff --git a/tests/angle_tests/ClearTest.cpp b/tests/angle_tests/ClearTest.cpp
index 5876f56..2f0f153 100644
--- a/tests/angle_tests/ClearTest.cpp
+++ b/tests/angle_tests/ClearTest.cpp
@@ -7,11 +7,11 @@
{
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()
diff --git a/tests/angle_tests/OcclusionQueriesTest.cpp b/tests/angle_tests/OcclusionQueriesTest.cpp
index b92e35a..137bcd2 100644
--- a/tests/angle_tests/OcclusionQueriesTest.cpp
+++ b/tests/angle_tests/OcclusionQueriesTest.cpp
@@ -7,11 +7,11 @@
{
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;
}
diff --git a/tests/angle_tests/UnpackAlignmentTest.cpp b/tests/angle_tests/UnpackAlignmentTest.cpp
index 996bc9a..69c8269 100644
--- a/tests/angle_tests/UnpackAlignmentTest.cpp
+++ b/tests/angle_tests/UnpackAlignmentTest.cpp
@@ -9,11 +9,11 @@
{
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;
}
diff --git a/tests/angle_tests/VertexAttributeTest.cpp b/tests/angle_tests/VertexAttributeTest.cpp
index ed52b14..3e17e01 100644
--- a/tests/angle_tests/VertexAttributeTest.cpp
+++ b/tests/angle_tests/VertexAttributeTest.cpp
@@ -7,11 +7,11 @@
{
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;