Commit 1059cb67 authored by Eric Anholt's avatar Eric Anholt

Update glean tests to 19f0f8e67a62d879216e75c756bed905019453c3

parent 9a6cb4b2
......@@ -179,6 +179,61 @@ template<class T> inline T abs(T a) {return (a < 0)? -a: a;}
namespace GLEAN {
// init all config fields to zero
void
DrawingSurfaceConfig::zeroFields()
{
#if defined(__X11__)
visID = 0;
# if defined(GLX_VERSION_1_3)
fbcID = 0;
# endif
#elif defined(__WIN__)
pfdID = 0;
#elif defined(__AGL__)
pfID = 0;
#else
# error "what's the config ID?"
#endif
canRGBA = 0;
canCI = 0;
bufSize = 0;
level = 0;
db = 0;
stereo = 0;
aux = 0;
r = 0;
g = 0;
b = 0;
a = 0;
z = 0;
s = 0;
accR = 0;
accG = 0;
accB = 0;
accA = 0;
samples = 0;
canWindow = 0;
#if defined(__X11__)
canPixmap = 0;
#if defined(GLX_VERSION_1_3)
canPBuffer = 0;
maxPBufferWidth = 0;
maxPBufferHeight = 0;
maxPBufferPixels = 0;
#endif
#endif
canWinSysRender = 0;
fast = 0;
conformant = 0;
transparent = 0;
transR = 0;
transG = 0;
transB = 0;
transA = 0;
transI = 0;
}
#if defined(__X11__)
......@@ -486,6 +541,8 @@ DrawingSurfaceConfig::DrawingSurfaceConfig(string& str) {
if (!mapsInitialized)
initializeMaps();
zeroFields();
try {
Lex lex(str.c_str());
......@@ -905,4 +962,64 @@ DrawingSurfaceConfig::match(vector<DrawingSurfaceConfig*>& choices) {
return best;
} // DrawingSurfaceConfig::match
// are two surface configs exactly the same?
bool
DrawingSurfaceConfig::equal(const DrawingSurfaceConfig &config) const
{
if (
#if defined(__X11__)
visID == config.visID &&
# if defined(GLX_VERSION_1_3)
fbcID == config.fbcID &&
# endif
#elif defined(__WIN__)
pfdID == config.pfdID &&
#elif defined(__AGL__)
pfID == config.pfID &&
#else
# error "what's the config ID?"
#endif
canRGBA == config.canRGBA &&
canCI == config.canCI &&
bufSize == config.bufSize &&
level == config.level &&
db == config.db &&
stereo == config.stereo &&
aux == config.aux &&
r == config.r &&
g == config.g &&
b == config.b &&
a == config.a &&
z == config.z &&
s == config.s &&
accR == config.accR &&
accG == config.accG &&
accB == config.accB &&
accA == config.accA &&
samples == config.samples &&
canWindow == config.canWindow &&
#if defined(__X11__)
canPixmap == config.canPixmap &&
#if defined(GLX_VERSION_1_3)
canPBuffer == config.canPBuffer &&
maxPBufferWidth == config.maxPBufferWidth &&
maxPBufferHeight == config.maxPBufferHeight &&
maxPBufferPixels == config.maxPBufferPixels &&
#endif
#endif
canWinSysRender == config.canWinSysRender &&
fast == config.fast &&
conformant == config.conformant &&
transparent == config.transparent &&
transR == config.transR &&
transG == config.transG &&
transB == config.transB &&
transA == config.transA &&
transI == config.transI
)
return true;
else
return false;
}
} // namespace GLEAN
......@@ -186,6 +186,8 @@ class DrawingSurfaceConfig {
// Utilities:
void zeroFields();
string canonicalDescription();
// Return a string containing all the attributes in a
// drawing surface configuration. This allows the config
......@@ -208,6 +210,8 @@ class DrawingSurfaceConfig {
// machine may be compared with test results for
// configs on another machine.
bool equal(const DrawingSurfaceConfig &config) const;
}; // class DrawingSurfaceConfig
} // namespace GLEAN
......
This diff is collapsed.
......@@ -84,6 +84,7 @@ factorToName(GLenum factor) {
for (unsigned int i = 0; i < ELEMENTS(factorNames); ++i)
if (factorNames[i].token == factor)
return factorNames[i].name;
assert(0);
return 0;
} // factorToName
......@@ -92,6 +93,7 @@ nameToFactor(string& name) {
for (unsigned int i = 0; i < ELEMENTS(factorNames); ++i)
if (factorNames[i].name == name)
return factorNames[i].token;
assert(0);
return GL_ZERO;
} // nameToFactor
......@@ -100,6 +102,7 @@ opToName(GLenum op) {
for (unsigned int i = 0; i < ELEMENTS(blendopNames); ++i)
if (blendopNames[i].token == op)
return blendopNames[i].name;
assert(0);
return 0;
} // opToName
......@@ -108,6 +111,7 @@ nameToOp(string& name) {
for (unsigned int i = 0; i < ELEMENTS(blendopNames); ++i)
if (blendopNames[i].name == name)
return blendopNames[i].token;
assert(0);
return GL_ZERO;
} // nameToOp
......@@ -981,7 +985,9 @@ BlendFuncTest::compareOne(BlendFuncResult& oldR, BlendFuncResult& newR) {
///////////////////////////////////////////////////////////////////////////////
void
BlendFuncResult::putresults(ostream& s) const {
// write number of lines first
s << results.size() << '\n';
// write each result as one line of text
for (vector<PartialResult>::const_iterator p = results.begin();
p != results.end(); ++p)
s << factorToName(p->srcRGB) << ' '
......@@ -996,7 +1002,9 @@ BlendFuncResult::putresults(ostream& s) const {
bool
BlendFuncResult::getresults(istream& s) {
int n;
// read number of lines
s >> n;
// parse each line/result
for (int i = 0; i < n; ++i) {
PartialResult p;
string srcRGB, srcA;
......@@ -1005,10 +1013,10 @@ BlendFuncResult::getresults(istream& s) {
s >> srcRGB >> srcA >> dstRGB >> dstA >> opRGB >> opA >> p.rbErr >> p.blErr;
p.srcRGB = nameToFactor(srcRGB);
p.srcA = nameToFactor(srcA);
p.srcRGB = nameToFactor(srcRGB);
p.dstRGB = nameToFactor(dstRGB);
p.dstA = nameToFactor(dstA);
p.opRGB = nameToFactor(opRGB);
p.opA = nameToFactor(opA);
p.opRGB = nameToOp(opRGB);
p.opA = nameToOp(opA);
results.push_back(p);
}
......
......@@ -605,6 +605,39 @@ static const ShaderProgram Programs[] = {
FLAG_NONE
},
{
// This test is interesting for sqrt(0) which may be
// implemented as 1/rsqrt(x) which would generate Inf values
"sqrt(vec4) function",
NO_VERTEX_SHADER,
"uniform vec4 uniform1; \n"
"void main() { \n"
" vec4 u = vec4(0.0, 0.09, 0.25, 1.0); \n"
" u = u * uniform1.xxxx; // mul by 1.0 \n"
" u = sqrt(u); \n"
" gl_FragColor = u; \n"
"} \n",
{ 0.0, 0.3, 0.5, 1.0 },
DONT_CARE_Z,
FLAG_NONE
},
{
"sqrt(vec2) function",
NO_VERTEX_SHADER,
"uniform vec4 uniform1; \n"
"void main() { \n"
" vec2 u = vec2(0.0, 0.04); \n"
" u = u * uniform1.xx; // mul by 1.0 \n"
" u = sqrt(u); \n"
" u = u * uniform1.xx; // mul by 1.0 \n"
" gl_FragColor = vec4(u.x, u.y, 0.0, 0.0); \n"
"} \n",
{ 0.0, 0.2, 0.0, 0.0 },
DONT_CARE_Z,
FLAG_NONE
},
{
"clamp() function",
NO_VERTEX_SHADER,
......@@ -960,6 +993,41 @@ static const ShaderProgram Programs[] = {
FLAG_NONE
},
// Floating Point Precision ==========================================
{
"precision exp2",
NO_VERTEX_SHADER,
"uniform vec4 uniform1; \n"
"void main() { \n"
" vec4 vals = vec4(-0.999992, -0.988281, -0.535149, -0.496090); \n"
" vals *= uniform1.xxxx; // multply by one \n"
" vec4 actual = exp2(vals); \n"
" vec4 expected = vec4(0.500003, 0.504078, 0.690087, 0.709026); \n"
" vec4 error = abs((actual - expected) / expected); \n"
" gl_FragColor = vec4(lessThan(error, vec4(1e-04))); \n"
"} \n",
{ 1.0, 1.0, 1.0, 1.0 },
DONT_CARE_Z,
FLAG_NONE
},
{
"precision log2",
NO_VERTEX_SHADER,
"uniform vec4 uniform1; \n"
"void main() { \n"
" vec4 vals = vec4(0.125096, 0.250265, 0.500301, 2.001205); \n"
" vals *= uniform1.xxxx; // multiply by one \n"
" vec4 actual = log2(vals); \n"
" vec4 expected = vec4(-2.998889, -1.998471, -0.999131, 1.000869); \n"
" vec4 error = abs(actual - expected); \n"
" gl_FragColor = vec4(lessThan(error, vec4(1e-05))); \n"
"} \n",
{ 1.0, 1.0, 1.0, 1.0 },
DONT_CARE_Z,
FLAG_NONE
},
// Flow Control ======================================================
{
"simple if statement, fragment shader",
......
......@@ -68,6 +68,20 @@ static PFNGLGETQUERYOBJECTIVARBPROC glGetQueryObjectivARB_func = NULL;
static PFNGLGETQUERYOBJECTUIVARBPROC glGetQueryObjectuivARB_func = NULL;
void
OccluQryTest::reportError(const char *msg)
{
env->log << name << ": Error: " << msg << "\n";
}
void
OccluQryTest::reportWarning(const char *msg)
{
env->log << name << ": Warning: " << msg << "\n";
}
/* Generate a box which will be occluded by the occluder */
void OccluQryTest::gen_box(GLfloat left, GLfloat right,
GLfloat top, GLfloat btm)
......@@ -86,7 +100,7 @@ bool OccluQryTest::chk_ext()
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
if (!strstr(ext, "GL_ARB_occlusion_query")) {
fprintf(stdout, "W: Extension GL_ARB_occlusion_query is missing.\n");
reportWarning("Extension GL_ARB_occlusion_query is missing.");
return false;
}
......@@ -133,9 +147,10 @@ GLuint OccluQryTest::find_unused_id()
if (id != 0 && glIsQueryARB_func(id) == GL_FALSE)
return id;
if (++ counter >= MAX_FIND_ID_ROUND) {
fprintf(stderr,
"W: Cannot find the unused id after [%d] tries.\n",
MAX_FIND_ID_ROUND);
char str[1000];
sprintf(str, "Cannot find the unused id after [%d] tries.",
MAX_FIND_ID_ROUND);
reportWarning(str);
return 0;
}
}
......@@ -334,7 +349,7 @@ bool OccluQryTest::conformOQ_Begin_unused_id()
glBeginQuery_func(GL_SAMPLES_PASSED_ARB, id);
if (glIsQueryARB_func(id) == GL_FALSE) {
fprintf(stderr, "F: Begin with a unused id failed.\n");
reportError("Begin with a unused id failed.");
pass = false;
}
......@@ -353,8 +368,8 @@ bool OccluQryTest::conformOQ_EndAfter(GLuint id)
glEndQueryARB_func(GL_SAMPLES_PASSED_ARB);
if (glGetError() != GL_INVALID_OPERATION) {
fprintf(stderr, "F: No GL_INVALID_OPERATION generated if "
"EndQuery when there is no queries.\n");
reportError("No GL_INVALID_OPERATION generated if "
"EndQuery when there is no queries.");
return false;
}
......@@ -372,8 +387,8 @@ bool OccluQryTest::conformOQ_GenIn(GLuint id)
glGenQueriesARB_func(1, &id);
if (glGetError() != GL_INVALID_OPERATION) {
fprintf(stderr, "F: No GL_INVALID_OPERATION generated if "
"GenQueries in the progress of another.\n");
reportError("No GL_INVALID_OPERATION generated if "
"GenQueries in the progress of another.");
pass = false;
}
......@@ -395,8 +410,8 @@ bool OccluQryTest::conformOQ_DeleteIn(GLuint id)
glDeleteQueriesARB_func(1, &id);
if (glGetError() != GL_INVALID_OPERATION) {
fprintf(stderr, "F: No GL_INVALID_OPERATION generated if "
"DeleteQueries in the progress of another.\n");
reportError("No GL_INVALID_OPERATION generated if "
"DeleteQueries in the progress of another.");
pass = false;
}
}
......@@ -420,8 +435,8 @@ bool OccluQryTest::conformOQ_BeginIn(GLuint id)
glBeginQueryARB_func(GL_SAMPLES_PASSED_ARB, id);
if (glGetError() != GL_INVALID_OPERATION) {
fprintf(stderr, "F: No GL_INVALID_OPERATION generated if "
"BeginQuery in the progress of another.\n");
reportError("No GL_INVALID_OPERATION generated if "
"BeginQuery in the progress of another.");
pass = false;
}
......@@ -448,9 +463,9 @@ bool OccluQryTest::conformOQ_GetObjAvalIn(GLuint id)
pass = false;
if (pass == false) {
fprintf(stderr, "F: No GL_INVALID_OPERATION generated if "
reportError("No GL_INVALID_OPERATION generated if "
"GetQueryObjectuiv with GL_QUERY_RESULT_AVAILABLE_ARB "
"in the active progress.\n");
"in the active progress.");
}
TERM_QUERY();
......@@ -476,9 +491,9 @@ bool OccluQryTest::conformOQ_GetObjResultIn(GLuint id)
pass = false;
if (pass == false) {
fprintf(stderr, "F: No GL_INVALID_OPERATION generated if "
reportError("No GL_INVALID_OPERATION generated if "
"GetQueryObject[u]iv with GL_QUERY_RESULT_ARB "
"in the active progress.\n");
"in the active progress.");
}
TERM_QUERY();
......@@ -504,9 +519,9 @@ bool OccluQryTest::conformOQ_GetObjivAval(GLuint id)
glGetQueryObjectivARB_func(id_tmp, GL_QUERY_RESULT_AVAILABLE_ARB, &param);
if (glGetError() != GL_INVALID_OPERATION) {
fprintf(stderr, "F: No GL_INVALID_OPERATION generated if "
reportError("No GL_INVALID_OPERATION generated if "
"GetQueryObjectuiv can still query the result"
"by an unused query id\n.");
"by an unused query id.");
return false;
}
......@@ -525,7 +540,11 @@ bool OccluQryTest::conformOQ_Gen_Delete(unsigned int id_n)
ids2 = (GLuint *)malloc(id_n * sizeof(GLuint));
if (!ids1 || !ids2) {
fprintf(stderr, "F: Cannot alloc memory to pointer ids[12].\n");
reportError("Cannot alloc memory to pointer ids[12].");
if (ids1)
free(ids1);
if (ids2)
free(ids2);
return false;
}
......@@ -537,8 +556,9 @@ bool OccluQryTest::conformOQ_Gen_Delete(unsigned int id_n)
for (i = 0; i < id_n; i ++) {
for (j = 0; j < id_n; j ++) {
if (ids1[i] == ids2[j]) {
fprintf(stderr, "F: ids1[%d] == ids2[%d] == %u.\n",
i, j, ids1[i]);
char str[1000];
sprintf(str, "ids1[%d] == ids2[%d] == %u.", i, j, ids1[i]);
reportError(str);
pass = false;
}
}
......@@ -553,8 +573,9 @@ bool OccluQryTest::conformOQ_Gen_Delete(unsigned int id_n)
/* Checkout whether the Query ID just generated is valid */
for (i = 0; i < id_n; i ++) {
if (glIsQueryARB_func(ids1[i]) == GL_FALSE) {
fprintf(stderr, "F: id [%d] just generated is not valid.\n",
ids1[i]);
char str[1000];
sprintf(str, "id [%d] just generated is not valid.", ids1[i]);
reportError(str);
pass = false;
}
}
......@@ -565,8 +586,9 @@ bool OccluQryTest::conformOQ_Gen_Delete(unsigned int id_n)
glDeleteQueriesARB_func(id_n, ids1);
for (i = 0; i < id_n; i ++) {
if (glIsQueryARB_func(ids1[i]) == GL_TRUE) {
fprintf(stderr, "F: id [%d] just deleted is still valid.\n",
ids1[i]);
char str[1000];
sprintf(str, "id [%d] just deleted is still valid.", ids1[i]);
reportError(str);
pass = false;
}
}
......@@ -588,8 +610,9 @@ bool OccluQryTest::conformOQ_Gen_Delete(unsigned int id_n)
glGenQueriesARB_func(1, ids1 + i);
for (j = 0; j < i; j ++) {
if (ids1[i] == ids1[j]) {
fprintf(stderr, "E: duplicated id generated [ %u ]",
ids1[i]);
char str[1000];
sprintf(str, "duplicated id generated [%u]", ids1[i]);
reportError(str);
pass = false;
}
}
......@@ -607,8 +630,7 @@ bool OccluQryTest::conformOQ_Gen_Delete(unsigned int id_n)
bool OccluQryTest::conformOQ_IsIdZero(void)
{
if (glIsQueryARB_func(0) == GL_TRUE) {
fprintf(stderr, "F: zero is treated as a valid id by"
"IsQueryARB().\n");
reportError("zero is treated as a valid id by glIsQueryARB().");
return false;
}
......@@ -622,8 +644,8 @@ bool OccluQryTest::conformOQ_BeginIdZero(void)
{
glBeginQueryARB_func(GL_SAMPLES_PASSED_ARB, 0);
if (glGetError() != GL_INVALID_OPERATION) {
fprintf(stderr, "F: No GL_INVALID_OPERATION generated if "
"BeginQuery with zero ID.\n");
reportError("No GL_INVALID_OPERATION generated if "
"BeginQuery with zero ID.");
return false;
}
......
......@@ -66,6 +66,8 @@ class OccluQryTest: public MultiTest {
bool chk_ext();
void setup();
void reportPassFail(MultiTestResult &r, bool pass, const char *msg) const;
void reportError(const char *msg);
void reportWarning(const char *msg);
};
} // namespace GLEAN
......
......@@ -50,14 +50,16 @@
namespace GLEAN {
static PFNGLPOINTPARAMETERFPROC glPointParameterf_func = NULL;
static PFNGLPOINTPARAMETERIPROC glPointParameteri_func = NULL;
//background color
static GLfloat bgColor[4] = {0.0, 0.0, 0.0, 0.0};
//mipmap texture's color, every texture partite to upper and lower part that
//has different colors
//for 1x1 texture, only lower part is used
// Partition each mipmap into two halves. The top half gets one color, and
// the bottom half gets a different color. Use a different pair of colors for
// each LOD.
//
// For the 1x1 LOD, only lower part (second color in the table) is used.
static GLfloat texColor[6][2][4] = {
{{1.0, 0.0, 0.0, 1.0}, {0.0, 1.0, 0.0, 1.0}}, // 32x32
{{0.0, 0.0, 1.0, 1.0}, {1.0, 1.0, 0.0, 1.0}}, // 16x16
......@@ -131,7 +133,7 @@ PointSpriteTest::SetupMipmap(GLuint *texID)
glTexImage2D(GL_TEXTURE_2D, 5, GL_RGBA, 1, 1, 0,
GL_RGBA, GL_FLOAT, texImages[5]);
glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
glTexEnvf(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE);
}
void
......@@ -142,18 +144,18 @@ PointSpriteTest::CheckDefaultState(MultiTestResult &r)
GLint coordOrigin;
// check point sprite status, default is GL_FALSE
enable = glIsEnabled(GL_POINT_SPRITE_ARB);
enable = glIsEnabled(GL_POINT_SPRITE);
if (enable != GL_FALSE)
{
env->log << name << "subcase FAIL: "
<< "PointSprite should be disabled defaultlly\n";
<< "PointSprite should be disabled by default\n";
r.numFailed++;
} else {
r.numPassed++;
}
// check coordinate replacement, default is GL_FALSE
glGetTexEnviv(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, &coordReplace);
glGetTexEnviv(GL_POINT_SPRITE, GL_COORD_REPLACE, &coordReplace);
if (coordReplace != GL_FALSE)
{
......@@ -164,19 +166,22 @@ PointSpriteTest::CheckDefaultState(MultiTestResult &r)
r.numPassed++;
}
// check coordinate origin, default is UPPER_LEFT
glEnable(GL_POINT_SPRITE);
glGetIntegerv(GL_POINT_SPRITE_COORD_ORIGIN, &coordOrigin);
if (coordOrigin != GL_UPPER_LEFT)
{
env->log << name << "subcase FAIL: "
<< "defult value of COORD_ORIGIN should be GL_UPPER_LEFT\n";
r.numFailed++;
} else {
r.numPassed++;
}
if (have_2_0) {
// check coordinate origin, default is UPPER_LEFT
glEnable(GL_POINT_SPRITE);
glGetIntegerv(GL_POINT_SPRITE_COORD_ORIGIN, &coordOrigin);
if (coordOrigin != GL_UPPER_LEFT)
{
env->log << name << "subcase FAIL: "
"defult value of COORD_ORIGIN "
"should be GL_UPPER_LEFT\n";
r.numFailed++;
} else {
r.numPassed++;
}
glDisable(GL_POINT_SPRITE);
glDisable(GL_POINT_SPRITE);
}
}
GLboolean
......@@ -272,14 +277,14 @@ FindNonBlack(const GLfloat *buf, GLint w, GLint h, GLint *x0, GLint *y0)
* @param coordOrigin: coordinate origin--UPPER_LEFT or LOWER_LEFT
*/
GLboolean
PointSpriteTest::ComparePixels(GLfloat *buf, int pSize, int coordOrigin)
PointSpriteTest::ComparePixels(GLfloat *buf, int pSize, GLenum coordOrigin)
{
GLfloat *lowerColor, *upperColor, *expectedColor;
GLint i, j;
GLint x0, y0;
lowerColor = GetTexColor(pSize, coordOrigin ? 0 : 1);
upperColor = GetTexColor(pSize, coordOrigin ? 1 : 0);
lowerColor = GetTexColor(pSize, (coordOrigin == GL_UPPER_LEFT) ? 0 : 1);
upperColor = GetTexColor(pSize, (coordOrigin == GL_UPPER_LEFT) ? 1 : 0);
// Find first (lower-left) pixel that's not black.
// The pixels hit by sprite rasterization may vary from one GL to
......@@ -339,8 +344,13 @@ PointSpriteTest::runOne(MultiTestResult &r, Window &w)
(void) w;
glPointParameterf_func = (PFNGLPOINTPARAMETERFPROC) GLUtils::getProcAddress("glPointParameterf");
assert(glPointParameterf_func);
have_2_0 = (strtod((const char *) glGetString(GL_VERSION), NULL) > 2.0);
if (have_2_0) {
glPointParameteri_func = (PFNGLPOINTPARAMETERIPROC)
GLUtils::getProcAddress("glPointParameteri");
assert(glPointParameteri_func);
}
CheckDefaultState(r);
......@@ -362,23 +372,31 @@ PointSpriteTest::runOne(MultiTestResult &r, Window &w)
buf = (GLfloat *)malloc(3 * WINSIZE * WINSIZE / 4 * sizeof(GLfloat));
// enable point_sprite_ARB
glEnable(GL_POINT_SPRITE_ARB);
// Enable point sprite mode
glEnable(GL_POINT_SPRITE);
glGetFloatv(GL_POINT_SIZE_MAX_ARB, &maxPointSize);
glGetFloatv(GL_POINT_SIZE_MAX, &maxPointSize);
if (maxPointSize > WINSIZE / 2)
maxPointSize = WINSIZE / 2;
//primitive may be point or polygon which mode is GL_POINT
// Draw GL_POINTS primitives, and draw GL_POLYGON primitives with the
// polygon mode set to GL_POINT.
for (primType = 0; primType < 2; primType ++)
{
for (coordOrigin = 0; coordOrigin < 2; coordOrigin++)
const GLint numOrigin = (have_2_0) ? 2 : 1;
static const GLenum origin[2] = {
GL_UPPER_LEFT, GL_LOWER_LEFT
};
static const char *const origin_strings[2] = {
"GL_UPPER_LEFT", "GL_LOWER_LEFT"
};
for (coordOrigin = 0; coordOrigin < numOrigin; coordOrigin++)
{
if (coordOrigin)
glPointParameterf_func(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT);
else
glPointParameterf_func(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
if (have_2_0) {
glPointParameteri_func(GL_POINT_SPRITE_COORD_ORIGIN,
origin[coordOrigin]);
}
pointSize = 1.85;
for (; pointSize <= maxPointSize; pointSize += 2.0)
......@@ -405,10 +423,13 @@ PointSpriteTest::runOne(MultiTestResult &r, Window &w)
glReadPixels(0, 0, WINSIZE/2, WINSIZE/2, GL_RGB, GL_FLOAT, buf);
if (!ComparePixels(buf, expectedSize, coordOrigin))
if (!ComparePixels(buf, expectedSize,
origin[coordOrigin]))
{
env->log << "\tPrimitive type: " << (primType ? "GL_POLYGON" : "GL_POINTS") << "\n";
env->log << "\tCoord Origin at: " << (coordOrigin ? "GL_LOWER_LEFT" : "GL_UPPER_LEFT") << "\n";
env->log << "\tCoord Origin at: " <<
origin_strings[coordOrigin] <<
"\n";
env->log << "\tPointSize: " << pointSize << "\n";
r.numFailed++;
r.numPassed--;
......@@ -420,7 +441,7 @@ PointSpriteTest::runOne(MultiTestResult &r, Window &w)
}
glDeleteTextures(1, &texID);
glDisable(GL_POINT_SPRITE_ARB);
glDisable(GL_POINT_SPRITE);
free(buf);
for (i = 0; i < 6; i++)
free(texImages[i]);
......
......@@ -53,6 +53,7 @@ class PointSpriteTest: public MultiTest
private:
GLfloat *texImages[6];
GLfloat mTolerance[3];
bool have_2_0;
void GenMipmap();
void SetupMipmap(GLuint *texID);
......@@ -61,7 +62,7 @@ private:
GLboolean OutOfPoint(int x, int y, int pSize, int x0, int y0);
GLfloat *GetTexColor(int pSize, int dir);
GLboolean CompareColor(GLfloat *actual, GLfloat *expected);
GLboolean ComparePixels(GLfloat *buf, int pSize, int coordOrigin);
GLboolean ComparePixels(GLfloat *buf, int pSize, GLenum coordOrigin);
}; // class PointSpriteTest
} // namespace GLEAN
......
......@@ -33,6 +33,7 @@
#include "image.h"
#include <cassert>
#include <cmath>
#include <cstring>
namespace GLEAN {
......@@ -375,9 +376,9 @@ ReadpixPerfTest::runOne(ReadpixPerfResult &r, Window &w)
GLint readBuf;
glGetIntegerv(GL_READ_BUFFER, &readBuf);
if (readBuf == GL_FRONT)
res.readBuf = "GL_FRONT";
strcpy(res.readBuf, "GL_FRONT");
else
res.readBuf = "GL_BACK";
strcpy(res.readBuf, "GL_BACK");
}
for (res.formatNum = 0; Formats[res.formatNum].Name; res.formatNum++) {
......@@ -500,6 +501,7 @@ ReadpixPerfResult::putresults(ostream &s) const
s << res.height << '\n';
s << res.formatNum << '\n';
s << res.pboMode << '\n';
s << res.readBuf << '\n';