aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-10-18 12:32:35 -0700
committerEric Anholt <eric@anholt.net>2011-10-18 12:49:53 -0700
commit80824eb27c2b070bff39e95dd2a877d8d19d08fd (patch)
tree5a809e39b7add82a5c366c7c19c2d8f3e415ef4b
parentccd5ea5ad58d3a05e24d7d3b08429a825e0976c4 (diff)
Update glean tests to 2a932dcf5d3aa513ecb65b51555408fb4783ba1a+fixes
This still contains one of my two blendFunc performance fixes that were never applied. The other one got reimplemented by probing less instead of just drawing fewer pixels, for whatever reason.
-rw-r--r--tests/glean/dsconfig.cpp2
-rw-r--r--tests/glean/geomrend.cpp2
-rw-r--r--tests/glean/glutils.cpp4
-rw-r--r--tests/glean/glwrap.h1
-rw-r--r--tests/glean/tapi2.cpp3
-rw-r--r--tests/glean/tblend.cpp26
-rw-r--r--tests/glean/tblend.h2
-rw-r--r--tests/glean/test.cpp4
-rw-r--r--tests/glean/tfbo.cpp23
-rw-r--r--tests/glean/tfpexceptions.cpp1
-rw-r--r--tests/glean/tfragprog1.cpp62
-rw-r--r--tests/glean/tglsl1.cpp158
-rw-r--r--tests/glean/tglsl1.h3
-rw-r--r--tests/glean/tmaskedclear.cpp2
-rw-r--r--tests/glean/tpbo.cpp8
-rw-r--r--tests/glean/tpixelformats.h6
-rw-r--r--tests/glean/tpointatten.cpp50
-rw-r--r--tests/glean/treadpixperf.cpp4
-rw-r--r--tests/glean/tshaderapi.cpp7
-rw-r--r--tests/glean/tstencil2.cpp11
-rw-r--r--tests/glean/ttexcombine.cpp2
-rw-r--r--tests/glean/ttexture_srgb.cpp4
-rw-r--r--tests/glean/ttexunits.cpp10
-rw-r--r--tests/glean/tvertarraybgra.cpp11
-rw-r--r--tests/glean/tvtxperf.cpp1
25 files changed, 305 insertions, 102 deletions
diff --git a/tests/glean/dsconfig.cpp b/tests/glean/dsconfig.cpp
index 6a6df338..25a4f25c 100644
--- a/tests/glean/dsconfig.cpp
+++ b/tests/glean/dsconfig.cpp
@@ -37,7 +37,7 @@
#include <map>
#include <limits.h>
-#ifdef __WIN__
+#ifdef _MSC_VER
// disable the annoying warning : "forcing value to bool 'true' or 'false' (performance warning)"
#pragma warning (disable : 4800)
#endif
diff --git a/tests/glean/geomrend.cpp b/tests/glean/geomrend.cpp
index fceb24d7..4d6d0859 100644
--- a/tests/glean/geomrend.cpp
+++ b/tests/glean/geomrend.cpp
@@ -35,12 +35,10 @@
// methods stuffed in a display list.
#include "geomrend.h"
-#include "rand.h"
#include "glutils.h"
#include <algorithm>
#include <iostream>
#include <cmath>
-#include <float.h>
#include <cassert>
using namespace std;
diff --git a/tests/glean/glutils.cpp b/tests/glean/glutils.cpp
index 2c8ab600..70cf0cc2 100644
--- a/tests/glean/glutils.cpp
+++ b/tests/glean/glutils.cpp
@@ -37,7 +37,7 @@
#include "environ.h"
#include "lex.h"
#include "glutils.h"
-#if defined(__X11__)
+#if defined(__X11__) || defined(__AGL__)
# include <dlfcn.h>
#endif
#if defined(__AGL__)
@@ -141,7 +141,7 @@ void
# error "Need GetProcAddress (or equivalent) for BeOS"
return 0;
#elif defined(__AGL__)
- return reinterpret_cast<void (*)()>(glutGetProcAddress(name));
+ return reinterpret_cast<void (*)()>(dlsym(RTLD_DEFAULT, name));
#endif
} // getProcAddress
diff --git a/tests/glean/glwrap.h b/tests/glean/glwrap.h
index 8463eb36..91e5d485 100644
--- a/tests/glean/glwrap.h
+++ b/tests/glean/glwrap.h
@@ -74,7 +74,6 @@
# include <Carbon/Carbon.h>
# include <OpenGL/glu.h>
# include <OpenGL/glext.h>
-# include <GLUT/glut.h>
# include <AGL/agl.h>
# include <AGL/aglRenderers.h>
# if !defined(APIENTRY)
diff --git a/tests/glean/tapi2.cpp b/tests/glean/tapi2.cpp
index f180bc3b..9a88f9f2 100644
--- a/tests/glean/tapi2.cpp
+++ b/tests/glean/tapi2.cpp
@@ -181,8 +181,7 @@ bool
API2Test::setup(void)
{
// check that we have OpenGL 2.0
- const char *version = (const char *) glGetString(GL_VERSION);
- if (version[0] != '2' || version[1] != '.') {
+ if (GLUtils::getVersion() < 2.0) {
//env->log << "OpenGL 2.0 not supported\n";
return false;
}
diff --git a/tests/glean/tblend.cpp b/tests/glean/tblend.cpp
index 51d29fe2..497e80b8 100644
--- a/tests/glean/tblend.cpp
+++ b/tests/glean/tblend.cpp
@@ -37,6 +37,8 @@
#define ELEMENTS(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
+#define HUGE_STEP 1000
+
namespace GLEAN {
static PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate_func = NULL;
static PFNGLBLENDCOLORPROC glBlendColor_func = NULL;
@@ -696,6 +698,7 @@ BlendFuncTest::runOne(BlendFuncResult& r, Window& w) {
unsigned numOperatorsRGB, numOperatorsA;
BlendFuncResult::PartialResult p;
bool allPassed = true;
+ unsigned testNo, testStride;
// test for features, get function pointers
if (GLUtils::getVersion() >= 1.4) {
@@ -771,6 +774,18 @@ BlendFuncTest::runOne(BlendFuncResult& r, Window& w) {
numOperatorsA = 1; // just ADD
}
+ // If quick mode, run fewer tests
+ if (env->options.quick) {
+ testStride = 11; // a prime number
+ assert(ELEMENTS(srcFactors) % testStride);
+ assert(ELEMENTS(dstFactors) % testStride);
+ assert(ELEMENTS(operators) % testStride);
+ }
+ else {
+ testStride = 1;
+ }
+ testNo = testStride - 1;
+
#if 0
// use this to test a single combination:
p.srcRGB = p.srcA = GL_SRC_ALPHA;
@@ -793,7 +808,7 @@ BlendFuncTest::runOne(BlendFuncResult& r, Window& w) {
else if (p.opRGB == GL_MIN || p.opRGB == GL_MAX ||
p.opA == GL_MIN || p.opA == GL_MAX) {
// blend terms are N/A so only do one iteration of loops
- step = 1000;
+ step = HUGE_STEP;
}
else {
// subtract modes: do every 3rd blend term for speed
@@ -832,6 +847,15 @@ BlendFuncTest::runOne(BlendFuncResult& r, Window& w) {
needsBlendColor(p.dstA)))
continue;
+ // skip all but every testStride-th test
+ ++testNo;
+ if (testNo == testStride || step >= HUGE_STEP) {
+ testNo = 0;
+ }
+ else {
+ continue;
+ }
+
if (!runCombo(r, w, p, *env)) {
allPassed = false;
}
diff --git a/tests/glean/tblend.h b/tests/glean/tblend.h
index 3080a26e..abf3c80a 100644
--- a/tests/glean/tblend.h
+++ b/tests/glean/tblend.h
@@ -35,7 +35,7 @@
namespace GLEAN {
-#define drawingSize 8 // We will check each pair of blend factors
+#define drawingSize 32 // We will check each pair of blend factors
// for each pixel in a square image of this
// dimension, so if you make it too large,
// the tests may take quite a while to run.
diff --git a/tests/glean/test.cpp b/tests/glean/test.cpp
index 02bd16c5..0d3dbfb6 100644
--- a/tests/glean/test.cpp
+++ b/tests/glean/test.cpp
@@ -36,11 +36,9 @@
#include <iostream>
#include "dsconfig.h"
-#include "dsfilt.h"
#include "dsurf.h"
#include "winsys.h"
#include "environ.h"
-#include "rc.h"
#include "test.h"
namespace GLEAN {
@@ -63,6 +61,7 @@ Test::Test(const char* testName, const char *descrip):
name(testName), description(descrip) {
prereqs = 0;
hasRun = false;
+ env = NULL;
nextTest = testList;
testList = this;
++testCount;
@@ -72,6 +71,7 @@ Test::Test(const char* testName, const char *descrip, Test** thePrereqs):
name(testName), description(descrip) {
prereqs = thePrereqs;
hasRun = false;
+ env = NULL;
nextTest = testList;
testList = this;
++testCount;
diff --git a/tests/glean/tfbo.cpp b/tests/glean/tfbo.cpp
index 8b80ded9..886facc1 100644
--- a/tests/glean/tfbo.cpp
+++ b/tests/glean/tfbo.cpp
@@ -651,9 +651,16 @@ FBOTest::testRender2SingleTexture(void)
}
- if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
+ if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+ glDeleteTextures(1, textures);
+ if (useFramebuffer)
+ glDeleteFramebuffersEXT_func(1, fbs);
+ if (depthBuffer)
+ glDeleteRenderbuffersEXT_func(1, depth_rb);
+ if (stencilBuffer)
+ glDeleteRenderbuffersEXT_func(1, stencil_rb);
continue;
-
+ }
//
// Render, test the results
@@ -667,8 +674,8 @@ FBOTest::testRender2SingleTexture(void)
switch (textureModes[mode]) {
case GL_TEXTURE_1D:
glBegin(GL_LINES);
- glVertex3f(TEXSIZE / 4, 0, 0.3);
- glVertex3f(TEXSIZE * 5 / 8, 0, 0.3);
+ glVertex3f(TEXSIZE / 4, 0.5, 0.3);
+ glVertex3f(TEXSIZE * 5 / 8 + 0.25, 0.5, 0.3);
glEnd();
break;
case GL_TEXTURE_2D:
@@ -697,8 +704,8 @@ FBOTest::testRender2SingleTexture(void)
switch (textureModes[mode]) {
case GL_TEXTURE_1D:
glBegin(GL_LINES);
- glVertex3f(TEXSIZE / 2, 0, 0.3);
- glVertex3f(TEXSIZE * 7 / 8, 0, 0.3);
+ glVertex3f(TEXSIZE / 2, 0.5, 0.3);
+ glVertex3f(TEXSIZE * 7 / 8, 0.5, 0.3);
glEnd();
break;
case GL_TEXTURE_2D:
@@ -728,8 +735,8 @@ FBOTest::testRender2SingleTexture(void)
switch (textureModes[mode]) {
case GL_TEXTURE_1D:
glBegin(GL_LINES);
- glVertex3f(0, 0, 0.2);
- glVertex3f(TEXSIZE, 0, 0.2);
+ glVertex3f(0, 0.5, 0.2);
+ glVertex3f(TEXSIZE, 0.5, 0.2);
glEnd();
break;
case GL_TEXTURE_2D:
diff --git a/tests/glean/tfpexceptions.cpp b/tests/glean/tfpexceptions.cpp
index 2038007a..acc170fd 100644
--- a/tests/glean/tfpexceptions.cpp
+++ b/tests/glean/tfpexceptions.cpp
@@ -29,7 +29,6 @@
// Authors: Brian Paul, Keith Whitwell
#include "tfpexceptions.h"
-#include <cassert>
#include <cmath>
#define INCLUDE_FPU_CONTROL 0
diff --git a/tests/glean/tfragprog1.cpp b/tests/glean/tfragprog1.cpp
index 17aeb6a3..b3fe1d4f 100644
--- a/tests/glean/tfragprog1.cpp
+++ b/tests/glean/tfragprog1.cpp
@@ -133,6 +133,53 @@ static const FragmentProgram Programs[] = {
},
DONT_CARE_Z
},
+
+ {
+ "ADD an immediate",
+ "!!ARBfp1.0\n"
+ "PARAM p = program.local[1]; \n"
+ "ADD result.color, p, {0.25, 0.0, 0.5, 0.25}; \n"
+ "END \n",
+ { CLAMP01(Param1[0] + 0.25),
+ CLAMP01(Param1[1] + 0.0),
+ CLAMP01(Param1[2] + 0.5),
+ CLAMP01(Param1[3] + 0.25),
+ },
+ DONT_CARE_Z
+ },
+
+ {
+ "ADD negative immediate",
+ "!!ARBfp1.0\n"
+ "PARAM p = program.local[1]; \n"
+ "ADD result.color, p, {-0.25, -0.2, 0.0, -0.25}; \n"
+ "END \n",
+ { CLAMP01(Param1[0] - 0.25),
+ CLAMP01(Param1[1] - 0.2),
+ CLAMP01(Param1[2] - 0.0),
+ CLAMP01(Param1[3] - 0.25),
+ },
+ DONT_CARE_Z
+ },
+
+ {
+ "ADD negative immediate (2)",
+ "!!ARBfp1.0\n"
+ "PARAM p = program.local[1]; \n"
+ "TEMP t; \n"
+ "MOV t, p; \n"
+ "MUL t.xyz, t, 2.0; \n"
+ "ADD t.xyz, t, -1.0; \n"
+ "MOV result.color, t; \n"
+ "END \n",
+ { CLAMP01(Param1[0] * 2.0 - 1.0),
+ CLAMP01(Param1[1] * 2.0 - 1.0),
+ CLAMP01(Param1[2] * 2.0 - 1.0),
+ CLAMP01(Param1[3] ),
+ },
+ DONT_CARE_Z
+ },
+
{
"CMP test",
"!!ARBfp1.0\n"
@@ -189,6 +236,21 @@ static const FragmentProgram Programs[] = {
DONT_CARE_Z
},
{
+ "DP3 test (2)",
+ "!!ARBfp1.0\n"
+ "PARAM p1 = program.local[1]; \n"
+ "TEMP t, r; \n"
+ "MOV t, p1; \n"
+ "DP3 r.x, t, t; \n"
+ "MUL result.color, r.xxxx, 0.5; \n"
+ "END \n",
+ { SMEAR(CLAMP01((Param1[0] * Param1[0] +
+ Param1[1] * Param1[1] +
+ Param1[2] * Param1[2]) * 0.5))
+ },
+ DONT_CARE_Z
+ },
+ {
"DP4 test",
"!!ARBfp1.0\n"
"PARAM p1 = program.local[1]; \n"
diff --git a/tests/glean/tglsl1.cpp b/tests/glean/tglsl1.cpp
index 0ef5a6af..6a48db65 100644
--- a/tests/glean/tglsl1.cpp
+++ b/tests/glean/tglsl1.cpp
@@ -1,7 +1,7 @@
// BEGIN_COPYRIGHT -*- glean -*-
//
// Copyright (C) 1999 Allen Akin All Rights Reserved.
-// Copyright (C) 2008 VMWare, Inc. All Rights Reserved.
+// Copyright (C) 2008 VMware, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@@ -92,9 +92,10 @@ static PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv_func = NULL;
#define FLAG_ILLEGAL_SHADER 0x2 // the shader test should not compile
#define FLAG_ILLEGAL_LINK 0x4 // the shaders should not link
#define FLAG_VERSION_1_20 0x8 // GLSL 1.20 test
-#define FLAG_WINDING_CW 0x10 // clockwise-winding polygon
-#define FLAG_VERTEX_TEXTURE 0x20
-#define FLAG_ARB_DRAW_BUFFERS 0x40
+#define FLAG_VERSION_1_30 0x10 // GLSL 1.30 test
+#define FLAG_WINDING_CW 0x20 // clockwise-winding polygon
+#define FLAG_VERTEX_TEXTURE 0x40
+#define FLAG_ARB_DRAW_BUFFERS 0x80
#define DONT_CARE_Z -1.0
@@ -143,6 +144,12 @@ static const GLfloat LightDiffuse[4] = LIGHT_DIFFUSE;
static const GLfloat Uniform1[4] = UNIFORM1;
static const GLfloat UniformArray[4] = { 0.1, 0.25, 0.5, 0.75 };
+static const GLfloat UniformArray4[4][4] = {
+ { 0.1, 0.2, 0.3, 0.4 },
+ { 0.9, 0.8, 0.7, 0.6 },
+ { 0.5, 0.6, 0.7, 0.5 },
+ { 0.3, 0.4, 0.5, 0.6 }
+};
static const GLfloat PointAtten[3] = { PSIZE_ATTEN0, PSIZE_ATTEN1, PSIZE_ATTEN2 };
static const GLfloat FogColor[4] = { FOG_R, FOG_G, FOG_B, FOG_A };
@@ -473,6 +480,36 @@ static const ShaderProgram Programs[] = {
},
{
+ "Negation",
+ NO_VERTEX_SHADER,
+ "uniform vec4 uniform1; \n"
+ "void main() { \n"
+ " vec4 a = vec4(0.5, 0.25, 0.0, 0.0); \n"
+ " vec4 b = uniform1; \n"
+ " vec4 na = -a; \n"
+ " vec4 nb = -b; \n"
+ " vec4 x = na + nb; \n"
+ " gl_FragColor = -x; \n"
+ "} \n",
+ { 1.0, 0.5, 0.75, 0.0 },
+ DONT_CARE_Z,
+ FLAG_NONE
+ },
+
+ {
+ "Negation2",
+ NO_VERTEX_SHADER,
+ "uniform vec4 uniform1; \n"
+ "void main() { \n"
+ " vec4 a = -uniform1; \n"
+ " gl_FragColor = -a; \n"
+ "} \n",
+ UNIFORM1,
+ DONT_CARE_Z,
+ FLAG_NONE
+ },
+
+ {
"chained assignment",
NO_VERTEX_SHADER,
"void main() { \n"
@@ -488,6 +525,7 @@ static const ShaderProgram Programs[] = {
{
"integer, float arithmetic",
NO_VERTEX_SHADER,
+ "#version 120 \n"
"void main() { \n"
" int k = 100; \n"
" gl_FragColor.x = k * 0.01; \n"
@@ -497,7 +535,7 @@ static const ShaderProgram Programs[] = {
"} \n",
{ 1.0, 0.5, 0.25, 0.0 },
DONT_CARE_Z,
- FLAG_NONE
+ FLAG_VERSION_1_20
},
{
@@ -518,7 +556,7 @@ static const ShaderProgram Programs[] = {
"void main() { \n"
" int i = 15, j = 6; \n"
" int k = i / j; \n"
- " gl_FragColor = vec4(k * 0.1); \n"
+ " gl_FragColor = vec4(float(k) * 0.1); \n"
"} \n",
{ 0.2, 0.2, 0.2, 0.2 },
DONT_CARE_Z,
@@ -531,10 +569,10 @@ static const ShaderProgram Programs[] = {
"// as above, but prevent compile-time evaluation \n"
"uniform vec4 uniform1; \n"
"void main() { \n"
- " int i = int(15 * uniform1.x); \n"
+ " int i = int(15.0 * uniform1.x); \n"
" int j = 6; \n"
" int k = i / j; \n"
- " gl_FragColor = vec4(k * 0.1); \n"
+ " gl_FragColor = vec4(float(k) * 0.1); \n"
"} \n",
{ 0.2, 0.2, 0.2, 0.2 },
DONT_CARE_Z,
@@ -1167,7 +1205,7 @@ static const ShaderProgram Programs[] = {
},
{
- "simple if/else statement, fragment shader",
+ "simple if-else statement, fragment shader",
NO_VERTEX_SHADER,
"void main() { \n"
" // this should always be false \n"
@@ -1183,7 +1221,7 @@ static const ShaderProgram Programs[] = {
},
{
- "simple if/else statement, vertex shader",
+ "simple if-else statement, vertex shader",
"uniform vec4 uniform1; \n"
"void main() { \n"
" gl_Position = ftransform(); \n"
@@ -1524,6 +1562,31 @@ static const ShaderProgram Programs[] = {
},
{
+ "constant array of vec4 with variable indexing, vertex shader",
+ "uniform vec4 uniform1; \n"
+ "uniform float uniformArray[4]; \n"
+ "uniform vec4 uniformArray4[4]; \n"
+ "void main() { \n"
+ " int i0 = int(gl_TexCoord[0].x); \n"
+ " int i1 = int(gl_TexCoord[0].y); \n"
+ " int i2 = int(gl_TexCoord[0].z); \n"
+ " int i3 = int(gl_TexCoord[0].w); \n"
+
+ " int indx0 = int(uniform1.y * 3.0); // should be 2 \n"
+ " int indx = int(uniform1.y * 8.0); // should be 2 \n"
+ " gl_FrontColor.z = uniformArray4[indx].z; \n"
+ " gl_FrontColor.x = uniformArray4[indx].x; \n"
+ " gl_FrontColor.w = uniformArray4[indx].w; \n"
+ " gl_FrontColor.y = uniformArray4[indx].y; \n"
+ " gl_Position = ftransform(); \n"
+ "} \n",
+ NO_FRAGMENT_SHADER,
+ { 0.5, 0.6, 0.7, 0.5 },
+ DONT_CARE_Z,
+ FLAG_NONE
+ },
+
+ {
// This one tests that a different array index per vertex
// works as expected. The left edge of the polygon should
// have a gray value = uniformArray[2] while the right
@@ -2038,7 +2101,7 @@ static const ShaderProgram Programs[] = {
// Note: var3 = gl_Color
// Note: var1 = -var2
// Final fragment color should be equal to gl_Color
- "varying variable read/write",
+ "varying variable read-write",
// vertex program:
"varying vec4 var1, var2, var3; \n"
"void main() { \n"
@@ -2298,7 +2361,7 @@ static const ShaderProgram Programs[] = {
" vec3 coord = vec3(0.1, 0.1, 0.5); \n"
" // shadow map value should be 0.25 \n"
" gl_FragColor = shadow2D(texZ, coord) + vec4(0.25); \n"
- " // 0.5 <= 0.25 ? color = 1 : 0\n"
+ " // color = (0.5 <= 0.25) ? 1.25 : 0.25\n"
"} \n",
{ 0.25, 0.25, 0.25, 1.0 },
DONT_CARE_Z,
@@ -2313,7 +2376,7 @@ static const ShaderProgram Programs[] = {
" vec3 coord = vec3(0.1, 0.1, 0.2); \n"
" // shadow map value should be 0.25 \n"
" gl_FragColor = shadow2D(texZ, coord); \n"
- " // 0.2 <= 0.25 ? color = 1 : 0\n"
+ " // color = (0.2 <= 0.25) ? 1 : 0\n"
"} \n",
{ 1.0, 1.0, 1.0, 1.0 },
DONT_CARE_Z,
@@ -2328,7 +2391,7 @@ static const ShaderProgram Programs[] = {
" vec3 coord = vec3(0.9, 0.9, 0.95); \n"
" // shadow map value should be 0.75 \n"
" gl_FragColor = shadow2D(texZ, coord) + vec4(0.25); \n"
- " // 0.95 <= 0.75 ? color = 1 : 0\n"
+ " // color = (0.95 <= 0.75) ? 1.25 : 0.25\n"
"} \n",
{ 0.25, 0.25, 0.25, 1.0 },
DONT_CARE_Z,
@@ -2343,7 +2406,7 @@ static const ShaderProgram Programs[] = {
" vec3 coord = vec3(0.9, 0.9, 0.65); \n"
" // shadow map value should be 0.75 \n"
" gl_FragColor = shadow2D(texZ, coord); \n"
- " // 0.65 <= 0.75 ? color = 1 : 0\n"
+ " // color = (0.65 <= 0.75) ? 1 : 0\n"
"} \n",
{ 1.0, 1.0, 1.0, 1.0 },
DONT_CARE_Z,
@@ -2546,6 +2609,27 @@ static const ShaderProgram Programs[] = {
},
{
+ "function prototype",
+ NO_VERTEX_SHADER,
+ "float Half(const in float x); \n"
+ "\n"
+ "void main() { \n"
+ " float a = 0.5; \n"
+ " float b = Half(a); \n"
+ " gl_FragColor = vec4(b); \n"
+ "} \n"
+ "\n"
+ "float Half(const in float x) { \n"
+ " return 0.5 * x; \n"
+ "} \n"
+ "\n",
+ { 0.25, 0.25, 0.25, 0.25 },
+ DONT_CARE_Z,
+ FLAG_NONE
+ },
+
+
+ {
"TPPStreamCompiler::assignOperands",
NO_VERTEX_SHADER,
"struct S { \n"
@@ -3320,7 +3404,7 @@ static const ShaderProgram Programs[] = {
},
{
- "if (boolean/scalar) check",
+ "if (boolean-scalar) check",
NO_VERTEX_SHADER,
"void main() { \n"
" vec3 v; \n"
@@ -3859,11 +3943,11 @@ static const ShaderProgram Programs[] = {
FLAG_VERSION_1_20 | FLAG_ILLEGAL_SHADER
},
- // Other new GLSL 1.20 features (just parse/compile tests)
+ // Other new GLSL 1.20, 1.30 features (just parse/compile tests)
{
- "GLSL 1.20 precision qualifiers",
+ "GLSL 1.30 precision qualifiers",
NO_VERTEX_SHADER,
- "#version 120 \n"
+ "#version 130 \n"
"highp float f1; \n"
"mediump float f2; \n"
"lowp float f3; \n"
@@ -3875,7 +3959,7 @@ static const ShaderProgram Programs[] = {
"} \n",
{ 1.0, 1.0, 1.0, 1.0 },
DONT_CARE_Z,
- FLAG_VERSION_1_20
+ FLAG_VERSION_1_30
},
{
"GLSL 1.20 invariant, centroid qualifiers",
@@ -3963,12 +4047,14 @@ static const ShaderProgram Programs[] = {
// Does the linker correctly recognize that texcoord[1] is
// written by the vertex shader and read by the fragment shader?
// vert shader:
+ "varying vec4 gl_TexCoord[4]; \n"
"void main() { \n"
" int i = 1; \n"
" gl_TexCoord[i] = vec4(0.5, 0, 0, 0); \n"
" gl_Position = ftransform(); \n"
"} \n",
// frag shader:
+ "varying vec4 gl_TexCoord[4]; \n"
"void main() { \n"
" gl_FragColor = gl_TexCoord[1]; \n"
"} \n",
@@ -4256,6 +4342,7 @@ GLSLTest::setupTextures(void)
//
// 2D GL_DEPTH_COMPONENT texture (for shadow sampler tests)
+ // Left half = 0.25, right half = 0.75
//
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
@@ -4305,11 +4392,13 @@ GLSLTest::setup(void)
#else
const char *glslVersion = NULL;
#endif
- if (!glslVersion || glslVersion[0] != '1') {
+ const float version = atof(glslVersion);
+ if (version < 1.00) {
env->log << "GLSL 1.x not supported\n";
return false;
}
- glsl_120 = (glslVersion[2] >= '2');
+ glsl_120 = version >= 1.20;
+ glsl_130 = version >= 1.30;
if (!getFunctions()) {
env->log << "Unable to get pointer to an OpenGL 2.0 API function\n";
@@ -4507,7 +4596,7 @@ GLSLTest::testProgram(const ShaderProgram &p)
};
const GLfloat r = 0.62; // XXX draw 16x16 pixel quad
GLuint fragShader = 0, vertShader = 0, program = 0;
- GLint u1, uArray, utex1d, utex2d, utex3d, utexZ, umat4, umat4t;
+ GLint u1, uArray, uArray4, utex1d, utex2d, utex3d, utexZ, umat4, umat4t;
GLint umat2x4, umat2x4t, umat4x3, umat4x3t;
bool retVal = false;
@@ -4611,6 +4700,10 @@ GLSLTest::testProgram(const ShaderProgram &p)
if (uArray >= 0)
glUniform1fv_func(uArray, 4, UniformArray);
+ uArray4 = glGetUniformLocation_func(program, "uniformArray4");
+ if (uArray4 >= 0)
+ glUniform4fv_func(uArray4, 4, (float *) UniformArray4);
+
utex1d = glGetUniformLocation_func(program, "tex1d");
if (utex1d >= 0)
glUniform1i_func(utex1d, 0); // bind to tex unit 0
@@ -4678,6 +4771,8 @@ GLSLTest::testProgram(const ShaderProgram &p)
glEnd();
}
+ // env->log << " Shader test: " << p.name << "\n";
+
// read a pixel from lower-left corder of rendered quad
GLfloat pixel[4];
glReadPixels(windowSize / 2 - 2, windowSize / 2 - 2, 1, 1,
@@ -4739,6 +4834,12 @@ GLSLTest::runOne(MultiTestResult &r, Window &w)
env->log << "glsl1: Running single test: " << singleTest << "\n";
for (int i = 0; Programs[i].name; i++) {
if (strcmp(Programs[i].name, singleTest) == 0) {
+
+ if ((Programs[i].flags & FLAG_VERSION_1_20) && !glsl_120)
+ break; // skip non-applicable tests
+ if ((Programs[i].flags & FLAG_VERSION_1_30) && !glsl_130)
+ break; // skip non-applicable tests
+
r.numPassed = testProgram(Programs[i]);
r.numFailed = 1 - r.numPassed;
break;
@@ -4750,6 +4851,8 @@ GLSLTest::runOne(MultiTestResult &r, Window &w)
for (int i = 0; Programs[i].name; i++) {
if ((Programs[i].flags & FLAG_VERSION_1_20) && !glsl_120)
continue; // skip non-applicable tests
+ if ((Programs[i].flags & FLAG_VERSION_1_30) && !glsl_130)
+ continue; // skip non-applicable tests
if (testProgram(Programs[i])) {
r.numPassed++;
}
@@ -4767,16 +4870,13 @@ bool
GLSLTest::isApplicable() const
{
const char *version = (const char *) glGetString(GL_VERSION);
- if (strncmp(version, "2.0", 3) == 0 ||
- strncmp(version, "2.1", 3) == 0 ||
- strncmp(version, "3.0", 3) == 0 ||
- strncmp(version, "3.1", 3) == 0 ||
- strncmp(version, "3.2", 3) == 0) {
+ const float v = atof(version);
+ if (v >= 2.0) {
return true;
}
else {
env->log << name
- << ": skipped. Requires GL 2.0, 2.1 or 3.0.\n";
+ << ": skipped. Requires GL 2.0 or later.\n";
return false;
}
}
diff --git a/tests/glean/tglsl1.h b/tests/glean/tglsl1.h
index 73972b0e..34c1d23d 100644
--- a/tests/glean/tglsl1.h
+++ b/tests/glean/tglsl1.h
@@ -69,7 +69,8 @@ public:
private:
GLfloat tolerance[5];
GLfloat looseTolerance[5];
- GLfloat glsl_120; // GLSL 1.20 or higher supported?
+ bool glsl_120; // GLSL 1.20 or higher supported?
+ bool glsl_130; // GLSL 1.30 or higher supported?
bool getFunctions(void);
void setupTextures(void);
void setupTextureMatrix1(void);
diff --git a/tests/glean/tmaskedclear.cpp b/tests/glean/tmaskedclear.cpp
index b8fd6f9e..a3fa7236 100644
--- a/tests/glean/tmaskedclear.cpp
+++ b/tests/glean/tmaskedclear.cpp
@@ -29,8 +29,6 @@
// tmaskedclear.cpp: Test color/index masking with glClear.
#include "tmaskedclear.h"
-#include "rand.h"
-#include "image.h"
namespace GLEAN {
diff --git a/tests/glean/tpbo.cpp b/tests/glean/tpbo.cpp
index 7d862796..85a7dba5 100644
--- a/tests/glean/tpbo.cpp
+++ b/tests/glean/tpbo.cpp
@@ -200,8 +200,8 @@ bool PBOTest::testSanity(void)
glGenBuffersARB_func(1, pbs);
- if (glIsBufferARB_func(pbs[0]) != GL_TRUE) {
- REPORT_FAILURE("Failed to call glIsBuffersARB");
+ if (glIsBufferARB_func(pbs[0]) != GL_FALSE) {
+ REPORT_FAILURE("glIsBufferARB failed");
return false;
}
@@ -224,7 +224,7 @@ bool PBOTest::testSanity(void)
glDeleteBuffersARB_func(1, pbs);
if (glIsBufferARB_func(pbs[0]) == GL_TRUE) {
- REPORT_FAILURE("Failed to call glIsBuffersARB");
+ REPORT_FAILURE("glIsBufferARB failed");
return false;
}
@@ -615,8 +615,6 @@ bool PBOTest::testTexImage(void)
breakCOWTexture++) {
if (useTexUnpackBuffer) {
glGenBuffersARB_func(1, unpack_pb);
- if (glIsBufferARB_func(unpack_pb[0]) == false)
- return false;
glBindBufferARB_func(GL_PIXEL_UNPACK_BUFFER_ARB, unpack_pb[0]);
glBufferDataARB_func(GL_PIXEL_UNPACK_BUFFER_ARB,
TEXSIZE * TEXSIZE * 3 * sizeof(GLfloat), NULL,
diff --git a/tests/glean/tpixelformats.h b/tests/glean/tpixelformats.h
index faffc327..87720216 100644
--- a/tests/glean/tpixelformats.h
+++ b/tests/glean/tpixelformats.h
@@ -45,6 +45,12 @@ public:
const char *extensions, const char* description)
: MultiTest(testName, filter, extensions, description)
{
+ alphaBits = 0;
+ defaultAlpha = 0;
+ haveHalfFloat = false;
+ haveABGR = false;
+ haveSRGB = false;
+ haveCombine = false;
}
virtual void runOne(MultiTestResult &r, Window &w);
diff --git a/tests/glean/tpointatten.cpp b/tests/glean/tpointatten.cpp
index f5ce13e8..7d8a5628 100644
--- a/tests/glean/tpointatten.cpp
+++ b/tests/glean/tpointatten.cpp
@@ -134,16 +134,30 @@ PointAttenuationTest::measureSize(GLfloat yPos) const
int x = 0;
int y = (int) (yNdc * windowHeight);
int w = windowWidth;
- int h = 1;
- GLfloat image[windowWidth * 3];
- // Read row of pixels and add up colors, which should be white
- // or shades of gray if smoothing is enabled.
- glReadPixels(x, y, w, h, GL_RGB, GL_FLOAT, image);
- float sum = 0.0;
- for (int i = 0; i < w; i++) {
- sum += (image[i*3+0] + image[i*3+1] + image[i*3+2]) / 3.0;
+ int h = 3;
+ GLfloat image[3 * windowWidth * 3]; // three rows of RGB values
+
+ // Read three row of pixels and add up colors in each row.
+ // Use the row with the greatest sum. This helps gives us a bit
+ // of leeway in vertical point positioning.
+ // Colors should be white or shades of gray if smoothing is enabled.
+ glReadPixels(x, y - 1, w, h, GL_RGB, GL_FLOAT, image);
+
+ float sum[3] = { 0.0, 0.0, 0.0 };
+ for (int j = 0; j < 3; j++) {
+ for (int i = 0; i < w; i++) {
+ int k = j * 3 * w + i * 3;
+ sum[j] += (image[k+0] + image[k+1] + image[k+2]) / 3.0;
+ }
}
- return sum;
+
+ // find max of the row sums
+ if (sum[0] >= sum[1] && sum[0] >= sum[2])
+ return sum[0];
+ else if (sum[1] >= sum[0] && sum[1] >= sum[2])
+ return sum[1];
+ else
+ return sum[2];
}
@@ -152,13 +166,13 @@ PointAttenuationTest::testPointRendering(GLboolean smooth)
{
// epsilon is the allowed size difference in pixels between the
// expected and actual rendering.
- const GLfloat epsilon = smooth ? 1.5 : 1.0;
+ const GLfloat epsilon = (smooth ? 1.5 : 1.0) + 0.0;
GLfloat atten[3];
int count = 0;
// Enable front buffer if you want to see the rendering
- //glDrawBuffer(GL_FRONT);
- //glReadBuffer(GL_FRONT);
+ glDrawBuffer(GL_FRONT);
+ glReadBuffer(GL_FRONT);
if (smooth) {
glEnable(GL_POINT_SMOOTH);
@@ -192,6 +206,8 @@ PointAttenuationTest::testPointRendering(GLboolean smooth)
}
glEnd();
+ glFinish();
+
// test the column of points
for (float z = -6.0; z <= 6.0; z += 1.0) {
count++;
@@ -205,6 +221,10 @@ PointAttenuationTest::testPointRendering(GLboolean smooth)
expected, actual);
return false;
}
+ else if(0){
+ printf("pass z=%f exp=%f act=%f\n",
+ z, expected, actual);
+ }
}
}
}
@@ -252,6 +272,12 @@ PointAttenuationTest::PointAttenuationTest(const char *testName,
{
fWidth = windowWidth;
fHeight = windowHeight;
+ errorCode = GL_NO_ERROR;
+ errorPos = NULL;
+ for (int i = 0; i < 2; i++) {
+ aliasedLimits[i] = 0;
+ smoothLimits[i] = 0;
+ }
}
diff --git a/tests/glean/treadpixperf.cpp b/tests/glean/treadpixperf.cpp
index 7ad3d42d..813dfdb6 100644
--- a/tests/glean/treadpixperf.cpp
+++ b/tests/glean/treadpixperf.cpp
@@ -207,7 +207,7 @@ ReadpixPerfTest::runNonPBOtest(int formatNum, GLsizei width, GLsizei height,
delete buffer;
- double rate = width * height * iter / elapsedTime / 1000000.0;
+ double rate = static_cast<double>(width) * height * iter / elapsedTime / 1000000.0;
return rate;
}
@@ -299,7 +299,7 @@ ReadpixPerfTest::runPBOtest(int formatNum, GLsizei width, GLsizei height,
delete b;
#endif
- double rate = width * height * iter / elapsedTime / 1000000.0;
+ double rate = static_cast<double>(width) * height * iter / elapsedTime / 1000000.0;
return rate;
#else
return 0.0;
diff --git a/tests/glean/tshaderapi.cpp b/tests/glean/tshaderapi.cpp
index 1769bfdb..9c651bae 100644
--- a/tests/glean/tshaderapi.cpp
+++ b/tests/glean/tshaderapi.cpp
@@ -569,15 +569,12 @@ ShaderAPIResult::getresults(istream &s)
bool
ShaderAPITest::isApplicable() const
{
- const char *version = (const char *) glGetString(GL_VERSION);
- if (strncmp(version, "2.0", 3) == 0 ||
- strncmp(version, "2.1", 3) == 0 ||
- strncmp(version, "3.0", 3) == 0) {
+ if (GLUtils::getVersion() >= 2.0) {
return true;
}
else {
env->log << name
- << ": skipped. Requires GL 2.0, 2.1 or 3.0.\n";
+ << ": skipped. Requires GL >= 2.0.\n";
return false;
}
}
diff --git a/tests/glean/tstencil2.cpp b/tests/glean/tstencil2.cpp
index d0c783a8..7db3a06a 100644
--- a/tests/glean/tstencil2.cpp
+++ b/tests/glean/tstencil2.cpp
@@ -111,20 +111,13 @@ Stencil2Test::have_EXT_stencil_two_side(void) const
bool
Stencil2Test::have_GL2_stencil_two_side(void) const
{
- const char *version = (const char *) glGetString(GL_VERSION);
- if (strncmp(version, "2.", 2) == 0 ||
- strncmp(version, "3.0", 3) == 0) {
- return true;
- }
- return false;
+ return GLUtils::getVersion() >= 2.0;
}
bool
Stencil2Test::have_stencil_wrap(void) const
{
- const char *version = (const char *) glGetString(GL_VERSION);
- if (strncmp(version, "2.", 2) == 0 ||
- strncmp(version, "3.0", 3) == 0) {
+ if (GLUtils::getVersion() >= 2.0) {
return true;
}
else if (GLUtils::haveExtension("GL_EXT_stencil_wrap")) {
diff --git a/tests/glean/ttexcombine.cpp b/tests/glean/ttexcombine.cpp
index d4a43c2e..b2ee3168 100644
--- a/tests/glean/ttexcombine.cpp
+++ b/tests/glean/ttexcombine.cpp
@@ -1274,7 +1274,7 @@ TexCombineTest::RunMultiTextureTest(glmachine &machine, BasicResult &r,
// 2. Compute expected result
GLfloat prevColor[4];
- GLfloat expected[4];
+ GLfloat expected[4] = { 0 };
for (u = 0; u < machine.NumTexUnits; u++) {
if (u == 0) {
COPY4(prevColor, machine.FragColor);
diff --git a/tests/glean/ttexture_srgb.cpp b/tests/glean/ttexture_srgb.cpp
index 10909c0f..a79019ca 100644
--- a/tests/glean/ttexture_srgb.cpp
+++ b/tests/glean/ttexture_srgb.cpp
@@ -128,9 +128,9 @@ TextureSRGBTest::testImageTransfer(void)
env->log << "Expected value at ["
<< j
<< "] should be "
- << image[j]
+ << (int) image[j]
<< " found "
- << image2[j]
+ << (int) image2[j]
<< "\n";
delete [] image;
return false;
diff --git a/tests/glean/ttexunits.cpp b/tests/glean/ttexunits.cpp
index 8ac63d8d..62dd7501 100644
--- a/tests/glean/ttexunits.cpp
+++ b/tests/glean/ttexunits.cpp
@@ -1,6 +1,6 @@
// BEGIN_COPYRIGHT -*- glean -*-
//
-// Copyright (C) 2008 VMWare, Inc. All Rights Reserved.
+// Copyright (C) 2008 VMware, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@@ -69,11 +69,9 @@ TexUnitsTest::reportFailure(const char *msg, GLint unit) const
bool
TexUnitsTest::setup(void)
{
- // check that we have OpenGL 2.x or 3.x
- const char *verString = (const char *) glGetString(GL_VERSION);
-
- if (verString[0] != '2' && verString[0] != '3') {
- env->log << "OpenGL 2.x or 3.x not supported\n";
+ // check that we have at least OpenGL 2.0
+ if (GLUtils::getVersion() < 2.0) {
+ env->log << "OpenGL >= 2.0 not supported\n";
return false;
}
diff --git a/tests/glean/tvertarraybgra.cpp b/tests/glean/tvertarraybgra.cpp
index f13b461e..05e03bc2 100644
--- a/tests/glean/tvertarraybgra.cpp
+++ b/tests/glean/tvertarraybgra.cpp
@@ -70,8 +70,7 @@ VertArrayBGRATest::testAPI(void)
// Get glVertexAttrib() function
PFNGLVERTEXATTRIBPOINTERARBPROC VertexAttribPointer = NULL;
- const char *version = (const char *) glGetString(GL_VERSION);
- if (version[0] == '2') {
+ if (GLUtils::getVersion() >= 2.0) {
VertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERARBPROC)
GLUtils::getProcAddress("glVertexAttribPointer");
}
@@ -140,18 +139,18 @@ void
VertArrayBGRATest::renderPoints(bool useBGRA)
{
glVertexPointer(2, GL_FLOAT, 0, mPos);
- glEnable(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_VERTEX_ARRAY);
if (useBGRA)
glColorPointer(GL_BGRA, GL_UNSIGNED_BYTE, 0, mBGRA);
else
glColorPointer(4, GL_UNSIGNED_BYTE, 0, mRGBA);
- glEnable(GL_COLOR_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_POINTS, 0, NUM_POINTS);
- glDisable(GL_VERTEX_ARRAY);
- glDisable(GL_COLOR_ARRAY);
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
}
diff --git a/tests/glean/tvtxperf.cpp b/tests/glean/tvtxperf.cpp
index fa5bd877..90f9b338 100644
--- a/tests/glean/tvtxperf.cpp
+++ b/tests/glean/tvtxperf.cpp
@@ -31,7 +31,6 @@
#include "tvtxperf.h"
#include "geomutil.h"
#include "timer.h"
-#include "rand.h"
#include "image.h"
#include "codedid.h"
#include "treadpix.h"