aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/bugs/fdo24066.c2
-rw-r--r--tests/bugs/point-sprite.c43
-rw-r--r--tests/bugs/r300-readcache.c27
-rw-r--r--tests/bugs/tex1d-2dborder.c90
-rw-r--r--tests/general/bgra-sec-color-pointer.c48
-rw-r--r--tests/general/bgra-vert-attrib-pointer.c50
-rw-r--r--tests/general/clear-varray-2.0.c64
-rw-r--r--tests/general/depth_clamp.c48
-rw-r--r--tests/general/depthrange-clear.c55
-rw-r--r--tests/general/dlist-clear.c60
-rw-r--r--tests/general/draw-elements-base-vertex.c37
-rw-r--r--tests/general/linestipple.c56
-rw-r--r--tests/general/occlusion_query.c64
-rw-r--r--tests/general/pbo-drawpixels.c55
-rw-r--r--tests/general/pbo-teximage.c55
-rw-r--r--tests/general/provoking-vertex.c43
-rw-r--r--tests/general/read-front.c56
-rw-r--r--tests/general/scissor-copypixels.c60
-rw-r--r--tests/general/scissor-depth-clear.c54
-rw-r--r--tests/general/scissor-stencil-clear.c66
-rw-r--r--tests/general/stencil-drawpixels.c65
-rw-r--r--tests/general/varray-disabled.c60
-rw-r--r--tests/general/vbo-map-remap.c49
-rw-r--r--tests/general/vbo-subdata-sync.c49
-rw-r--r--tests/shaders/fp-abs-01.c2
-rw-r--r--tests/shaders/fp-abs-02.c2
-rw-r--r--tests/shaders/fp-condition_codes-01.c2
-rw-r--r--tests/shaders/fp-fog.c65
-rw-r--r--tests/shaders/fp-fragment-position.c69
-rw-r--r--tests/shaders/fp-generic.c50
-rw-r--r--tests/shaders/fp-incomplete-tex.c69
-rw-r--r--tests/shaders/fp-indirections.c33
-rw-r--r--tests/shaders/fp-indirections2.c3
-rw-r--r--tests/shaders/fp-kil.c69
-rw-r--r--tests/shaders/fp-lit-mask.c68
-rw-r--r--tests/shaders/fp-rfl.c2
-rw-r--r--tests/shaders/fp-set-01.c2
-rw-r--r--tests/shaders/fp-set-02.c2
-rw-r--r--tests/shaders/fp-unpack-01.c2
-rw-r--r--tests/shaders/glsl-bug-22603.c59
-rw-r--r--tests/shaders/glsl-deriv-varyings.c66
-rw-r--r--tests/shaders/glsl-derivs.c66
-rw-r--r--tests/shaders/glsl-dlist-getattriblocation.c2
-rw-r--r--tests/shaders/glsl-empty-vs-no-fs.c31
-rw-r--r--tests/shaders/glsl-fs-exp2.c63
-rw-r--r--tests/shaders/glsl-fs-fragcoord.c68
-rw-r--r--tests/shaders/glsl-fs-log2.c63
-rw-r--r--tests/shaders/glsl-fwidth.c68
-rw-r--r--tests/shaders/glsl-lod-bias.c64
-rw-r--r--tests/shaders/glsl-uniform-update.c64
-rw-r--r--tests/shaders/glsl-unused-varying.c62
-rw-r--r--tests/shaders/glsl-vs-if-bool.c75
-rw-r--r--tests/shaders/glsl-vs-if.c76
-rw-r--r--tests/shaders/glsl-vs-loop.c60
-rw-r--r--tests/shaders/trinity-fp1.c73
-rw-r--r--tests/shaders/vp-bad-program.c34
-rw-r--r--tests/shaders/vp-ignore-input.c48
-rw-r--r--tests/shaders/vpfp-generic.cpp12
-rw-r--r--tests/texturing/depth-tex-modes-glsl.c60
-rw-r--r--tests/texturing/gen-compressed-teximage.c51
-rw-r--r--tests/texturing/gen-teximage.c63
-rw-r--r--tests/texturing/gen-texsubimage.c60
-rw-r--r--tests/texturing/getteximage-simple.c60
-rw-r--r--tests/texturing/tex3d.c46
-rw-r--r--tests/texturing/texrect-many.c75
-rw-r--r--tests/texturing/texredefine.c55
-rw-r--r--tests/util/piglit-framework.c2
-rw-r--r--tests/util/piglit-framework.h2
-rw-r--r--tests/util/piglit-util.h6
69 files changed, 774 insertions, 2456 deletions
diff --git a/tests/bugs/fdo24066.c b/tests/bugs/fdo24066.c
index b2bc2571..c81fe85c 100644
--- a/tests/bugs/fdo24066.c
+++ b/tests/bugs/fdo24066.c
@@ -40,7 +40,7 @@ int piglit_width = 16;
int piglit_height = 16;
-int piglit_display()
+enum piglit_result piglit_display()
{
return PIGLIT_SUCCESS;
}
diff --git a/tests/bugs/point-sprite.c b/tests/bugs/point-sprite.c
index 5a8b1949..3a19c62c 100644
--- a/tests/bugs/point-sprite.c
+++ b/tests/bugs/point-sprite.c
@@ -29,15 +29,21 @@
*/
#include "piglit-util.h"
+#include "piglit-framework.h"
+
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB;
+int piglit_width = 400;
+int piglit_height = 300;
-static GLboolean Automatic = GL_FALSE;
static float maxSize = 0.0f;
static GLuint tex;
static void
-Init(void)
+loadTex(void);
+
+void
+piglit_init(int argc, char **argv)
{
- glewInit();
piglit_require_extension("GL_ARB_point_sprite");
glMatrixMode(GL_PROJECTION);
@@ -58,10 +64,11 @@ Init(void)
glClearColor(0.2, 0.2, 0.2, 1.0);
glColor3f(1.0, 1.0, 1.0);
+ loadTex();
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
static const GLfloat black[3] = {0.0, 0.0, 0.0};
GLboolean pass;
@@ -112,11 +119,9 @@ display(void)
white);
}
-
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-
glutSwapBuffers();
+
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
@@ -158,23 +163,3 @@ loadTex(void)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
GL_FLOAT, texData);
}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1],"-auto",5))
- Automatic = GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("point_sprite");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- Init();
-
- loadTex();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/bugs/r300-readcache.c b/tests/bugs/r300-readcache.c
index ec02f6c1..be415775 100644
--- a/tests/bugs/r300-readcache.c
+++ b/tests/bugs/r300-readcache.c
@@ -16,8 +16,10 @@
*/
#include "piglit-util.h"
+#include "piglit-framework.h"
-static int Width = 100, Height = 100;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGBA;
static GLfloat colors[8][3] = {
{ 1.0, 1.0, 1.0 },
@@ -30,7 +32,7 @@ static GLfloat colors[8][3] = {
{ 0.0, 0.0, 0.0 }
};
-static void Display(void)
+enum piglit_result piglit_display(void)
{
int x, y, color, i, comp;
/* x and y range chosen to cover a wide range of memory;
@@ -57,7 +59,7 @@ static void Display(void)
x, y, color,
colors[color][0], colors[color][1], colors[color][2],
result[0], result[1], result[2]);
- piglit_report_result(PIGLIT_FAILURE);
+ return PIGLIT_FAILURE;
}
}
}
@@ -65,23 +67,12 @@ static void Display(void)
}
}
- piglit_report_result(PIGLIT_SUCCESS);
+ return PIGLIT_SUCCESS;
}
-static void init(void)
+void piglit_init(int argc, char **argv)
{
- glViewport(0, 0, Width, Height);
-}
-
+ piglit_automatic = GL_TRUE;
-int main(int argc, char**argv)
-{
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
- glutInitWindowSize(Width, Height);
- glutCreateWindow(argv[0]);
- glutDisplayFunc(Display);
- init();
- glutMainLoop();
- return 0;
+ glViewport(0, 0, piglit_width, piglit_height);
}
diff --git a/tests/bugs/tex1d-2dborder.c b/tests/bugs/tex1d-2dborder.c
index e7b657b8..b2460f40 100644
--- a/tests/bugs/tex1d-2dborder.c
+++ b/tests/bugs/tex1d-2dborder.c
@@ -31,14 +31,15 @@
*/
#include "piglit-util.h"
+#include "piglit-framework.h"
-static int Width = 256, Height = 128;
-static int Automatic = 0;
+int piglit_width = 256, piglit_height = 128;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static const GLfloat TextureColor[3] = { 1.0, 0.5, 0.0 };
-static void test(GLenum wrapt, int cellx, int celly)
+static GLboolean test(GLenum wrapt, int cellx, int celly)
{
int sx, sy;
@@ -59,59 +60,48 @@ static void test(GLenum wrapt, int cellx, int celly)
/* Take more than one sample, just to be sure */
for(sy = 0; sy < 4; ++sy) {
for(sx = 0; sx < 4; ++sx) {
- int x = (cellx*5 + sx + 1)*Width/20;
- int y = (celly*5 + sy + 1)*Height/10;
+ int x = (cellx*5 + sx + 1)*piglit_width/20;
+ int y = (celly*5 + sy + 1)*piglit_height/10;
if (!piglit_probe_pixel_rgb(x, y, TextureColor)) {
fprintf(stderr, "Fail in cell %i,%i (texwrap = 0x%x)\n", cellx, celly, wrapt);
- if (Automatic)
- piglit_report_result(PIGLIT_FAILURE);
+ return GL_FALSE;
}
}
}
+
+ return GL_TRUE;
}
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
+ GLboolean pass = GL_TRUE;
+
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
/* Draw eight tiles, each with a different tex wrap mode.
* They should all look the same.
*/
- test(GL_REPEAT, 0, 0);
- test(GL_CLAMP, 1, 0);
- test(GL_CLAMP_TO_EDGE, 2, 0);
- test(GL_CLAMP_TO_BORDER, 3, 0);
- test(GL_MIRRORED_REPEAT, 0, 1);
+ pass &= test(GL_REPEAT, 0, 0);
+ pass &= test(GL_CLAMP, 1, 0);
+ pass &= test(GL_CLAMP_TO_EDGE, 2, 0);
+ pass &= test(GL_CLAMP_TO_BORDER, 3, 0);
+ pass &= test(GL_MIRRORED_REPEAT, 0, 1);
if (glutExtensionSupported("GL_EXT_texture_mirror_clamp")) {
- test(GL_MIRROR_CLAMP_EXT, 1, 1);
- test(GL_MIRROR_CLAMP_TO_EDGE_EXT, 2, 1);
- test(GL_MIRROR_CLAMP_TO_BORDER_EXT, 3, 1);
+ pass &= test(GL_MIRROR_CLAMP_EXT, 1, 1);
+ pass &= test(GL_MIRROR_CLAMP_TO_EDGE_EXT, 2, 1);
+ pass &= test(GL_MIRROR_CLAMP_TO_BORDER_EXT, 3, 1);
}
glutSwapBuffers();
- if (Automatic)
- piglit_report_result(PIGLIT_SUCCESS);
-}
-
-
-static void Reshape(int width, int height)
-{
- Width = width;
- Height = height;
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-
-static void Init(void)
+void piglit_init(int argc, char **argv)
{
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -119,38 +109,8 @@ static void Init(void)
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, 1, 0, GL_RGB, GL_FLOAT, TextureColor);
glEnable(GL_TEXTURE_1D);
- Reshape(Width,Height);
-}
+ piglit_ortho_projection(1.0, 1.0, GL_FALSE);
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutDisplayFunc(Redisplay);
- if (!Automatic) {
+ if (!piglit_automatic)
printf("You should see a flat orange color\n");
- glutKeyboardFunc(Key);
- }
- Init();
- glutMainLoop();
- return 0;
}
-
diff --git a/tests/general/bgra-sec-color-pointer.c b/tests/general/bgra-sec-color-pointer.c
index bdef1389..a7c40cb1 100644
--- a/tests/general/bgra-sec-color-pointer.c
+++ b/tests/general/bgra-sec-color-pointer.c
@@ -32,7 +32,8 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static GLfloat verts[12] = {225.0, 175.0, 0.0,
225.0, 225.0, 0.0,
@@ -46,23 +47,13 @@ static GLubyte colors[16] = {255, 0, 0, 127,
255, 0, 0, 127};
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
-
- glewInit();
-
piglit_require_extension("GL_EXT_secondary_color");
piglit_require_extension("GL_EXT_vertex_array_bgra");
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glEnable(GL_COLOR_SUM);
glColor3f(0.0, 0.0, 0.0);
@@ -70,8 +61,8 @@ Init(void)
glClearColor(0.6, 0.6, 0.6, 1.0);
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
GLfloat red[3]={1.0, 0.0, 0.0};
@@ -119,35 +110,12 @@ display(void)
pass = pass && piglit_probe_pixel_rgb(200, 125, greyRed);
pass = pass && piglit_probe_pixel_rgb(275, 125, greyBlue);
- if(Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
-
glFinish();
glutSwapBuffers();
glDisable(GL_BLEND);
glDisableClientState(GL_SECONDARY_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("bgra-sec-color-pointer");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- Init();
-
- glutMainLoop();
-
- return 0;
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-
diff --git a/tests/general/bgra-vert-attrib-pointer.c b/tests/general/bgra-vert-attrib-pointer.c
index f68a95dc..97284414 100644
--- a/tests/general/bgra-vert-attrib-pointer.c
+++ b/tests/general/bgra-vert-attrib-pointer.c
@@ -31,7 +31,9 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLint prog;
static GLint fs;
static GLint vs;
@@ -103,26 +105,17 @@ compileLinkProg(void)
}
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
-
- glewInit();
-
if (!GLEW_VERSION_2_0) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
}
- piglit_require_extension("GL_EXT_vertex_array_bgra");
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
+ piglit_require_extension("GL_EXT_vertex_array_bgra");
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glClearColor(0.6, 0.6, 0.6, 1.0);
@@ -130,8 +123,8 @@ Init(void)
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
GLfloat red[3]={1.0, 0.0, 0.0};
@@ -191,33 +184,10 @@ display(void)
pass = pass && piglit_probe_pixel_rgb(200, 125, greyRed);
pass = pass && piglit_probe_pixel_rgb(275, 125, greyBlue);
- if(Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
-
glFinish();
glutSwapBuffers();
glDisable(GL_BLEND);
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("bgra-vert-attrib-pointer");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- Init();
-
- glutMainLoop();
-
- return 0;
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-
diff --git a/tests/general/clear-varray-2.0.c b/tests/general/clear-varray-2.0.c
index ac9a0e04..bc3e8c60 100644
--- a/tests/general/clear-varray-2.0.c
+++ b/tests/general/clear-varray-2.0.c
@@ -34,8 +34,8 @@
#include "piglit-util.h"
-#define WIN_WIDTH 200
-#define WIN_HEIGHT 100
+int piglit_width = 200, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH;
/* apply MVP and set the color to blue. */
static const GLchar *const vp_code =
@@ -55,10 +55,8 @@ static const GLchar *const fp_code =
"END"
;
-static GLboolean Automatic = GL_FALSE;
-
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
float vertices[4][4];
@@ -115,29 +113,29 @@ display(void)
glutSwapBuffers();
- if (Automatic) {
- printf("PIGLIT: {'result': '%s' }\n",
- pass ? "pass" : "fail");
- exit(pass ? 0 : 1);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
GLuint vert_prog, frag_prog;
- reshape(WIN_WIDTH, WIN_HEIGHT);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ reshape(piglit_width, piglit_height);
+
+ piglit_require_extension("GL_ARB_fragment_program");
+ piglit_require_extension("GL_ARB_vertex_program");
glGenProgramsARB(1, &vert_prog);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vert_prog);
@@ -152,31 +150,3 @@ init(void)
glEnable(GL_VERTEX_PROGRAM_ARB);
glEnable(GL_FRAGMENT_PROGRAM_ARB);
}
-
-int main(int argc, char**argv)
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("clear-varray-2.0");
- glutReshapeFunc(reshape);
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- glewInit();
-
- init();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- }
- piglit_require_extension("GL_ARB_fragment_program");
- piglit_require_extension("GL_ARB_vertex_program");
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/general/depth_clamp.c b/tests/general/depth_clamp.c
index 8b66fedb..2d8889ab 100644
--- a/tests/general/depth_clamp.c
+++ b/tests/general/depth_clamp.c
@@ -36,34 +36,24 @@
#include "piglit-util.h"
+int piglit_width = 100, piglit_height = 150;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH;
+
/* In case the headers have the old enum name but not the new */
#ifndef GL_DEPTH_CLAMP
#define GL_DEPTH_CLAMP GL_DEPTH_CLAMP_NV
#endif
-static GLboolean Automatic = GL_FALSE;
-
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 150
-
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
- glewInit();
piglit_require_extension("GL_ARB_depth_clamp");
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
float white[3] = {1.0, 1.0, 1.0};
@@ -160,25 +150,5 @@ display(void)
glutSwapBuffers();
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if (argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("depth_clamp");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- init();
-
- glutMainLoop();
-
- return 0;
-
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/general/depthrange-clear.c b/tests/general/depthrange-clear.c
index 11e6d29c..6a2a510c 100644
--- a/tests/general/depthrange-clear.c
+++ b/tests/general/depthrange-clear.c
@@ -33,11 +33,8 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
-
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH;
/**
* Convenience function to draw an axis-aligned rectangle.
@@ -81,7 +78,8 @@ draw_rect_set(int y)
draw_rect(70, y, 10, 10, .75);
}
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
int x, y;
@@ -127,52 +125,21 @@ static void display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-static void
-init(void)
-{
- reshape(WIN_WIDTH, WIN_HEIGHT);
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-int main(int argc, char**argv)
+void
+piglit_init(int argc, char **argv)
{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("depthrange-clear");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
+ reshape(piglit_width, piglit_height);
}
diff --git a/tests/general/dlist-clear.c b/tests/general/dlist-clear.c
index 152e580c..b6b152a7 100644
--- a/tests/general/dlist-clear.c
+++ b/tests/general/dlist-clear.c
@@ -34,13 +34,11 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
-
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
int x, y;
@@ -79,8 +77,8 @@ static void display(void)
glCallList(1);
- for (y = 0; y < win_height; y++) {
- for (x = 0; x < win_width; x++) {
+ for (y = 0; y < piglit_height; y++) {
+ for (x = 0; x < piglit_width; x++) {
float *expected;
if (x >= 30 && x < 40 && y >= 10 && y < 20)
@@ -94,52 +92,20 @@ static void display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
-
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
+ piglit_width = width;
+ piglit_height = height;
-static void
-init(void)
-{
- reshape(WIN_WIDTH, WIN_HEIGHT);
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-int main(int argc, char**argv)
+void
+piglit_init(int argc, char **argv)
{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("dlist-clear");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
+ reshape(piglit_width, piglit_height);
}
diff --git a/tests/general/draw-elements-base-vertex.c b/tests/general/draw-elements-base-vertex.c
index 6465e226..7ba327a0 100644
--- a/tests/general/draw-elements-base-vertex.c
+++ b/tests/general/draw-elements-base-vertex.c
@@ -61,16 +61,15 @@ typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode,
static PFNGLDRAWELEMENTSBASEVERTEXPROC pglDrawElementsBaseVertex = NULL;
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 300, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-#define WIN_WIDTH 300
-#define WIN_HEIGHT 300
#define NUM_QUADS 10
static GLuint ib_offset;
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
GLfloat *vb;
GLuint *ib;
@@ -124,8 +123,8 @@ init(void)
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, vbo);
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
float white[3] = {1.0, 1.0, 1.0};
@@ -140,7 +139,7 @@ display(void)
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ glOrtho(0, piglit_width, 0, piglit_height, -1, 1);
glTranslatef(i * 20, 0, 0);
pglDrawElementsBaseVertex(GL_QUADS, 8, GL_UNSIGNED_INT,
@@ -166,25 +165,5 @@ display(void)
glutSwapBuffers();
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if (argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("draw-elements-base-vertex");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- init();
-
- glutMainLoop();
-
- return 0;
-
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/general/linestipple.c b/tests/general/linestipple.c
index c3fc55ef..6d0b385e 100644
--- a/tests/general/linestipple.c
+++ b/tests/general/linestipple.c
@@ -28,13 +28,13 @@
#include "piglit-util.h"
-static int Width = 128, Height = 128;
-static int Automatic = 0;
+int piglit_width = 128, piglit_height = 128;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static void probe_pixel(int x, int y, const float* expected)
{
if (!piglit_probe_pixel_rgb(x, y, expected)) {
- if (Automatic)
+ if (piglit_automatic)
piglit_report_result(PIGLIT_FAILURE);
}
}
@@ -180,60 +180,26 @@ static void test(void)
}
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
test();
- if (Automatic)
- piglit_report_result(PIGLIT_SUCCESS);
+ return PIGLIT_SUCCESS;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void Init(void)
+void piglit_init(int argc, char **argv)
{
- Reshape(Width,Height);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
- glutDisplayFunc(Redisplay);
- if (!Automatic)
- glutKeyboardFunc(Key);
- Init();
- glutMainLoop();
- return 0;
+ Reshape(piglit_width, piglit_height);
}
-
diff --git a/tests/general/occlusion_query.c b/tests/general/occlusion_query.c
index c52c1545..9ff0074a 100644
--- a/tests/general/occlusion_query.c
+++ b/tests/general/occlusion_query.c
@@ -31,8 +31,8 @@
#include "piglit-util.h"
-static int Width = 180, Height = 100;
-static int Automatic = 0;
+int piglit_width = 180, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH;
#define MAX_QUERIES 5
static GLuint occ_queries[MAX_QUERIES];
@@ -132,7 +132,8 @@ static int do_test(float x, int all_at_once)
return test_pass;
}
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
int test_pass;
@@ -143,34 +144,27 @@ static void Redisplay(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result(test_pass
- ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return test_pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void Init(void)
+void
+piglit_init(int argc, char **argv)
{
GLint query_bits;
+ glutReshapeFunc(Reshape);
- glewInit();
-
- Reshape(Width,Height);
+ Reshape(piglit_width, piglit_height);
glClearColor(0.0, 0.2, 0.3, 0.0);
glClearDepth(1.0);
@@ -193,7 +187,6 @@ static void Init(void)
get_query_objectiv = GLEW_GET_FUN(__glewGetQueryObjectivARB);
} else {
piglit_report_result(PIGLIT_SKIP);
- exit(1);
}
@@ -205,41 +198,8 @@ static void Init(void)
& query_bits);
if (query_bits == 0) {
piglit_report_result(PIGLIT_SKIP);
- exit(1);
}
(*gen_queries)(MAX_QUERIES, occ_queries);
}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutDisplayFunc(Redisplay);
- if (!Automatic)
- glutKeyboardFunc(Key);
- Init();
- glutMainLoop();
- return 0;
-}
-
diff --git a/tests/general/pbo-drawpixels.c b/tests/general/pbo-drawpixels.c
index 9fbe1190..7b85ab0d 100644
--- a/tests/general/pbo-drawpixels.c
+++ b/tests/general/pbo-drawpixels.c
@@ -33,13 +33,11 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
-
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
static float red[] = {1.0, 0.0, 0.0, 0.0};
@@ -77,53 +75,22 @@ static void display(void)
glutSwapBuffers();
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
-
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
+ piglit_width = width;
+ piglit_height = height;
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
- reshape(WIN_WIDTH, WIN_HEIGHT);
+ reshape(piglit_width, piglit_height);
piglit_require_extension("GL_ARB_pixel_buffer_object");
glewInit();
}
-
-int main(int argc, char**argv)
-{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("pbo-drawpixels");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/general/pbo-teximage.c b/tests/general/pbo-teximage.c
index 088b9efe..069b2616 100644
--- a/tests/general/pbo-teximage.c
+++ b/tests/general/pbo-teximage.c
@@ -32,13 +32,11 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
-
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
static float red[] = {1.0, 0.0, 0.0, 0.0};
@@ -90,53 +88,22 @@ static void display(void)
glutSwapBuffers();
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
-
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
+ piglit_width = width;
+ piglit_height = height;
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
- reshape(WIN_WIDTH, WIN_HEIGHT);
+ reshape(piglit_width, piglit_height);
piglit_require_extension("GL_ARB_pixel_buffer_object");
glewInit();
}
-
-int main(int argc, char**argv)
-{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("pbo-teximage");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/general/provoking-vertex.c b/tests/general/provoking-vertex.c
index 3d4fa264..4fe327e4 100644
--- a/tests/general/provoking-vertex.c
+++ b/tests/general/provoking-vertex.c
@@ -37,6 +37,8 @@
#include <GL/freeglut_ext.h>
#endif
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
#ifndef APIENTRY
#define APIENTRY
@@ -55,11 +57,8 @@ typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
static PFNGLPROVOKINGVERTEXEXTPROC pglProvokingVertexEXT = 0;
-
-static GLboolean Automatic = GL_FALSE;
-
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_EXT_provoking_vertex");
@@ -69,14 +68,8 @@ Init(void)
#else
glutGetProcAddress("glProvokingVertexEXT");
#endif
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glShadeModel(GL_FLAT);
@@ -84,8 +77,8 @@ Init(void)
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
float red[3] = {1.0, 0.0, 0.0};
float blue[3] = {0.0, 0.0, 1.0};
@@ -114,29 +107,9 @@ display(void)
pass = pass && piglit_probe_pixel_rgb(150, 130, red);
pass = pass && piglit_probe_pixel_rgb(225, 130, blue);
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
glFinish();
glutSwapBuffers();
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if (argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("provoking vertex");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- Init();
-
- glutMainLoop();
-
- return 0;
-
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/general/read-front.c b/tests/general/read-front.c
index 3c10634c..3f602dc8 100644
--- a/tests/general/read-front.c
+++ b/tests/general/read-front.c
@@ -37,13 +37,11 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL;
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
-
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
int x, y;
@@ -53,17 +51,17 @@ static void display(void)
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor4fv(green);
- piglit_draw_rect(win_width / 2, 0, win_width / 2, win_height);
+ piglit_draw_rect(piglit_width / 2, 0, piglit_width / 2, piglit_height);
glReadBuffer(GL_FRONT);
glutSwapBuffers();
- for (y = 0; y < win_height; y++) {
- for (x = 0; x < win_width; x++) {
+ for (y = 0; y < piglit_height; y++) {
+ for (x = 0; x < piglit_width; x++) {
float *expected;
- if (x >= win_width / 2)
+ if (x >= piglit_width / 2)
expected = green;
else
expected = red;
@@ -74,16 +72,14 @@ static void display(void)
glReadBuffer(GL_BACK);
- if (Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
@@ -94,32 +90,8 @@ static void reshape(int width, int height)
glLoadIdentity();
}
-static void
-init(void)
-{
- reshape(WIN_WIDTH, WIN_HEIGHT);
-}
-
-int main(int argc, char**argv)
+void
+piglit_init(int argc, char **argv)
{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("read-front");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
+ reshape(piglit_width, piglit_height);
}
diff --git a/tests/general/scissor-copypixels.c b/tests/general/scissor-copypixels.c
index 16dcdb45..71bc27be 100644
--- a/tests/general/scissor-copypixels.c
+++ b/tests/general/scissor-copypixels.c
@@ -32,11 +32,8 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
-
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static GLboolean
check_red_box_surrounded_by_green(int x, int y, int w, int h)
@@ -64,10 +61,11 @@ check_red_box_surrounded_by_green(int x, int y, int w, int h)
return pass;
}
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
- int dst_x = win_width / 2 + 10, dst_y;
+ int dst_x = piglit_width / 2 + 10, dst_y;
int dst_w = 10, dst_h = 10;
/* whole window red */
@@ -76,7 +74,7 @@ static void display(void)
/* right half green */
glColor4f(0.0, 1.0, 0.0, 0.0);
- piglit_draw_rect(win_width / 2, 0, win_width / 2, win_height);
+ piglit_draw_rect(piglit_width / 2, 0, piglit_width / 2, piglit_height);
/* Copy a 10x10 square from left to right */
glEnable(GL_SCISSOR_TEST);
@@ -103,52 +101,20 @@ static void display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
-
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
+ piglit_width = width;
+ piglit_height = height;
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
- reshape(WIN_WIDTH, WIN_HEIGHT);
-}
-
-int main(int argc, char**argv)
-{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("scissor-copypixels");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
+ reshape(piglit_width, piglit_height);
}
diff --git a/tests/general/scissor-depth-clear.c b/tests/general/scissor-depth-clear.c
index 06cac3f8..f1cd90fc 100644
--- a/tests/general/scissor-depth-clear.c
+++ b/tests/general/scissor-depth-clear.c
@@ -32,13 +32,11 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL;
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
-
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
int x, y;
@@ -71,10 +69,10 @@ static void display(void)
glDisable(GL_SCISSOR_TEST);
glDepthFunc(GL_LESS);
glColor4fv(blue);
- piglit_draw_rect(0, 0, win_width, win_height);
+ piglit_draw_rect(0, 0, piglit_width, piglit_height);
- for (y = 0; y < win_height; y++) {
- for (x = 0; x < win_width; x++) {
+ for (y = 0; y < piglit_height; y++) {
+ for (x = 0; x < piglit_width; x++) {
float *expected;
if (x >= 10 && x < 20 && y >= 10 && y < 20)
@@ -88,16 +86,14 @@ static void display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
@@ -108,32 +104,8 @@ static void reshape(int width, int height)
glLoadIdentity();
}
-static void
-init(void)
-{
- reshape(WIN_WIDTH, WIN_HEIGHT);
-}
-
-int main(int argc, char**argv)
+void
+piglit_init(int argc, char **argv)
{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("scissor-depth-clear");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
+ reshape(piglit_width, piglit_height);
}
diff --git a/tests/general/scissor-stencil-clear.c b/tests/general/scissor-stencil-clear.c
index a4eee8ed..aa96ee71 100644
--- a/tests/general/scissor-stencil-clear.c
+++ b/tests/general/scissor-stencil-clear.c
@@ -32,13 +32,11 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL;
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
-
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
int x, y;
@@ -72,20 +70,20 @@ static void display(void)
/* First quad -- stencil == 0 gets green */
glStencilFunc(GL_EQUAL, 0, ~0);
glColor4fv(green);
- piglit_draw_rect(0, 0, win_width, win_height);
+ piglit_draw_rect(0, 0, piglit_width, piglit_height);
/* Second quad -- stencil == 1 gets blue */
glStencilFunc(GL_EQUAL, 1, ~0);
glColor4fv(blue);
- piglit_draw_rect(0, 0, win_width, win_height);
+ piglit_draw_rect(0, 0, piglit_width, piglit_height);
/* Last quad -- stencil == 2 gets red (shouldn't occur!) */
glStencilFunc(GL_EQUAL, 2, ~0);
glColor4fv(red);
- piglit_draw_rect(0, 0, win_width, win_height);
+ piglit_draw_rect(0, 0, piglit_width, piglit_height);
- for (y = 0; y < win_height; y++) {
- for (x = 0; x < win_width; x++) {
+ for (y = 0; y < piglit_height; y++) {
+ for (x = 0; x < piglit_width; x++) {
float *expected;
if (x >= 10 && x < 20 && y >= 10 && y < 20)
@@ -99,52 +97,20 @@ static void display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
-
- glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
+ piglit_width = width;
+ piglit_height = height;
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
- reshape(WIN_WIDTH, WIN_HEIGHT);
-}
-
-int main(int argc, char**argv)
-{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("scissor-stencil-clear");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
+ reshape(piglit_width, piglit_height);
}
diff --git a/tests/general/stencil-drawpixels.c b/tests/general/stencil-drawpixels.c
index 76e1f403..1d8d2103 100644
--- a/tests/general/stencil-drawpixels.c
+++ b/tests/general/stencil-drawpixels.c
@@ -32,13 +32,11 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL;
-static GLboolean Automatic = GL_FALSE;
-static int win_width, win_height;
-
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
int x, y, i;
@@ -74,22 +72,22 @@ static void display(void)
/* First quad -- stencil == 0 gets red */
glStencilFunc(GL_EQUAL, 0, ~0);
glColor4fv(red);
- piglit_draw_rect(0, 0, win_width, win_height);
+ piglit_draw_rect(0, 0, piglit_width, piglit_height);
/* Second quad -- stencil == 1 gets green */
glStencilFunc(GL_EQUAL, 1, ~0);
glColor4fv(green);
- piglit_draw_rect(0, 0, win_width, win_height);
+ piglit_draw_rect(0, 0, piglit_width, piglit_height);
/* Last quad -- stencil == 2 gets blue */
glStencilFunc(GL_EQUAL, 2, ~0);
glColor4fv(blue);
- piglit_draw_rect(0, 0, win_width, win_height);
+ piglit_draw_rect(0, 0, piglit_width, piglit_height);
assert(glGetError() == 0);
- for (y = 0; y < win_height; y++) {
- for (x = 0; x < win_width; x++) {
+ for (y = 0; y < piglit_height; y++) {
+ for (x = 0; x < piglit_width; x++) {
float *expected;
if (x >= 10 && x < 20 && y >= 10 && y < 20)
@@ -105,53 +103,22 @@ static void display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void reshape(int width, int height)
{
- win_width = width;
- win_height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
- reshape(WIN_WIDTH, WIN_HEIGHT);
-}
-
-int main(int argc, char**argv)
-{
- int i;
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("stencil-drawpixels");
- glutKeyboardFunc(piglit_escape_exit_key);
- init();
- glutDisplayFunc(display);
- glutMainLoop();
-
- return 0;
+ reshape(piglit_width, piglit_height);
}
diff --git a/tests/general/varray-disabled.c b/tests/general/varray-disabled.c
index ad4ab2fa..dec93c67 100644
--- a/tests/general/varray-disabled.c
+++ b/tests/general/varray-disabled.c
@@ -36,8 +36,8 @@
#include "piglit-util.h"
-static int Width = 128, Height = 128;
-static int Automatic = 0;
+int piglit_width = 128, piglit_height = 128;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static void
set_colors(GLfloat *color_array, GLfloat *color)
@@ -52,7 +52,8 @@ set_colors(GLfloat *color_array, GLfloat *color)
}
}
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
GLfloat vertices[4][2];
GLfloat colors[16];
@@ -116,23 +117,21 @@ static void Redisplay(void)
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glutSwapBuffers();
- pass &= piglit_probe_pixel_rgb(Width * 1 / 6, Height / 2, red);
- pass &= piglit_probe_pixel_rgb(Width * 3 / 6, Height / 2, black);
- pass &= piglit_probe_pixel_rgb(Width * 5 / 6, Height / 2, blue);
- if (Automatic) {
- if (pass)
- piglit_report_result(PIGLIT_SUCCESS);
- else
- piglit_report_result(PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
+ pass &= piglit_probe_pixel_rgb(piglit_width * 1 / 6,
+ piglit_height / 2, red);
+ pass &= piglit_probe_pixel_rgb(piglit_width * 3 / 6,
+ piglit_height / 2, black);
+ pass &= piglit_probe_pixel_rgb(piglit_width * 5 / 6,
+ piglit_height / 2, blue);
+
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -141,35 +140,8 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-int main(int argc, char *argv[])
+void
+piglit_init(int argc, char *argv[])
{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
- glutDisplayFunc(Redisplay);
- if (!Automatic) {
- printf("Escape to quit\n");
- glutKeyboardFunc(Key);
- }
- Reshape(Width,Height);
- glutMainLoop();
- return 0;
}
-
diff --git a/tests/general/vbo-map-remap.c b/tests/general/vbo-map-remap.c
index b5c4dd2b..7b993822 100644
--- a/tests/general/vbo-map-remap.c
+++ b/tests/general/vbo-map-remap.c
@@ -26,22 +26,17 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLuint vbo;
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
- glewInit();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_require_extension("GL_ARB_vertex_buffer_object");
glGenBuffersARB(1, &vbo);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
@@ -63,8 +58,8 @@ vbo_write_floats_mapped(const float *varray, size_t count)
piglit_report_result(PIGLIT_FAILURE);
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLfloat white[4] = {1.0, 1.0, 1.0, 0.0};
GLboolean pass = GL_TRUE;
@@ -104,29 +99,5 @@ display(void)
glDisableClientState(GL_VERTEX_ARRAY);
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1],"-auto"))
- Automatic = GL_TRUE;
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("VBO map remap");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- init();
-
- piglit_require_extension("GL_ARB_vertex_buffer_object");
-
- glutMainLoop();
-
- glDeleteBuffersARB(1, &vbo);
-
- return 0;
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/general/vbo-subdata-sync.c b/tests/general/vbo-subdata-sync.c
index 3af255cf..8be86207 100644
--- a/tests/general/vbo-subdata-sync.c
+++ b/tests/general/vbo-subdata-sync.c
@@ -32,29 +32,24 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLuint vbo;
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
+ piglit_require_extension("GL_ARB_vertex_buffer_object");
- glewInit();
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glGenBuffersARB(1, &vbo);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLfloat white[4] = {1.0, 1.0, 1.0, 0.0};
GLboolean pass = GL_TRUE;
@@ -96,29 +91,5 @@ display(void)
glDisableClientState(GL_VERTEX_ARRAY);
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1],"-auto"))
- Automatic = GL_TRUE;
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("vbo-subdata-sync");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- init();
-
- piglit_require_extension("GL_ARB_vertex_buffer_object");
-
- glutMainLoop();
-
- glDeleteBuffersARB(1, &vbo);
-
- return 0;
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/shaders/fp-abs-01.c b/tests/shaders/fp-abs-01.c
index ff929816..5ff3a2a9 100644
--- a/tests/shaders/fp-abs-01.c
+++ b/tests/shaders/fp-abs-01.c
@@ -113,7 +113,7 @@ static GLint vert_prog;
/*@}*/
-int
+enum piglit_result
piglit_display(void)
{
static const GLfloat color[4] = { 0.0, 1.0, 0.0, 0.0 };
diff --git a/tests/shaders/fp-abs-02.c b/tests/shaders/fp-abs-02.c
index 3d495f6c..2bacf75e 100644
--- a/tests/shaders/fp-abs-02.c
+++ b/tests/shaders/fp-abs-02.c
@@ -135,7 +135,7 @@ static GLint vert_prog;
/*@}*/
-int
+enum piglit_result
piglit_display(void)
{
static const GLfloat color[4] = { 0.0, 1.0, 0.0, 0.0 };
diff --git a/tests/shaders/fp-condition_codes-01.c b/tests/shaders/fp-condition_codes-01.c
index d5836d59..c240db24 100644
--- a/tests/shaders/fp-condition_codes-01.c
+++ b/tests/shaders/fp-condition_codes-01.c
@@ -182,7 +182,7 @@ generate_shader(unsigned cc, unsigned good_mask)
}
-int
+enum piglit_result
piglit_display(void)
{
static const GLfloat good_color[4] = { 0.9, 0.5, 0.7, 1.0 };
diff --git a/tests/shaders/fp-fog.c b/tests/shaders/fp-fog.c
index 25b4cd33..1287124e 100644
--- a/tests/shaders/fp-fog.c
+++ b/tests/shaders/fp-fog.c
@@ -41,9 +41,8 @@ static const char* const program_text =
"END\n"
;
-static int Automatic = 0;
-
-static int Width = 50, Height = 50;
+int piglit_width = 50, piglit_height = 50;
+int piglit_window_mode = GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE;
#if defined(__APPLE__)
static void (*pglFogCoordf)(GLfloat coord) = NULL;
@@ -51,7 +50,8 @@ static void (*pglFogCoordf)(GLfloat coord) = NULL;
static PFNGLFOGCOORDFPROC pglFogCoordf = NULL;
#endif
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
static const struct {
float x, y, r;
@@ -107,25 +107,22 @@ static void Redisplay(void)
expected_color[2] = 0.0;
expected_color[3] = 1.0;
- pass &= piglit_probe_pixel_rgba(probes[i].x * Width / 2,
- probes[i].y * Height / 2,
+ pass &= piglit_probe_pixel_rgba(probes[i].x * piglit_width / 2,
+ probes[i].y * piglit_height / 2,
expected_color);
}
glutSwapBuffers();
- if (Automatic) {
- printf("\nPIGLIT: { 'result': '%s' }\n",
- pass ? "pass" : "fail");
- exit(0);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
+
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -135,24 +132,13 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
-
- if (key) {
- exit(0);
- }
-
- glutPostRedisplay();
-}
-
-
-static void Init(void)
+void
+piglit_init(int argc, char **argv)
{
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ glutReshapeFunc(Reshape);
+
glClearColor(0.3, 0.3, 0.3, 0.3);
if (atof((const char *) glGetString(GL_VERSION)) >= 1.4) {
@@ -187,26 +173,5 @@ static void Init(void)
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
- Reshape(Width, Height);
-}
-
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
-
- if ((argc > 1) && (strcmp(argv[1], "-auto") == 0)) {
- Automatic = 1;
- }
-
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Redisplay);
- Init();
- glutMainLoop();
- return 0;
+ Reshape(piglit_width, piglit_height);
}
diff --git a/tests/shaders/fp-fragment-position.c b/tests/shaders/fp-fragment-position.c
index e79a986a..0abb6d93 100644
--- a/tests/shaders/fp-fragment-position.c
+++ b/tests/shaders/fp-fragment-position.c
@@ -27,6 +27,9 @@
#include "piglit-util.h"
+int piglit_width = 200, piglit_height = 200;
+int piglit_window_mode = GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH;
+
#define NUM_PROGRAMS 4
static GLuint FragProg[NUM_PROGRAMS];
@@ -61,11 +64,6 @@ static const char* const ProgramText[NUM_PROGRAMS] = {
"END",
};
-static int Automatic = 0;
-
-static int Width = 200, Height = 200;
-
-
/**
* Draw four quadrilaterals, one for each fragment program:
* +--------+--------+
@@ -248,12 +246,12 @@ static int DoTest( void )
/*
printf("ReadPixels at %d, %d\n",
- (int)(Probes[idx].x*Width/2),
- (int)(Probes[idx].y*Height/2));
+ (int)(Probes[idx].x*piglit_width/2),
+ (int)(Probes[idx].y*piglit_height/2));
*/
- glReadPixels((int)(Probes[idx].x*Width/2),
- (int)(Probes[idx].y*Height/2),
+ glReadPixels((int)(Probes[idx].x*piglit_width/2),
+ (int)(Probes[idx].y*piglit_height/2),
1, 1,
GL_RGBA, GL_FLOAT, probe);
@@ -283,24 +281,22 @@ static int DoTest( void )
}
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
- int succ;
+ int pass;
DoFrame();
- succ = DoTest();
+ pass = DoTest();
- if (Automatic) {
- printf("\nPIGLIT: { 'result': '%s' }\n", succ ? "pass" : "fail");
- exit(0);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -310,12 +306,18 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-static void Init(void)
+void
+piglit_init(int argc, char **argv)
{
int i, x, y;
GLubyte rectangle[200][200][4];
GLubyte tex[256*256][4];
+ if (!GLEW_VERSION_1_3) {
+ printf("Requires OpenGL 1.3\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
piglit_require_fragment_program();
@@ -373,32 +375,5 @@ static void Init(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- Reshape(Width,Height);
+ Reshape(piglit_width, piglit_height);
}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(Redisplay);
- glewInit();
-
- if (!GLEW_VERSION_1_3) {
- printf("Requires OpenGL 1.3\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
- glutMainLoop();
- return 0;
-}
-
-
diff --git a/tests/shaders/fp-generic.c b/tests/shaders/fp-generic.c
index 05c4d6c6..d923b9bf 100644
--- a/tests/shaders/fp-generic.c
+++ b/tests/shaders/fp-generic.c
@@ -139,7 +139,8 @@ GL program
*/
-static int Width = 100, Height = 100;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA;
static const char* Filename = 0;
static struct testcase Testcase;
@@ -178,27 +179,27 @@ static void TestInstance(struct testinstance* instance)
glutSwapBuffers();
glReadBuffer(GL_FRONT);
- if (!piglit_probe_pixel_rgba(Width/2, Height/2, instance->expected)) {
+ if (!piglit_probe_pixel_rgba(piglit_width/2, piglit_height/2, instance->expected)) {
fprintf(stderr, "Test %s, instance #%i failed\n", Filename, instance-Testcase.instances);
piglit_report_result(PIGLIT_FAILURE);
}
}
-
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
int i;
for(i = 0; i < Testcase.nrInstances; ++i)
TestInstance(&Testcase.instances[i]);
- piglit_report_result(PIGLIT_SUCCESS);
+ return PIGLIT_SUCCESS;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -208,19 +209,18 @@ static void Reshape(int width, int height)
}
-static void Init(void)
+void
+piglit_init(int argc, char **argv)
{
- piglit_require_fragment_program();
- FragProg = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, Testcase.programtext);
+ int i;
- Reshape(Width,Height);
-}
+ piglit_automatic = GL_TRUE;
+ if (!GLEW_VERSION_1_3) {
+ printf("Requires OpenGL 1.3\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
-int main(int argc, char *argv[])
-{
- int i;
- glutInit(&argc, argv);
for(i = 1; i < argc; ++i) {
if (!Filename)
Filename = argv[i];
@@ -232,22 +232,10 @@ int main(int argc, char *argv[])
}
readTestcase(&Testcase, Filename);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_ALPHA);
- glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
- glutDisplayFunc(Redisplay);
- glewInit();
- if (!GLEW_VERSION_1_3) {
- printf("Requires OpenGL 1.3\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
+ piglit_require_fragment_program();
+ FragProg = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, Testcase.programtext);
- Init();
- glutMainLoop();
- return 0;
+ Reshape(piglit_width, piglit_height);
}
-
diff --git a/tests/shaders/fp-incomplete-tex.c b/tests/shaders/fp-incomplete-tex.c
index 3fa0d27a..abf7c827 100644
--- a/tests/shaders/fp-incomplete-tex.c
+++ b/tests/shaders/fp-incomplete-tex.c
@@ -28,6 +28,9 @@
#include "piglit-util.h"
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH;
+
#define NUM_PROGRAMS 5
static GLuint FragProg[NUM_PROGRAMS];
@@ -54,10 +57,6 @@ static const char* const ProgramText[NUM_PROGRAMS] = {
"END"
};
-static int Automatic = 0;
-
-static int Width = 300, Height = 200;
-
static void DoFrame(void)
{
int i;
@@ -143,9 +142,9 @@ static int DoTest( void )
GLfloat delta[4];
int i;
- glReadPixels((int)(Probes[idx].x*Width/3),
- (int)(Probes[idx].y*Height/2),
- 1, 1,
+ glReadPixels((int)(Probes[idx].x * piglit_width / 3),
+ (int)(Probes[idx].y * piglit_height / 2),
+ 1, 1,
GL_RGBA, GL_FLOAT, probe);
printf("%20s (%3.1f,%3.1f): %f,%f,%f,%f",
@@ -174,24 +173,22 @@ static int DoTest( void )
}
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
- int succ;
+ int pass;
DoFrame();
- succ = DoTest();
+ pass = DoTest();
- if (Automatic) {
- printf("\nPIGLIT: { 'result': '%s' }\n", succ ? "pass" : "fail");
- exit(0);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -201,50 +198,20 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init(void)
+void
+piglit_init(int argc, char **argv)
{
int i;
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ glutReshapeFunc(Reshape);
+
piglit_require_fragment_program();
for(i = 0; i < NUM_PROGRAMS; ++i)
FragProg[i] = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, ProgramText[i]);
- Reshape(Width,Height);
+ Reshape(piglit_width, piglit_height);
}
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Redisplay);
- Init();
- glutMainLoop();
- return 0;
-}
-
-
-
diff --git a/tests/shaders/fp-indirections.c b/tests/shaders/fp-indirections.c
index 608a00d5..dc49b36a 100644
--- a/tests/shaders/fp-indirections.c
+++ b/tests/shaders/fp-indirections.c
@@ -27,10 +27,8 @@
#include "piglit-util.h"
-static int Automatic = 0;
-
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static int get_program_i(GLenum pname)
{
@@ -264,17 +262,19 @@ GLboolean test_temporary_source_indirections(void)
return pass;
}
-void display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
pass = test_temporary_dest_indirections() && pass;
pass = test_temporary_source_indirections() && pass;
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(0);
+
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-void init(void)
+void
+piglit_init(int argc, char **argv)
{
piglit_require_fragment_program();
@@ -289,20 +289,3 @@ void init(void)
printf("Maximum native tex indirections: %d\n",
get_program_i(GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB));
}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitDisplayMode(GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
- glutDisplayFunc(display);
-
- init();
-
- glutMainLoop();
- return 0;
-}
diff --git a/tests/shaders/fp-indirections2.c b/tests/shaders/fp-indirections2.c
index f125d5bd..3541d754 100644
--- a/tests/shaders/fp-indirections2.c
+++ b/tests/shaders/fp-indirections2.c
@@ -202,7 +202,8 @@ static int test(unsigned int dim, unsigned int samples)
return PIGLIT_SUCCESS;
}
-int piglit_display()
+enum piglit_result
+piglit_display(void)
{
int result;
unsigned int dim;
diff --git a/tests/shaders/fp-kil.c b/tests/shaders/fp-kil.c
index d82c0eca..eb886e4c 100644
--- a/tests/shaders/fp-kil.c
+++ b/tests/shaders/fp-kil.c
@@ -27,6 +27,9 @@
#include "piglit-util.h"
+int piglit_width = 200, piglit_height = 200;
+int piglit_window_mode = GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH;
+
#define NUM_PROGRAMS 2
static GLuint FragProg[NUM_PROGRAMS];
@@ -46,11 +49,6 @@ static const char* const ProgramText[NUM_PROGRAMS] = {
"END"
};
-static int Automatic = 0;
-
-static int Width = 200, Height = 200; // space for more tests
-
-
static void DoFrame(void)
{
glClearColor(0.0, 0.0, 0.0, 1.0);
@@ -219,8 +217,8 @@ static int DoTest( void )
GLfloat delta[4];
int i;
- glReadPixels((int)(Probes[idx].x*Width/2),
- (int)(Probes[idx].y*Height/2),
+ glReadPixels((int)(Probes[idx].x*piglit_width/2),
+ (int)(Probes[idx].y*piglit_height/2),
1, 1,
GL_RGBA, GL_FLOAT, probe);
@@ -249,25 +247,22 @@ static int DoTest( void )
return 1;
}
-
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
- int succ;
+ int pass;
DoFrame();
- succ = DoTest();
+ pass = DoTest();
- if (Automatic) {
- printf("\nPIGLIT: { 'result': '%s' }\n", succ ? "pass" : "fail");
- exit(0);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -277,11 +272,19 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-static void Init(void)
+void
+piglit_init(int argc, char **argv)
{
int i, x, y;
GLubyte tex[4][4][4];
+ glutReshapeFunc(Reshape);
+
+ if (!GLEW_VERSION_1_3) {
+ printf("Requires OpenGL 1.3\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
piglit_require_fragment_program();
@@ -313,33 +316,5 @@ static void Init(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- Reshape(Width,Height);
+ Reshape(piglit_width, piglit_height);
}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(Redisplay);
- glewInit();
-
- if (!GLEW_VERSION_1_3) {
- printf("Requires OpenGL 1.3\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
- glutMainLoop();
- return 0;
-}
-
-
-
diff --git a/tests/shaders/fp-lit-mask.c b/tests/shaders/fp-lit-mask.c
index e9550c80..47cc5a2c 100644
--- a/tests/shaders/fp-lit-mask.c
+++ b/tests/shaders/fp-lit-mask.c
@@ -27,6 +27,9 @@
#include "piglit-util.h"
+int piglit_width = 200, piglit_height = 200;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH;
+
static GLuint FragProg[15];
static const char fragProgramTemplate[] =
@@ -38,11 +41,6 @@ static const char fragProgramTemplate[] =
"END\n";
static float LitExpected[4] = { 1.0, 0.65, 0.433, 1.0 };
-static int Automatic = 0;
-
-static int Width = 200, Height = 200;
-
-
static void DoFrame(void)
{
int mask;
@@ -83,7 +81,8 @@ static int DoTest( void )
GLfloat delta[4];
int i;
- glReadPixels(Width*(2*(mask%4)+1)/8, Height*(2*(mask/4)+1)/8, 1, 1,
+ glReadPixels(piglit_width * (2*(mask%4)+1)/8,
+ piglit_height * (2*(mask/4)+1)/8, 1, 1,
GL_RGBA, GL_FLOAT, probe);
printf("Probe %i: %f,%f,%f,%f\n", mask, probe[0], probe[1], probe[2], probe[3]);
@@ -109,25 +108,22 @@ static int DoTest( void )
return 1;
}
-
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
- int succ;
+ int pass;
DoFrame();
- succ = DoTest();
+ pass = DoTest();
- if (Automatic) {
- printf("\nPIGLIT: { 'result': '%s' }\n", succ ? "pass" : "fail");
- exit(0);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -136,25 +132,12 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- pglDeleteProgramsARB(15, FragProg);
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init(void)
+void piglit_init(int argc, char **argv)
{
int mask;
+ glutReshapeFunc(Reshape);
+
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
piglit_require_fragment_program();
@@ -176,24 +159,5 @@ static void Init(void)
FragProg[mask-1] = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, programText);
}
- Reshape(Width,Height);
-}
-
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Redisplay);
- Init();
- glutMainLoop();
- return 0;
+ Reshape(piglit_width, piglit_height);
}
-
diff --git a/tests/shaders/fp-rfl.c b/tests/shaders/fp-rfl.c
index ffc0bffb..d8713284 100644
--- a/tests/shaders/fp-rfl.c
+++ b/tests/shaders/fp-rfl.c
@@ -120,7 +120,7 @@ static GLfloat position[4 * TEST_ROWS * TEST_COLS];
static const float green[4] = { 0.0, 1.0, 0.0, 0.0 };
-int
+enum piglit_result
piglit_display(void)
{
int result = PIGLIT_SUCCESS;
diff --git a/tests/shaders/fp-set-01.c b/tests/shaders/fp-set-01.c
index cb075c55..7495a1cc 100644
--- a/tests/shaders/fp-set-01.c
+++ b/tests/shaders/fp-set-01.c
@@ -77,7 +77,7 @@ static GLint progs[2];
/*@}*/
-int
+enum piglit_result
piglit_display(void)
{
const GLfloat comparitor[4] = { 0.5, 0.5, 0.5, 0.5 };
diff --git a/tests/shaders/fp-set-02.c b/tests/shaders/fp-set-02.c
index e969c791..a5a86246 100644
--- a/tests/shaders/fp-set-02.c
+++ b/tests/shaders/fp-set-02.c
@@ -153,7 +153,7 @@ tr_func(float a, float b)
}
-int
+enum piglit_result
piglit_display(void)
{
const GLfloat comparitor[4] = { 0.5, 0.5, 0.5, 0.5 };
diff --git a/tests/shaders/fp-unpack-01.c b/tests/shaders/fp-unpack-01.c
index 684c96f9..a3e35420 100644
--- a/tests/shaders/fp-unpack-01.c
+++ b/tests/shaders/fp-unpack-01.c
@@ -255,7 +255,7 @@ pack(float *packed, const float *color, GLenum type)
}
-int
+enum piglit_result
piglit_display(void)
{
unsigned i;
diff --git a/tests/shaders/glsl-bug-22603.c b/tests/shaders/glsl-bug-22603.c
index 972f5ed6..69695317 100644
--- a/tests/shaders/glsl-bug-22603.c
+++ b/tests/shaders/glsl-bug-22603.c
@@ -32,10 +32,8 @@
#include "piglit-util.h"
-static GLboolean Automatic;
-
-#define WIN_WIDTH 800
-#define WIN_HEIGHT 600
+int piglit_width = 800, piglit_height = 600;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
/* Misbehaviour: first: the quads are not drawn in the correct order
* (darker equals closer to the viewer), second: the middle one is strangely
@@ -46,8 +44,8 @@ static GLuint vs, fs, prog, shadow_vs, shadow_fs, shadow_prog;
static GLint shadowMap_location;
static GLint eye_projection_location, light_projection_location;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLuint shadow_texture;
GLuint fbo;
@@ -156,14 +154,13 @@ display(void)
/* check that rect2 where less than rect1 is rendered */
pass &= piglit_probe_pixel_rgb(450, 250, rect2_color_bottom_rect1);
- if (Automatic)
- piglit_report_result (pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
-
glutSwapBuffers();
+
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void
-init(void)
+void
+piglit_init(int argc, char **argv)
{
const char *vs_source =
"uniform mat4 eye_projection;"
@@ -193,6 +190,11 @@ init(void)
" gl_FragDepth = gl_FragCoord.z;"
"}";
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
vs = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
glShaderSourceARB(vs, 1, &vs_source, NULL);
glCompileShaderARB(vs);
@@ -217,38 +219,3 @@ init(void)
"light_projection");
shadowMap_location = glGetUniformLocationARB(shadow_prog, "shadowMap");
}
-
-int
-main(int argc, char** argv)
-{
- /* far = 11, near = 1 */
- int i;
-
- glutInit(&argc, argv);
-
- for (i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-bug-22603");
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/glsl-deriv-varyings.c b/tests/shaders/glsl-deriv-varyings.c
index 30e33056..f5e19a46 100644
--- a/tests/shaders/glsl-deriv-varyings.c
+++ b/tests/shaders/glsl-deriv-varyings.c
@@ -30,7 +30,12 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+static void compileLinkProg(void);
+static void loadTex(void);
+
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLuint tex[1];
static GLint prog1;
static GLint vs1;
@@ -79,17 +84,19 @@ static const char *fragShaderText2 =
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
+ compileLinkProg();
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ loadTex();
+
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glEnable(GL_TEXTURE_2D);
glClearColor(0.6, 0.6, 0.6, 1.0);
@@ -202,8 +209,8 @@ loadTex(void)
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
@@ -227,42 +234,9 @@ display(void)
pass = pass && piglit_probe_pixel_rgb(132, 125, green);
pass = pass && piglit_probe_pixel_rgb(205, 125, deriv);
- if(Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
-
glFinish();
glutSwapBuffers();
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("glsl-deriv-varyings");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
-
- compileLinkProg();
-
- loadTex();
-
- glutMainLoop();
-
- return 0;
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/shaders/glsl-derivs.c b/tests/shaders/glsl-derivs.c
index 44eb1670..80d8464c 100644
--- a/tests/shaders/glsl-derivs.c
+++ b/tests/shaders/glsl-derivs.c
@@ -30,7 +30,12 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+static void compileLinkProg(void);
+static void loadTex(void);
+
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLuint tex[1];
static GLint prog1;
static GLint vs1;
@@ -78,17 +83,19 @@ static const char *fragShaderText2 =
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+ compileLinkProg();
+
+ loadTex();
glEnable(GL_TEXTURE_2D);
glClearColor(0.6, 0.6, 0.6, 1.0);
@@ -201,8 +208,8 @@ loadTex(void)
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
@@ -226,42 +233,9 @@ display(void)
pass = pass && piglit_probe_pixel_rgb(132, 125, green);
pass = pass && piglit_probe_pixel_rgb(205, 125, deriv);
- if(Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
-
glFinish();
glutSwapBuffers();
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("glsl-derivs");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
-
- compileLinkProg();
-
- loadTex();
-
- glutMainLoop();
-
- return 0;
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/shaders/glsl-dlist-getattriblocation.c b/tests/shaders/glsl-dlist-getattriblocation.c
index 378e1009..8a49114a 100644
--- a/tests/shaders/glsl-dlist-getattriblocation.c
+++ b/tests/shaders/glsl-dlist-getattriblocation.c
@@ -45,7 +45,7 @@ static const GLchar *vertShaderText =
"} \n";
-int
+enum piglit_result
piglit_display(void)
{
GLboolean pass = GL_TRUE;
diff --git a/tests/shaders/glsl-empty-vs-no-fs.c b/tests/shaders/glsl-empty-vs-no-fs.c
index e317fa13..0f5cd05b 100644
--- a/tests/shaders/glsl-empty-vs-no-fs.c
+++ b/tests/shaders/glsl-empty-vs-no-fs.c
@@ -35,11 +35,13 @@
#include "piglit-util.h"
-static GLboolean Automatic;
+int piglit_width = 250, piglit_height = 250;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static const char *vs_source = "void main() {}";
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLint vs;
GLint prog;
@@ -65,31 +67,14 @@ display(void)
glDeleteShader(vs);
}
- if (Automatic) {
- piglit_report_result(PIGLIT_SUCCESS);
- }
+ return PIGLIT_SUCCESS;
}
-int
-main(int argc, char** argv)
+void
+piglit_init(int argc, char **argv)
{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
- glutInitWindowSize(250, 250);
- glutCreateWindow("glsl-empty-vs-no-fs");
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
- glewInit();
-
if (!GLEW_VERSION_2_0) {
printf("Requires OpenGL 2.0\n");
piglit_report_result(PIGLIT_SKIP);
- exit(1);
}
-
- glutMainLoop();
-
- return 0;
}
diff --git a/tests/shaders/glsl-fs-exp2.c b/tests/shaders/glsl-fs-exp2.c
index 3082a15f..5d105376 100644
--- a/tests/shaders/glsl-fs-exp2.c
+++ b/tests/shaders/glsl-fs-exp2.c
@@ -32,15 +32,14 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static int args1_location, args2_location;
static GLint prog;
-static GLboolean Automatic;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
/* result = 2 ^ args1 + args2 */
@@ -59,26 +58,20 @@ display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result (pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
GLint vs, fs;
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-fs-exp2.vert");
@@ -92,35 +85,3 @@ static void init(void)
args1_location = glGetUniformLocation(prog, "args1");
args2_location = glGetUniformLocation(prog, "args2");
}
-
-int main(int argc, char**argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-fs-exp2");
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/glsl-fs-fragcoord.c b/tests/shaders/glsl-fs-fragcoord.c
index ec351a83..c78a6cc8 100644
--- a/tests/shaders/glsl-fs-fragcoord.c
+++ b/tests/shaders/glsl-fs-fragcoord.c
@@ -32,14 +32,13 @@
#include "piglit-util.h"
-#define WIN_WIDTH 256
-#define WIN_HEIGHT 256
+int piglit_width = 256, piglit_height = 256;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static GLint prog;
-static GLboolean Automatic;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
int x, y;
@@ -47,10 +46,10 @@ display(void)
glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
- piglit_draw_rect(0, 0, WIN_WIDTH, WIN_HEIGHT);
+ piglit_draw_rect(0, 0, piglit_width, piglit_height);
- for (y = 0; y < WIN_HEIGHT; y++) {
- for (x = 0; x < WIN_WIDTH; x++) {
+ for (y = 0; y < piglit_height; y++) {
+ for (x = 0; x < piglit_width; x++) {
float color[3];
color[0] = x / 256.0;
@@ -65,25 +64,20 @@ display(void)
glutSwapBuffers();
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
GLint vs, fs;
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-fs-fragcoord.vert");
@@ -94,35 +88,3 @@ static void init(void)
glUseProgram(prog);
}
-
-int main(int argc, char**argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-fs-fragcoord");
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/glsl-fs-log2.c b/tests/shaders/glsl-fs-log2.c
index de147f99..331ba1f6 100644
--- a/tests/shaders/glsl-fs-log2.c
+++ b/tests/shaders/glsl-fs-log2.c
@@ -32,15 +32,14 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static int args1_location, args2_location;
static GLint prog;
-static GLboolean Automatic;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
/* result = log2(args1) + args2 */
@@ -59,26 +58,20 @@ display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result (pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
GLint vs, fs;
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-fs-log2.vert");
@@ -92,35 +85,3 @@ static void init(void)
args1_location = glGetUniformLocation(prog, "args1");
args2_location = glGetUniformLocation(prog, "args2");
}
-
-int main(int argc, char**argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-fs-log2");
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/glsl-fwidth.c b/tests/shaders/glsl-fwidth.c
index a63becba..b3553add 100644
--- a/tests/shaders/glsl-fwidth.c
+++ b/tests/shaders/glsl-fwidth.c
@@ -30,7 +30,12 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
+static void loadTex(void);
+static void compileLinkProg(void);
+
static GLuint tex[1];
static GLint prog1;
static GLint vs1;
@@ -38,7 +43,6 @@ static GLint fs1;
static GLint prog2;
static GLint fs2;
-
static GLfloat verts[12] = {175.0, 125.0, 0.0,
175.0, 175.0, 0.0,
125.0, 125.0, 0.0,
@@ -77,17 +81,19 @@ static const char *fragShaderText2 =
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ compileLinkProg();
+
+ loadTex();
+
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glEnable(GL_TEXTURE_2D);
glClearColor(0.6, 0.6, 0.6, 1.0);
@@ -200,8 +206,8 @@ loadTex(void)
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
@@ -225,42 +231,8 @@ display(void)
pass = pass && piglit_probe_pixel_rgb(132, 125, green);
pass = pass && piglit_probe_pixel_rgb(205, 125, mostlyBlack);
- if(Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
-
glFinish();
glutSwapBuffers();
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("glsl-fwidth");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
-
- compileLinkProg();
-
- loadTex();
-
- glutMainLoop();
-
- return 0;
-}
-
diff --git a/tests/shaders/glsl-lod-bias.c b/tests/shaders/glsl-lod-bias.c
index b0a7b036..a2e3faf7 100644
--- a/tests/shaders/glsl-lod-bias.c
+++ b/tests/shaders/glsl-lod-bias.c
@@ -30,7 +30,9 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLuint tex[1];
static GLint prog1;
static GLint vs1;
@@ -38,6 +40,8 @@ static GLint fs1;
static GLint prog2;
static GLint fs2;
+static void loadTex(void);
+static void compileLinkProg(void);
static GLfloat verts[12] = {175.0, 125.0, 0.0,
175.0, 175.0, 0.0,
@@ -76,18 +80,18 @@ static const char *fragShaderText2 =
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, 400, 0, 300, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ loadTex();
+ compileLinkProg();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glEnable(GL_TEXTURE_2D);
glClearColor(0.6, 0.6, 0.6, 1.0);
}
@@ -201,8 +205,8 @@ loadTex(void)
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
@@ -226,42 +230,8 @@ display(void)
pass = pass && piglit_probe_pixel_rgb(132, 125, grey);
pass = pass && piglit_probe_pixel_rgb(205, 125, green);
- if(Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
-
glFinish();
glutSwapBuffers();
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("glsl-lod-bias");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
-
- compileLinkProg();
-
- loadTex();
-
- glutMainLoop();
-
- return 0;
-}
-
diff --git a/tests/shaders/glsl-uniform-update.c b/tests/shaders/glsl-uniform-update.c
index 2ecb291e..15d2407c 100644
--- a/tests/shaders/glsl-uniform-update.c
+++ b/tests/shaders/glsl-uniform-update.c
@@ -35,16 +35,16 @@
*/
#include "piglit-util.h"
+#include "piglit-framework.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static int color_location;
static GLint prog;
-static GLboolean Automatic;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
@@ -65,26 +65,20 @@ display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result (pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
GLint vs, fs;
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-uniform-update.vert");
@@ -97,35 +91,3 @@ static void init(void)
color_location = glGetUniformLocation(prog, "color");
}
-
-int main(int argc, char**argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-uniform-update");
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/glsl-unused-varying.c b/tests/shaders/glsl-unused-varying.c
index 46c9a28f..4082fc93 100644
--- a/tests/shaders/glsl-unused-varying.c
+++ b/tests/shaders/glsl-unused-varying.c
@@ -36,17 +36,16 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static int do_red_location;
static int red_location;
static int green_location;
static GLint prog;
-static GLboolean Automatic;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
static const float red[] = {1.0, 0.0, 0.0, 0.0};
static const float green[] = {0.0, 1.0, 0.0, 0.0};
@@ -69,26 +68,19 @@ display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result (pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void piglit_init(int argc, char **argv)
{
GLint vs, fs;
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-unused-varying.vert");
@@ -103,35 +95,3 @@ static void init(void)
green_location = glGetUniformLocation(prog, "green");
do_red_location = glGetUniformLocation(prog, "do_red");
}
-
-int main(int argc, char**argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-unused-varying");
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/glsl-vs-if-bool.c b/tests/shaders/glsl-vs-if-bool.c
index a7d0378c..49642671 100644
--- a/tests/shaders/glsl-vs-if-bool.c
+++ b/tests/shaders/glsl-vs-if-bool.c
@@ -32,15 +32,14 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static GLint prog;
-static GLboolean Automatic;
static int red_location;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
static const float red[] = {1.0, 0.0, 0.0, 0.0};
@@ -59,39 +58,19 @@ display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result (pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
-}
-
-static void key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-
-static void init(void)
+void piglit_init(int argc, char **argv)
{
GLint vs, fs;
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-if-bool.vert");
@@ -104,35 +83,3 @@ static void init(void)
glUseProgram(prog);
}
-
-int main(int argc, char**argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-vs-if-bool");
- glutKeyboardFunc(key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/glsl-vs-if.c b/tests/shaders/glsl-vs-if.c
index 1babacd7..63b90dd4 100644
--- a/tests/shaders/glsl-vs-if.c
+++ b/tests/shaders/glsl-vs-if.c
@@ -32,14 +32,13 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static GLint prog;
-static GLboolean Automatic;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
static const float red[] = {1.0, 0.0, 0.0, 0.0};
@@ -56,39 +55,20 @@ display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result (pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
-}
-
-static void key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
GLint vs, fs;
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-if.vert");
@@ -99,35 +79,3 @@ static void init(void)
glUseProgram(prog);
}
-
-int main(int argc, char**argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-vs-if");
- glutKeyboardFunc(key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/glsl-vs-loop.c b/tests/shaders/glsl-vs-loop.c
index 72ca56fe..e0fee41f 100644
--- a/tests/shaders/glsl-vs-loop.c
+++ b/tests/shaders/glsl-vs-loop.c
@@ -39,15 +39,14 @@
#include "piglit-util.h"
-#define WIN_WIDTH 100
-#define WIN_HEIGHT 100
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static int color_location;
static GLint prog;
-static GLboolean Automatic;
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
@@ -90,26 +89,23 @@ display(void)
glutSwapBuffers();
- if (Automatic) {
- piglit_report_result (pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
GLint vs, fs;
/* Set up projection matrix so we can just draw using window
* coordinates.
*/
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
vs = piglit_compile_shader(GL_VERTEX_SHADER,
SOURCE_DIR "tests/shaders/glsl-vs-loop.vert");
@@ -122,35 +118,3 @@ static void init(void)
color_location = glGetUniformLocation(prog, "color");
}
-
-int main(int argc, char**argv)
-{
- int i;
-
- glutInit(&argc, argv);
-
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
-
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("glsl-vs-loop");
- glutKeyboardFunc(piglit_escape_exit_key);
- glutDisplayFunc(display);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
- init();
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/shaders/trinity-fp1.c b/tests/shaders/trinity-fp1.c
index e44767af..16a3f450 100644
--- a/tests/shaders/trinity-fp1.c
+++ b/tests/shaders/trinity-fp1.c
@@ -28,6 +28,9 @@
#include "piglit-util.h"
+int piglit_width = 200, piglit_height = 100;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH;
+
static GLuint TexDiffuse = 1;
static GLuint TexNormal = 2;
static GLuint TexSpecular = 3;
@@ -35,11 +38,6 @@ static GLuint TexLookup = 4;
static GLuint FragProg;
-static int Automatic = 0;
-
-static int Width = 200, Height = 100;
-
-
static void DoFrame(void)
{
static float Local[3][4] = {
@@ -129,7 +127,7 @@ static int DoTest( void )
GLfloat delta[3];
int j;
- glReadPixels(Width*(2*i+1)/4, Height/2, 1, 1, GL_RGBA, GL_FLOAT, probe);
+ glReadPixels(piglit_width*(2*i+1)/4, piglit_height/2, 1, 1, GL_RGBA, GL_FLOAT, probe);
printf("Probe: %f,%f,%f\n", probe[0], probe[1], probe[2]);
for(j = 0; j < 3; ++j) {
@@ -149,24 +147,22 @@ static int DoTest( void )
}
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
int succ;
DoFrame();
succ = DoTest();
- if (Automatic) {
- printf("\nPIGLIT: { 'result': '%s' }\n", succ ? "pass" : "fail");
- exit(0);
- }
+ return succ ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -175,22 +171,8 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- pglDeleteProgramsARB(1, &FragProg);
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-static void Init(void)
+void
+piglit_init(int argc, char **argv)
{
GLubyte data[256][256][4];
int x,y;
@@ -262,6 +244,11 @@ static void Init(void)
"END";
+ if (!GLEW_VERSION_1_3) {
+ printf("Requires OpenGL 1.3\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
piglit_require_fragment_program();
@@ -330,31 +317,5 @@ static void Init(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
- Reshape(Width,Height);
-}
-
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Redisplay);
- glewInit();
-
- if (!GLEW_VERSION_1_3) {
- printf("Requires OpenGL 1.3\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
- glutMainLoop();
- return 0;
+ Reshape(piglit_width, piglit_height);
}
diff --git a/tests/shaders/vp-bad-program.c b/tests/shaders/vp-bad-program.c
index 09fe2be5..1a891d0a 100644
--- a/tests/shaders/vp-bad-program.c
+++ b/tests/shaders/vp-bad-program.c
@@ -36,13 +36,11 @@
#include "piglit-util.h"
-static int automatic = 0;
+int piglit_width = 128, piglit_height = 128;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-#define WIN_WIDTH 128
-#define WIN_HEIGHT 128
-
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
static const char *badprog =
"!!ARBvp1.0\n"
@@ -119,30 +117,12 @@ display(void)
err = glGetError();
}
- if (automatic) {
- if (failed == 0)
- piglit_report_result(PIGLIT_SUCCESS);
- else
- piglit_report_result(PIGLIT_FAILURE);
- }
-
- exit(0);
+ return failed ? PIGLIT_FAILURE : PIGLIT_SUCCESS;
}
-int
-main(int argc, char**argv)
+void piglit_init(int argc, char **argv)
{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- automatic = 1;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(WIN_WIDTH, WIN_HEIGHT);
- glutCreateWindow("vp-bad-program");
- glutDisplayFunc(display);
+ piglit_automatic = GL_TRUE;
piglit_require_vertex_program();
-
- glutMainLoop();
- return 0;
}
diff --git a/tests/shaders/vp-ignore-input.c b/tests/shaders/vp-ignore-input.c
index 9885ad70..aeb893b9 100644
--- a/tests/shaders/vp-ignore-input.c
+++ b/tests/shaders/vp-ignore-input.c
@@ -30,7 +30,9 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLint prog;
static GLint fs;
static GLint vs;
@@ -55,8 +57,8 @@ static const char *fragShaderText =
static void compileLinkProg(void);
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
glMatrixMode(GL_PROJECTION);
glPushMatrix();
@@ -69,6 +71,11 @@ Init(void)
glClearColor(0.2, 0.2, 0.2, 1.0);
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
compileLinkProg();
}
@@ -107,8 +114,8 @@ compileLinkProg(void)
}
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLboolean pass = GL_TRUE;
@@ -123,37 +130,8 @@ display(void)
glPopMatrix();
- if(Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
-
glFinish();
glutSwapBuffers();
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("vp-ignore-inputs");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
-
- glutMainLoop();
-
- return 0;
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
diff --git a/tests/shaders/vpfp-generic.cpp b/tests/shaders/vpfp-generic.cpp
index 9e047c1a..0dd2f489 100644
--- a/tests/shaders/vpfp-generic.cpp
+++ b/tests/shaders/vpfp-generic.cpp
@@ -51,18 +51,6 @@
* [0..3].
*/
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <GL/glew.h>
-#if defined(__APPLE__)
-#include <GLUT/glut.h>
-#else
-#include <GL/glut.h>
-#endif
-
#include <string>
#include <sstream>
#include <vector>
diff --git a/tests/texturing/depth-tex-modes-glsl.c b/tests/texturing/depth-tex-modes-glsl.c
index ff8b0f80..a50843b3 100644
--- a/tests/texturing/depth-tex-modes-glsl.c
+++ b/tests/texturing/depth-tex-modes-glsl.c
@@ -30,7 +30,9 @@
#include "piglit-util.h"
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 400, piglit_height = 300;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
static GLuint tex[3];
static GLint prog;
static GLint fs;
@@ -73,10 +75,23 @@ static const char *fragShaderText =
"} \n";
static void compileLinkProg(void);
+static void loadTex(void);
-static void
-Init(void)
+void
+piglit_init(int argc, char **argv)
{
+ if (!GLEW_VERSION_2_0) {
+ printf("Requires OpenGL 2.0\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ if (piglit_automatic)
+ printf(" Left to Right: LUMINANCE, INTENSITY, ALPHA\n"
+ "Lower row: Combined with color\n"
+ "Upper row: combined with alpha\n");
+
+ loadTex();
+
piglit_require_extension("GL_ARB_texture_rectangle");
glMatrixMode(GL_PROJECTION);
glPushMatrix();
@@ -193,9 +208,8 @@ loadTex(void)
#undef width
}
-
-static void
-display(void)
+enum piglit_result
+piglit_display(void)
{
GLint loc1, loc2;
@@ -291,41 +305,9 @@ display(void)
}
- if(Automatic) {
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
- exit(pass ? 0 : 1);
- }
-
glFinish();
glutSwapBuffers();
- printf(" Left to Right: LUMINANCE, INTENSITY, ALPHA\n Lower row: Combined with color\n Upper row: combined with alpha\n");
-
-}
-
-int main(int argc, char **argv)
-{
- glutInit(&argc, argv);
- if(argc==2 && !strncmp(argv[1], "-auto", 5))
- Automatic=GL_TRUE;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(400, 300);
- glutCreateWindow("depth-tex-modes-glsl");
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
- glewInit();
-
- if (!GLEW_VERSION_2_0) {
- printf("Requires OpenGL 2.0\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- Init();
-
- loadTex();
-
- glutMainLoop();
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
- return 0;
}
diff --git a/tests/texturing/gen-compressed-teximage.c b/tests/texturing/gen-compressed-teximage.c
index 80c48937..527cb746 100644
--- a/tests/texturing/gen-compressed-teximage.c
+++ b/tests/texturing/gen-compressed-teximage.c
@@ -38,11 +38,10 @@
#include "piglit-util.h"
-#define WIN_WIDTH 512
-#define WIN_HEIGHT 512
-#define SIZE 128
+int piglit_width = 512, piglit_height = 512;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-static GLboolean Automatic = GL_FALSE;
+#define SIZE 128
static void display_mipmaps(int start_x, int start_y)
{
@@ -95,7 +94,8 @@ static GLboolean check_resulting_mipmaps(int x, int y, const GLfloat *color)
return pass;
}
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
const GLfloat red[4] = {1.0, 0.0, 0.0, 0.0};
const GLfloat blue[4] = {0.0, 0.0, 1.0, 0.0};
@@ -155,49 +155,16 @@ static void display(void)
glutSwapBuffers();
glFlush();
- if (Automatic)
- piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_SGIS_generate_mipmap");
piglit_require_extension("GL_EXT_texture_compression_s3tc");
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glEnable(GL_TEXTURE_2D);
}
-
-int main(int argc, char**argv)
-{
- int i;
- glutInit(&argc, argv);
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("gen-compressed-teximage");
- init();
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
-
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/texturing/gen-teximage.c b/tests/texturing/gen-teximage.c
index e599ce66..bcc163db 100644
--- a/tests/texturing/gen-teximage.c
+++ b/tests/texturing/gen-teximage.c
@@ -38,11 +38,10 @@
#include "piglit-util.h"
-#define WIN_WIDTH 512
-#define WIN_HEIGHT 512
-#define SIZE 128
+int piglit_width = 512, piglit_height = 512;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
-static GLboolean Automatic = GL_FALSE;
+#define SIZE 128
static void display_mipmaps(int start_x, int start_y)
{
@@ -94,8 +93,10 @@ static GLboolean check_resulting_mipmaps(int x, int y, const GLfloat *color)
return pass;
}
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
+ GLboolean pass = GL_TRUE;
const GLfloat red[4] = {1.0, 0.0, 0.0, 0.0};
const GLfloat blue[4] = {0.0, 0.0, 1.0, 0.0};
GLuint texture;
@@ -149,57 +150,19 @@ static void display(void)
glutSwapBuffers();
glFlush();
- if (Automatic) {
- GLboolean pass = GL_TRUE;
+ pass = pass && check_resulting_mipmaps(0, 0, red);
+ pass = pass && check_resulting_mipmaps(0, SIZE, blue);
+ pass = pass && check_resulting_mipmaps(0, SIZE * 2, red);
- pass = pass && check_resulting_mipmaps(0, 0, red);
- pass = pass && check_resulting_mipmaps(0, SIZE, blue);
- pass = pass && check_resulting_mipmaps(0, SIZE * 2, red);
-
- if (Automatic)
- printf("PIGLIT: {'result': '%s' }\n",
- pass ? "pass" : "fail");
- exit(pass ? 0 : 1);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_SGIS_generate_mipmap");
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glEnable(GL_TEXTURE_2D);
}
-
-int main(int argc, char**argv)
-{
- int i;
- glutInit(&argc, argv);
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("gen-teximage");
- init();
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/texturing/gen-texsubimage.c b/tests/texturing/gen-texsubimage.c
index 18f64158..3b0c75a3 100644
--- a/tests/texturing/gen-texsubimage.c
+++ b/tests/texturing/gen-texsubimage.c
@@ -35,10 +35,8 @@
#include "piglit-util.h"
-#define WIN_WIDTH 512
-#define WIN_HEIGHT 512
-
-static GLboolean Automatic = GL_FALSE;
+int piglit_width = 512, piglit_height = 512;
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
static void display_mipmaps(int start_x, int start_y)
{
@@ -71,8 +69,10 @@ static GLboolean check_resulting_mipmaps(int x, int y, const GLfloat *color)
return pass;
}
-static void display(void)
+enum piglit_result
+piglit_display(void)
{
+ GLboolean pass = GL_TRUE;
GLfloat *data;
const GLfloat red[4] = {1.0, 0.0, 0.0, 0.0};
const GLfloat blue[4] = {0.0, 0.0, 1.0, 0.0};
@@ -129,56 +129,18 @@ static void display(void)
glutSwapBuffers();
glFlush();
- if (Automatic) {
- GLboolean pass = GL_TRUE;
-
- pass = pass && check_resulting_mipmaps(0, 0, blue);
- pass = pass && check_resulting_mipmaps(0, 256, red);
+ pass = pass && check_resulting_mipmaps(0, 0, blue);
+ pass = pass && check_resulting_mipmaps(0, 256, red);
- if (Automatic)
- printf("PIGLIT: {'result': '%s' }\n",
- pass ? "pass" : "fail");
- exit(pass ? 0 : 1);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
-static void init(void)
+void
+piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_SGIS_generate_mipmap");
- /* Set up projection matrix so we can just draw using window
- * coordinates.
- */
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, WIN_WIDTH, 0, WIN_HEIGHT, -1, 1);
-
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glEnable(GL_TEXTURE_2D);
}
-
-int main(int argc, char**argv)
-{
- int i;
- glutInit(&argc, argv);
- for(i = 1; i < argc; ++i) {
- if (!strcmp(argv[i], "-auto"))
- Automatic = 1;
- else
- printf("Unknown option: %s\n", argv[i]);
- }
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(WIN_WIDTH, WIN_HEIGHT);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("gen-texsubimage");
- init();
- glutDisplayFunc(display);
- glutKeyboardFunc(piglit_escape_exit_key);
- glutMainLoop();
-
- return 0;
-}
diff --git a/tests/texturing/getteximage-simple.c b/tests/texturing/getteximage-simple.c
index 07b75eec..d22f34cf 100644
--- a/tests/texturing/getteximage-simple.c
+++ b/tests/texturing/getteximage-simple.c
@@ -12,8 +12,8 @@
#include "piglit-util.h"
-static int Automatic = 0;
-static int Width = 100, Height = 100;
+int piglit_width = 100, piglit_height = 100;
+int piglit_window_mode = GLUT_RGBA | GLUT_DOUBLE;
static GLubyte data[4096]; /* 64*16*4 */
static int test_getteximage(void)
@@ -36,10 +36,10 @@ static int test_getteximage(void)
return 1;
}
-
-static void Display(void)
+enum piglit_result
+piglit_display(void)
{
- int succ;
+ int pass;
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -57,16 +57,16 @@ static void Display(void)
glEnd();
glutSwapBuffers();
-
- succ = test_getteximage();
- if (Automatic)
- piglit_report_result(succ ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
+
+ pass = test_getteximage();
+
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -76,25 +76,12 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-
-
-static void init(void)
+void piglit_init(int argc, char **argv)
{
int i;
+ glutReshapeFunc(Reshape);
+
for(i = 0; i < 4096; ++i)
data[i] = rand() & 0xff;
@@ -102,22 +89,5 @@ static void init(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
- Reshape(Width, Height);
-}
-
-
-int main(int argc, char**argv)
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
- glutInitWindowSize(Width, Height);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Display);
- init();
- glutMainLoop();
- return 0;
+ Reshape(piglit_width, piglit_height);
}
diff --git a/tests/texturing/tex3d.c b/tests/texturing/tex3d.c
index 22f09e2d..9878b502 100644
--- a/tests/texturing/tex3d.c
+++ b/tests/texturing/tex3d.c
@@ -28,7 +28,9 @@
#include "piglit-util.h"
-static int Width = 128, Height = 128;
+int piglit_width = 128, piglit_height = 128;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA;
+
static GLuint Texture;
static int nrcomponents(GLenum format)
@@ -102,7 +104,7 @@ static int render_and_check(int w, int h, int d, GLenum format, float q, unsigne
glVertex2f(x, y+h);
glEnd();
x += w;
- if (x >= Width) {
+ if (x >= piglit_width) {
y += h;
x = 0;
}
@@ -114,7 +116,7 @@ static int render_and_check(int w, int h, int d, GLenum format, float q, unsigne
for(layer = 0; layer < d; ++layer) {
glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, readback+layer*w*h*4);
x += w;
- if (x >= Width) {
+ if (x >= piglit_width) {
y += h;
x = 0;
}
@@ -190,7 +192,8 @@ static void test_simple(int w, int h, int d, GLenum format)
}
}
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
GLenum formats[] = { GL_RGBA, GL_RGB, GL_ALPHA };
int w, h, d, fmt;
@@ -205,40 +208,25 @@ static void Redisplay(void)
}
}
- piglit_report_result(PIGLIT_SUCCESS);
+ return PIGLIT_SUCCESS;
}
static void Reshape(int width, int height)
{
- glViewport(0, 0, Width, Height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, Width, 0.0, Height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ glViewport(0, 0, piglit_width, piglit_height);
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
-static void Init(void)
+void
+piglit_init(int argc, char **argv)
{
- glGenTextures(1, &Texture);
- glBindTexture(GL_TEXTURE_3D, Texture);
- Reshape(Width,Height);
-}
+ piglit_automatic = GL_TRUE;
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_ALPHA);
- glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
- glutDisplayFunc(Redisplay);
- glewInit();
- Init();
- glutMainLoop();
- return 0;
-}
+ glGenTextures(1, &Texture);
+ glBindTexture(GL_TEXTURE_3D, Texture);
+ Reshape(piglit_width, piglit_height);
+}
diff --git a/tests/texturing/texrect-many.c b/tests/texturing/texrect-many.c
index f41920c8..cda51b51 100644
--- a/tests/texturing/texrect-many.c
+++ b/tests/texturing/texrect-many.c
@@ -8,8 +8,9 @@
#include "piglit-util.h"
-static int Width = 16*16, Height = 11*16;
-static int Automatic = 0;
+int piglit_width = 16 * 16, piglit_height = 11 * 16;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA;
+
static int NumTextures = 16;
static GLuint Textures[16];
@@ -70,8 +71,9 @@ static int DoTest(void)
int i;
int clr;
- glReadPixels((2*x+1)*Width/32, (2*y+1)*Height/22,
- 1, 1, GL_RGBA, GL_FLOAT, probe);
+ glReadPixels((2*x+1) * piglit_width / 32,
+ (2*y+1) * piglit_height / 22,
+ 1, 1, GL_RGBA, GL_FLOAT, probe);
printf(" %i/%i: %f,%f,%f,%f", x, y,
probe[0], probe[1], probe[2], probe[3]);
@@ -97,23 +99,21 @@ static int DoTest(void)
}
-static void Display(void)
+enum piglit_result
+piglit_display(void)
{
- int succ;
+ int pass;
DoFrame();
- succ = DoTest();
+ pass = DoTest();
- if (Automatic) {
- printf("\nPIGLIT: { 'result': '%s' }\n", succ ? "pass" : "fail");
- exit(0);
- }
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
- Width = width;
- Height = height;
+ piglit_width = width;
+ piglit_height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -123,24 +123,18 @@ static void Reshape(int width, int height)
glLoadIdentity();
}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-static void init(void)
+void piglit_init(int argc, char **argv)
{
int i;
int maxtextures;
+ if (!GLEW_VERSION_1_3) {
+ printf("Requires OpenGL 1.3\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ glutReshapeFunc(Reshape);
+
piglit_require_extension("GL_ARB_texture_rectangle");
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxtextures);
@@ -178,30 +172,5 @@ static void init(void)
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
- Reshape(Width,Height);
-}
-
-
-int main(int argc, char**argv)
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA);
- glutInitWindowSize(Width, Height);
- glutCreateWindow(argv[0]);
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Display);
- glewInit();
-
- if (!GLEW_VERSION_1_3) {
- printf("Requires OpenGL 1.3\n");
- piglit_report_result(PIGLIT_SKIP);
- exit(1);
- }
-
- init();
- glutMainLoop();
- return 0;
+ Reshape(piglit_width, piglit_height);
}
diff --git a/tests/texturing/texredefine.c b/tests/texturing/texredefine.c
index 5877477a..cb4dd176 100644
--- a/tests/texturing/texredefine.c
+++ b/tests/texturing/texredefine.c
@@ -31,8 +31,8 @@
#include "piglit-util.h"
-static int Width = 128, Height = 128;
-static int Automatic = 0;
+int piglit_width = 128, piglit_height = 128;
+int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;
static const int CellSize = 8; /* see cell_coords */
@@ -174,8 +174,10 @@ static const struct size sizes[] = {
{ 16, 16 }
};
-static void Redisplay(void)
+enum piglit_result
+piglit_display(void)
{
+ GLboolean pass = GL_TRUE;;
int sizeidx;
testnr = 0;
@@ -187,62 +189,27 @@ static void Redisplay(void)
for(sizeidx = 0; sizeidx < sizeof(sizes)/sizeof(sizes[0]); ++sizeidx) {
if (!test_size(sizes[sizeidx].w, sizes[sizeidx].h)) {
- if (Automatic)
- piglit_report_result(PIGLIT_FAILURE);
+ pass = GL_FALSE;
}
}
glDisable(GL_TEXTURE_2D);
glutSwapBuffers();
- if (Automatic)
- piglit_report_result(PIGLIT_SUCCESS);
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
}
static void Reshape(int width, int height)
{
glViewport(0, 0, width, height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ piglit_ortho_projection(width, height, GL_FALSE);
}
-static void Init(void)
+void piglit_init(int argc, char **argv)
{
- Reshape(Width,Height);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
- (void) x;
- (void) y;
- switch (key) {
- case 27:
- exit(0);
- break;
- }
- glutPostRedisplay();
-}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- if (argc == 2 && !strcmp(argv[1], "-auto"))
- Automatic = 1;
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(Width, Height);
- glutInitDisplayMode(GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE);
- glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
- glutDisplayFunc(Redisplay);
- if (!Automatic)
- glutKeyboardFunc(Key);
- Init();
- glutMainLoop();
- return 0;
-}
+ Reshape(piglit_width, piglit_height);
+}
diff --git a/tests/util/piglit-framework.c b/tests/util/piglit-framework.c
index 5a2d9982..f4ebb348 100644
--- a/tests/util/piglit-framework.c
+++ b/tests/util/piglit-framework.c
@@ -45,7 +45,7 @@ int piglit_automatic = 0;
static void
display(void)
{
- const int result = piglit_display();
+ const enum piglit_result result = piglit_display();
if (piglit_automatic)
piglit_report_result(result);
diff --git a/tests/util/piglit-framework.h b/tests/util/piglit-framework.h
index e0038911..c3bdde94 100644
--- a/tests/util/piglit-framework.h
+++ b/tests/util/piglit-framework.h
@@ -27,5 +27,5 @@ extern int piglit_window_mode;
extern int piglit_width;
extern int piglit_height;
-extern int piglit_display(void);
+extern enum piglit_result piglit_display(void);
extern void piglit_init(int argc, char **argv);
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 10c7b62f..e6f62c93 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -38,14 +38,16 @@
#include <GL/glext.h>
#endif
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
-
enum piglit_result {
PIGLIT_SUCCESS,
PIGLIT_FAILURE,
PIGLIT_SKIP
};
+#include "piglit-framework.h"
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+
int FindLine(const char *program, int position);
void piglit_report_result(enum piglit_result result);
void piglit_require_extension(const char *name);