summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-12-09 13:44:55 -0800
committerEric Anholt <eric@anholt.net>2009-12-09 13:44:55 -0800
commit1059cb6712faee4f5d59459ed937cbefaf57125b (patch)
treef868e1ff7081f27994186d2adc7f48de4961e10f
parent9a6cb4b2ac1e50a957dadbda3233216d4ab0cd87 (diff)
-rw-r--r--tests/glean/dsconfig.cpp117
-rw-r--r--tests/glean/dsconfig.h4
-rw-r--r--tests/glean/glwrap.h310
-rw-r--r--tests/glean/tblend.cpp14
-rw-r--r--tests/glean/tglsl1.cpp68
-rw-r--r--tests/glean/toccluqry.cpp86
-rw-r--r--tests/glean/toccluqry.h2
-rw-r--r--tests/glean/tpointsprite.cpp97
-rw-r--r--tests/glean/tpointsprite.h3
-rw-r--r--tests/glean/treadpixperf.cpp7
-rw-r--r--tests/glean/treadpixperf.h2
-rw-r--r--tests/glean/tshaderapi.cpp21
12 files changed, 641 insertions, 90 deletions
diff --git a/tests/glean/dsconfig.cpp b/tests/glean/dsconfig.cpp
index cf2f769c9..0d9e23ead 100644
--- a/tests/glean/dsconfig.cpp
+++ b/tests/glean/dsconfig.cpp
@@ -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
diff --git a/tests/glean/dsconfig.h b/tests/glean/dsconfig.h
index ea7ffd7cf..382766215 100644
--- a/tests/glean/dsconfig.h
+++ b/tests/glean/dsconfig.h
@@ -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
diff --git a/tests/glean/glwrap.h b/tests/glean/glwrap.h
index 18136ca82..557c30233 100644
--- a/tests/glean/glwrap.h
+++ b/tests/glean/glwrap.h
@@ -74,8 +74,12 @@
# 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)
+# define APIENTRY
+# endif
# if !defined(GLAPIENTRY)
# define GLAPIENTRY
# endif
@@ -117,6 +121,78 @@
#define GL_OPERAND2_ALPHA_EXT GL_OPERAND2_ALPHA_ARB
#endif
#endif
+
+
+#ifndef GL_EXT_texture_swizzle
+#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42
+#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43
+#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44
+#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45
+#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46
+#endif
+
+
+#ifndef GL_EXT_texture_sRGB
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB8_EXT 0x8C41
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_SLUMINANCE_ALPHA_EXT 0x8C44
+#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
+#define GL_SLUMINANCE_EXT 0x8C46
+#define GL_SLUMINANCE8_EXT 0x8C47
+#define GL_COMPRESSED_SRGB_EXT 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
+#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
+#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
+#endif
+
+
+#ifndef GL_NV_texture_env_combine4
+#define GL_COMBINE4_NV 0x8503
+#define GL_SOURCE3_RGB_NV 0x8583
+#define GL_SOURCE3_ALPHA_NV 0x858B
+#define GL_OPERAND3_RGB_NV 0x8593
+#define GL_OPERAND3_ALPHA_NV 0x859B
+#endif
+
+
+#ifndef GL_NV_texture_env_combine4
+#define GL_COMBINE4_NV 0x8503
+#define GL_SOURCE3_RGB_NV 0x8583
+#define GL_SOURCE3_ALPHA_NV 0x858B
+#define GL_OPERAND3_RGB_NV 0x8593
+#define GL_OPERAND3_ALPHA_NV 0x859B
+#endif
+
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C
+#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
+#define GL_PROVOKING_VERTEX_EXT 0x8E4F
+#endif
+
+
+#ifndef GL_ARB_map_buffer_range
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#endif
+
+
+#ifdef __APPLE__
+typedef unsigned short GLhalfARB;
+#endif
+
+
// Windows has a convention for typedef'ing pointers to OpenGL functions
// which encapsulates some of the oddities of Win32 calling conventions.
// Identical conventions are being established for Linux, but they are
@@ -345,6 +421,240 @@ typedef void (GLAPIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) ( const GLfloat m[1
typedef void (GLAPIENTRY * PFNGLSAMPLEPASSARBPROC) (GLenum pass);
typedef void (GLAPIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
+// GL_VERSION_1_2
+typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (GLAPIENTRY * PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (GLAPIENTRY * PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+
+// GL_VERSION_1_3
+typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
+
+// GL_VERSION_1_3_DEPRECATED
+typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
+
+// GL_VERSION_1_4
+typedef void (GLAPIENTRY * PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GLAPIENTRY * PFNGLFOGCOORDFPROC) (GLfloat coord);
+typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
+typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
+typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
+typedef void (GLAPIENTRY * PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+
+// GL_VERSION_1_5
+typedef void (GLAPIENTRY * PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
+typedef void (GLAPIENTRY * PFNGLENDQUERYPROC) (GLenum target);
+typedef void (GLAPIENTRY * PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
+typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERPROC) (GLenum target);
+
+// GL_VERSION_2_0
+typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
+typedef void (GLAPIENTRY * PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
+typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+typedef void (GLAPIENTRY * PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
+typedef void (GLAPIENTRY * PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GLAPIENTRY * PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
+typedef void (GLAPIENTRY * PFNGLCOMPILESHADERPROC) (GLuint shader);
+typedef GLuint (GLAPIENTRY * PFNGLCREATEPROGRAMPROC) (void);
+typedef GLuint (GLAPIENTRY * PFNGLCREATESHADERPROC) (GLenum type);
+typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMPROC) (GLuint program);
+typedef void (GLAPIENTRY * PFNGLDELETESHADERPROC) (GLuint shader);
+typedef void (GLAPIENTRY * PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (GLAPIENTRY * PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GLAPIENTRY * PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (GLAPIENTRY * PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GLAPIENTRY * PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (GLAPIENTRY * PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
+typedef GLint (GLAPIENTRY * PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
+typedef void (GLAPIENTRY * PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GLAPIENTRY * PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
+typedef void (GLAPIENTRY * PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GLAPIENTRY * PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+typedef GLint (GLAPIENTRY * PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (GLAPIENTRY * PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
+typedef void (GLAPIENTRY * PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
+typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMPROC) (GLuint program);
+typedef GLboolean (GLAPIENTRY * PFNGLISSHADERPROC) (GLuint shader);
+typedef void (GLAPIENTRY * PFNGLLINKPROGRAMPROC) (GLuint program);
+typedef void (GLAPIENTRY * PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
+typedef void (GLAPIENTRY * PFNGLUSEPROGRAMPROC) (GLuint program);
+typedef void (GLAPIENTRY * PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
+typedef void (GLAPIENTRY * PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
+typedef void (GLAPIENTRY * PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GLAPIENTRY * PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GLAPIENTRY * PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
+typedef void (GLAPIENTRY * PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
+typedef void (GLAPIENTRY * PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GLAPIENTRY * PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GLAPIENTRY * PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GLAPIENTRY* PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GLAPIENTRY * PFNGLVALIDATEPROGRAMPROC) (GLuint program);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+
+// GL_VERSION_2_1
+typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GLAPIENTRY * PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+
+// GL_ARB_point_parameters
+typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);
+typedef void (GLAPIENTRY * PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params);
+
+// GL_ARB_window_pos
+typedef void (GLAPIENTRY * PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);
+
+// GL_ARB_vertex_program
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);
+typedef void (GLAPIENTRY * PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+typedef void (GLAPIENTRY * PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+typedef void (GLAPIENTRY * PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
+typedef void (GLAPIENTRY * PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
+typedef void (GLAPIENTRY * PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
+typedef void (GLAPIENTRY * PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
+typedef void (GLAPIENTRY * PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GLAPIENTRY * PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef GLboolean (GLAPIENTRY * PFNGLISPROGRAMARBPROC) (GLuint program);
+
+// GL_ARB_vertex_buffer_object
+typedef void (GLAPIENTRY * PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
+typedef void (GLAPIENTRY * PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
+typedef void (GLAPIENTRY * PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
+typedef GLboolean (GLAPIENTRY * PFNGLISBUFFERARBPROC) (GLuint buffer);
+typedef void (GLAPIENTRY * PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
+typedef void (GLAPIENTRY * PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
+typedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
+typedef GLboolean (GLAPIENTRY * PFNGLUNMAPBUFFERARBPROC) (GLenum target);
+
+// GL_ARB_occlusion_query
+typedef void (GLAPIENTRY * PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids);
+typedef void (GLAPIENTRY * PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GLAPIENTRY * PFNGLISQUERYARBPROC) (GLuint id);
+typedef void (GLAPIENTRY * PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);
+typedef void (GLAPIENTRY * PFNGLENDQUERYARBPROC) (GLenum target);
+typedef void (GLAPIENTRY * PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (GLAPIENTRY * PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params);
+
+// GL_ARB_map_buffer_range
+typedef GLvoid* (GLAPIENTRY * PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GLAPIENTRY * PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+
+// GL_ARB_copy_buffer
+typedef void (GLAPIENTRY * PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+
+// GL_EXT_stencil_two_side
+typedef void (GLAPIENTRY * PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
+
+// GL_ATI_separate_stencil
+typedef void (GLAPIENTRY * PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GLAPIENTRY * PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+
+// GL_EXT_framebuffer_object
+typedef GLboolean (GLAPIENTRY * PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
+typedef void (GLAPIENTRY * PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
+typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (GLAPIENTRY * PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GLAPIENTRY * PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLboolean (GLAPIENTRY * PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
+typedef void (GLAPIENTRY * PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
+typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (GLAPIENTRY * PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
+typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);
+typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GLAPIENTRY * PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+
+// GL_EXT_provoking_vertex
+typedef void (GLAPIENTRY * PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
+
// OpenGL 1.2 enumerants, to allow glean to be compiled on OpenGL 1.1 systems.
// (This odd workaround is needed to handle problems with some copies of
// glext.h that are floating around the net.)
diff --git a/tests/glean/tblend.cpp b/tests/glean/tblend.cpp
index 9b4c458ec..057ee4a33 100644
--- a/tests/glean/tblend.cpp
+++ b/tests/glean/tblend.cpp
@@ -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);
}
diff --git a/tests/glean/tglsl1.cpp b/tests/glean/tglsl1.cpp
index 79ac78e67..9eca6bf9e 100644
--- a/tests/glean/tglsl1.cpp
+++ b/tests/glean/tglsl1.cpp
@@ -606,6 +606,39 @@ static const ShaderProgram Programs[] = {
},
{
+ // 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,
"uniform vec4 uniform1; \n"
@@ -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",
diff --git a/tests/glean/toccluqry.cpp b/tests/glean/toccluqry.cpp
index 4d4904528..580c34604 100644
--- a/tests/glean/toccluqry.cpp
+++ b/tests/glean/toccluqry.cpp
@@ -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;
}
diff --git a/tests/glean/toccluqry.h b/tests/glean/toccluqry.h
index 2dc382d70..552022eba 100644
--- a/tests/glean/toccluqry.h
+++ b/tests/glean/toccluqry.h
@@ -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
diff --git a/tests/glean/tpointsprite.cpp b/tests/glean/tpointsprite.cpp
index 8cb25740f..7a29d3a89 100644
--- a/tests/glean/tpointsprite.cpp
+++ b/tests/glean/tpointsprite.cpp
@@ -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]);
diff --git a/tests/glean/tpointsprite.h b/tests/glean/tpointsprite.h
index ed04c8f56..089afa057 100644
--- a/tests/glean/tpointsprite.h
+++ b/tests/glean/tpointsprite.h
@@ -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
diff --git a/tests/glean/treadpixperf.cpp b/tests/glean/treadpixperf.cpp
index 0cde676d3..7ad3d42d7 100644
--- a/tests/glean/treadpixperf.cpp
+++ b/tests/glean/treadpixperf.cpp
@@ -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';
s << res.work << '\n';
}
}
@@ -522,6 +524,7 @@ ReadpixPerfResult::getresults(istream &s)
>> res.height
>> res.formatNum
>> res.pboMode
+ >> res.readBuf
>> res.work;
results.push_back(res);
}
diff --git a/tests/glean/treadpixperf.h b/tests/glean/treadpixperf.h
index 8e710f918..d98aae807 100644
--- a/tests/glean/treadpixperf.h
+++ b/tests/glean/treadpixperf.h
@@ -50,7 +50,7 @@ public:
int work; // really bool
void sprint(char *s) const;
void print(Environment *env) const;
- const char *readBuf; // "GL_FRONT" or "GL_BACK"
+ char readBuf[10]; // "GL_FRONT" or "GL_BACK"
};
bool pass;
diff --git a/tests/glean/tshaderapi.cpp b/tests/glean/tshaderapi.cpp
index 662428c06..1769bfdba 100644
--- a/tests/glean/tshaderapi.cpp
+++ b/tests/glean/tshaderapi.cpp
@@ -271,8 +271,6 @@ ShaderAPITest::test_uniform_size_type1(const char *glslType, GLenum glType, cons
char buffer[1024];
GLuint program;
GLint active, i;
- GLenum type;
- GLint size;
//printf(" Running subtest %s\n", glslType);
//fflush(stdout);
@@ -283,17 +281,16 @@ ShaderAPITest::test_uniform_size_type1(const char *glslType, GLenum glType, cons
glGetProgramiv_func(program, GL_ACTIVE_UNIFORMS, &active);
assert_no_error();
for (i = 0; i < active; i++) {
- size = -1;
- type = 0;
+ GLint size = -1;
+ GLenum type = 0;
glGetActiveUniform_func(program, i, sizeof(buffer), NULL,
&size, &type, buffer);
assert_no_error();
+ assert(type == glType);
+ assert(size == 60);
if (strncmp(buffer, "m", 1) == 0)
break;
}
- assert(i < active); /* Otherwise the compiler optimised it out */
- assert(type == glType);
- assert(size == 60);
}
@@ -333,8 +330,6 @@ ShaderAPITest::test_attrib_size_type1(const char *glslType, GLenum glType, const
char buffer[1024];
GLuint program;
GLint active, i;
- GLenum type;
- GLint size;
//printf(" Running subtest %s\n", glslType);
//fflush(stdout);
@@ -345,17 +340,17 @@ ShaderAPITest::test_attrib_size_type1(const char *glslType, GLenum glType, const
glGetProgramiv_func(program, GL_ACTIVE_ATTRIBUTES, &active);
assert_no_error();
for (i = 0; i < active; i++) {
- size = -1;
- type = -1;
+ GLint size = -1;
+ GLenum type = 0;
glGetActiveAttrib_func(program, i, sizeof(buffer), NULL,
&size, &type, buffer);
assert_no_error();
+ assert(type == glType);
+ assert(size == 1);
if (strncmp(buffer, "m", 1) == 0)
break;
}
assert(i < active); /* Otherwise the compiler optimised it out */
- assert(type == glType);
- assert(size == 1);
}