Commit d930dc2c authored by Eric Anholt's avatar Eric Anholt

Warnings cleanup, resulting in a number of actual bugfixes.

parent aec22b40
......@@ -31,8 +31,6 @@ static GLuint tex_name;
void init()
{
int i, j;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glTranslatef(-1.0, -1.0, 0.0);
......@@ -66,7 +64,6 @@ void init()
void display()
{
int i, j, k, col, pixel;
GLubyte zero_data = 0;
GLfloat expected[4];
float dmax = 0.0;
......@@ -179,4 +176,6 @@ int main(int argc, char**argv)
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
......@@ -53,7 +53,7 @@ int main(int argc, char**argv)
{
GLfloat data = 1.0;
GLfloat *v;
int buf;
GLuint buf;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
......
......@@ -36,6 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#if defined(__APPLE__)
......
......@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if defined(__APPLE__)
#include <GLUT/glut.h>
#else
......
......@@ -86,8 +86,6 @@ static void test(GLenum wrapt, int cellx, int celly)
static void Redisplay(void)
{
int x, y;
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
......@@ -150,7 +148,6 @@ static void Key(unsigned char key, int x, int y)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
Automatic = 1;
......
......@@ -71,27 +71,11 @@ static void rect(int x1, int y1, int x2, int y2)
glEnd();
}
static void
report_fail(char *name, char *method, int x, int y,
GLfloat *results, GLfloat *expected)
{
printf("%s vs %s: expected at (%d,%d): %f,%f,%f\n",
name, method, x, y, expected[0], expected[1], expected[2]);
printf("%s vs %s: results at (%d,%d): %f,%f,%f\n",
name, method, x, y,
results[0], results[1], results[2]);
}
static int
create_3d_fbo(void)
{
GLuint tex, fb, rb;
GLuint tex, fb;
GLenum status;
GLboolean pass = GL_TRUE;
int subrect_w = BUF_WIDTH / 5;
int subrect_h = BUF_HEIGHT / 5;
int x, y;
int rbits, gbits, bbits, abits;
int depth;
glGenTextures(1, &tex);
......@@ -141,7 +125,7 @@ done:
return tex;
}
static GLboolean
static void
draw_depth(int x, int y, int depth)
{
float depth_coord = (float)depth / (NUM_DEPTHS - 1);
......@@ -189,13 +173,16 @@ static GLboolean test_depth_drawing(int start_x, int start_y, float *expected)
pass &= piglit_probe_pixel_rgb(x, y, expected);
}
}
return pass;
}
static void
display()
{
GLboolean pass = GL_TRUE;
int depth, tex;
int depth;
GLuint tex;
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
......@@ -205,7 +192,7 @@ display()
for (depth = 0; depth < NUM_DEPTHS; depth++) {
int x = 1 + depth * (BUF_WIDTH + 1);
int y = 1;
pass &= draw_depth(x, y, depth);
draw_depth(x, y, depth);
}
for (depth = 0; depth < NUM_DEPTHS; depth++) {
......@@ -238,4 +225,6 @@ int main(int argc, char**argv)
piglit_require_extension("GL_EXT_framebuffer_object");
glutMainLoop();
return 0;
}
......@@ -76,28 +76,12 @@ static void rect(int x1, int y1, int x2, int y2)
glEnd();
}
static void
report_fail(char *name, char *method, int x, int y,
GLfloat *results, GLfloat *expected)
{
printf("%s vs %s: expected at (%d,%d): %f,%f,%f\n",
name, method, x, y, expected[0], expected[1], expected[2]);
printf("%s vs %s: results at (%d,%d): %f,%f,%f\n",
name, method, x, y,
results[0], results[1], results[2]);
}
static int
create_cube_fbo(void)
{
GLuint tex, fb, rb;
GLuint tex, fb;
GLenum status;
GLboolean pass = GL_TRUE;
int subrect_w = BUF_WIDTH / 5;
int subrect_h = BUF_HEIGHT / 5;
int x, y;
int rbits, gbits, bbits, abits;
int face, dim, i;
int face, dim;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
......@@ -161,7 +145,7 @@ done:
return tex;
}
static GLboolean
static void
draw_face(int x, int y, int dim, int face)
{
glViewport(0, 0, WIN_WIDTH, WIN_HEIGHT);
......@@ -207,13 +191,16 @@ static GLboolean test_face_drawing(int start_x, int start_y, int dim,
pass &= piglit_probe_pixel_rgb(x, y, expected);
}
}
return pass;
}
static void
display()
{
GLboolean pass = GL_TRUE;
int face, tex, dim;
int face, dim;
GLuint tex;
glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
......@@ -225,7 +212,7 @@ display()
int y = 1;
for (dim = BUF_WIDTH; dim > 0; dim /= 2) {
pass &= draw_face(x, y, dim, face);
draw_face(x, y, dim, face);
y += dim + 1;
}
}
......@@ -268,4 +255,6 @@ int main(int argc, char**argv)
piglit_require_extension("GL_ARB_texture_cube_map");
glutMainLoop();
return 0;
}
......@@ -42,6 +42,8 @@
#include <stdio.h>
#include <stdlib.h>
#include "piglit-util.h"
#define BUF_WIDTH 32
#define BUF_HEIGHT 32
#define WIN_WIDTH 100
......@@ -59,22 +61,11 @@ static void rect(int x1, int y1, int x2, int y2)
glEnd();
}
static void
report_fail(char *name, char *method, int x, int y,
GLfloat *results, GLfloat *expected)
{
printf("%s vs %s: expected at (%d,%d): %f,%f,%f\n",
name, method, x, y, expected[0], expected[1], expected[2]);
printf("%s vs %s: results at (%d,%d): %f,%f,%f\n",
name, method, x, y,
results[0], results[1], results[2]);
}
static GLboolean
test_with_format(GLenum internal_format, GLenum format, GLenum type,
float results_x, float results_y)
{
GLuint tex, fb, rb;
GLuint tex, fb;
GLenum status;
GLboolean pass = GL_TRUE;
int subrect_w = BUF_WIDTH / 5;
......@@ -257,4 +248,6 @@ int main(int argc, char**argv)
piglit_require_extension("GL_EXT_framebuffer_object");
glutMainLoop();
return 0;
}
......@@ -42,7 +42,6 @@
static int Width = 128, Height = 128;
static int Automatic = 0;
static int CurrentTest = 0;
static void probe_pixel(int x, int y, const float* expected)
{
......@@ -234,7 +233,6 @@ static void Key(unsigned char key, int x, int y)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
Automatic = 1;
......
......@@ -238,7 +238,6 @@ static void Key(unsigned char key, int x, int y)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
Automatic = 1;
......
......@@ -261,7 +261,6 @@ static void Key(unsigned char key, int x, int y)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
Automatic = 1;
......
......@@ -131,8 +131,6 @@ static void Redisplay(void)
pass &= piglit_probe_pixel_rgb(Width * 3 / 6, Height / 2, black);
pass &= piglit_probe_pixel_rgb(Width * 5 / 6, Height / 2, blue);
if (Automatic) {
int i;
if (pass)
piglit_report_result(PIGLIT_SUCCESS);
else
......@@ -168,7 +166,6 @@ static void Key(unsigned char key, int x, int y)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
Automatic = 1;
......
......@@ -49,7 +49,6 @@ static const int SubX = 32, SubY = 32;
static const int SubWidth = 64, SubHeight = 64;
static int Automatic = 0;
static int CurrentTest = 0;
static int MainWindow;
static int SubWindow;
......@@ -187,7 +186,6 @@ static void Key(unsigned char key, int x, int y)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
Automatic = 1;
......
......@@ -37,11 +37,6 @@
#endif
#include "piglit-util.h"
static void CheckFail(const char* cond);
#define check(cond) do { if (!(cond)) CheckFail(#cond); } while(0)
#define NUM_PROGRAMS 4
static GLuint FragProg[NUM_PROGRAMS];
......@@ -96,8 +91,6 @@ static int Width = 200, Height = 200;
*/
static void DoFrame(void)
{
int mask;
printf("rgba: %i %i %i %i\n",
glutGet(GLUT_WINDOW_RED_SIZE),
glutGet(GLUT_WINDOW_GREEN_SIZE),
......@@ -407,14 +400,6 @@ static void Init(void)
Reshape(Width,Height);
}
static void CheckFail(const char* cond)
{
fprintf(stderr, "Check failed: %s\n", cond);
if (Automatic)
printf("PIGLIT: {'result': 'fail' }\n");
abort();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
......
......@@ -112,8 +112,6 @@ static void readTestcase(struct testcase* tc, const char* filename)
for(i = 0; i < tc->nrInstances; ++i) {
struct testinstance* inst = tc->instances + i;
char buffer[41];
int j;
expect(filp, "tc");
inst->texcoords = readfloatarray(filp, tc->nrTexCoords*4);
......
......@@ -39,11 +39,6 @@
#include "piglit-util.h"
static void CheckFail(const char* cond);
#define check(cond) do { if (!(cond)) CheckFail(#cond); } while(0)
#define NUM_PROGRAMS 5
static GLuint FragProg[NUM_PROGRAMS];
......@@ -76,7 +71,6 @@ static int Width = 300, Height = 200;
static void DoFrame(void)
{
int mask;
int i;
glClearColor(0.3, 0.3, 0.3, 0.3);
......@@ -234,9 +228,7 @@ static void Key(unsigned char key, int x, int y)
static void Init(void)
{
int i, x, y;
GLubyte rectangle[200][200][4];
GLubyte tex[256][256][4];
int i;
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
......@@ -248,14 +240,6 @@ static void Init(void)
Reshape(Width,Height);
}
static void CheckFail(const char* cond)
{
fprintf(stderr, "Check failed: %s\n", cond);
if (Automatic)
printf("PIGLIT: {'result': 'fail' }\n");
abort();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
......
......@@ -121,12 +121,12 @@ static char *gen_temporary_source_indirections(int sample_count,
char *pre =
"!!ARBfp1.0\n"
"TEMP val, val2, sample, sample2;\n"
"MOV val, fragment.color;\n";
"MOV val, fragment.color;\n"
"MOV val2, fragment.color;\n";
char *sample =
"TEX sample, val, texture[0], 2D;\n"
"TEX sample2, val2, texture[1], 2D;\n"
"MUL val, sample, sample2;\n";
"MUL val, sample, sample2;\n"
"MUL val2, val2, val;\n";
char *post =
"MOV result.color, val;\n"
......@@ -274,8 +274,6 @@ void display(void)
void init(void)
{
GLboolean pass = GL_FALSE;
piglit_require_fragment_program();
glEnable(GL_FRAGMENT_PROGRAM_ARB);
......
......@@ -37,11 +37,6 @@
#endif
#include "piglit-util.h"
static void CheckFail(const char* cond);
#define check(cond) do { if (!(cond)) CheckFail(#cond); } while(0)
#define NUM_PROGRAMS 2
static GLuint FragProg[NUM_PROGRAMS];
......@@ -68,8 +63,6 @@ static int Width = 200, Height = 200; // space for more tests
static void DoFrame(void)
{
int mask;
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
......@@ -347,14 +340,6 @@ static void Init(void)
Reshape(Width,Height);
}
static void CheckFail(const char* cond)
{
fprintf(stderr, "Check failed: %s\n", cond);
if (Automatic)
printf("PIGLIT: {'result': 'fail' }\n");
abort();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
......
......@@ -174,7 +174,6 @@ static void Init(void)
* Fragment programs
*/
for(mask = 1; mask < 16; ++mask) {
GLint errorPos;
char programText[1024];
char maskstring[5];
......
......@@ -203,7 +203,6 @@ static void Key(unsigned char key, int x, int y)
static void Init(void)
{
GLint errorPos;
GLubyte data[256][256][4];
int x,y;
......
......@@ -131,8 +131,6 @@ static GLboolean
test_results(int x, int y, int size, int level, int face, GLboolean mipmapped,
int color)
{
GLfloat pix[4];
GLfloat probe[4];
GLfloat *color1 = colors[color];
GLfloat *color2 = colors[(color + 1) % ARRAY_SIZE(colors)];
GLboolean pass = GL_TRUE;
......@@ -163,7 +161,7 @@ draw_at_size(int size, GLboolean mipmapped)
GLfloat row_y = PAD;
int dim, face;
int color = 0, level = 0;
GLint texname;
GLuint texname;
GLboolean pass = GL_TRUE;
/* Create the texture. */
......@@ -351,4 +349,6 @@ int main(int argc, char**argv)
glutKeyboardFunc(Key);
}
glutMainLoop();
return 0;
}
......@@ -108,7 +108,7 @@ static void display()
{
const GLfloat red[4] = {1.0, 0.0, 0.0, 0.0};
const GLfloat blue[4] = {0.0, 0.0, 1.0, 0.0};
GLint texture;
GLuint texture;
int i;
glClearColor(0, 0, 0, 0);
......@@ -160,7 +160,6 @@ static void display()
glFlush();
if (Automatic) {
int dim;
GLboolean pass = GL_TRUE;
pass = pass && check_resulting_mipmaps(0, 0, red);
......@@ -210,4 +209,6 @@ int main(int argc, char**argv)
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
......@@ -86,7 +86,7 @@ static void display()
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};
GLint texture;
GLuint texture;
int i;
glClearColor(0, 0, 0, 0);
......@@ -140,7 +140,6 @@ static void display()
glFlush();
if (Automatic) {
int dim;
GLboolean pass = GL_TRUE;
pass = pass && check_resulting_mipmaps(0, 0, blue);
......@@ -189,4 +188,6 @@ int main(int argc, char**argv)
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
......@@ -330,7 +330,6 @@ static void Key(unsigned char key, int x, int y)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
Automatic = 1;
......
......@@ -240,7 +240,6 @@ static void Init(void)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(Width, Height);
......
......@@ -386,7 +386,6 @@ static void Key(unsigned char key, int x, int y)
static void init()
{
GLfloat texbuf[4];
int i;
piglit_require_extension("GL_ARB_depth_texture");
HaveShadow = glutExtensionSupported("GL_ARB_shadow");
......
......@@ -43,7 +43,6 @@
static int Width = 128, Height = 128;
static int Automatic = 0;
static int CurrentTest = 0;
static const int CellSize = 8; /* see cell_coords */
......@@ -240,7 +239,6 @@ static void Key(unsigned char key, int x, int y)
int main(int argc, char *argv[])
{
int i;
glutInit(&argc, argv);
if (argc == 2 && !strcmp(argv[1], "-auto"))
Automatic = 1;
......
......@@ -94,12 +94,14 @@ check_results(GLboolean has_alpha, int x, int y, int w, int h)
x + w * 1 / 4, y + h * 3 / 4);
pass &= check_pixel(has_alpha, tex_data[3],
x + w * 3 / 4, y + h * 3 / 4);
return pass;
}
static void
draw_pixmap(GLXPixmap pixmap, int x, int y, int w, int h)
{
GLint texname;
GLuint texname;
GLfloat tex_coords[] = {
0.0f, 0.0f,
1.0f, 0.0f,
......@@ -353,7 +355,6 @@ event_loop ()
int main(int argc, char**argv)
{
XSetWindowAttributes attr;
unsigned long mask;
XVisualInfo *visinfo;
int attrib[] = {
......@@ -367,6 +368,7 @@ int main(int argc, char**argv)
XSetWindowAttributes window_attr;