Commit 973db3e1 authored by Chad Versace's avatar Chad Versace

util: Convert GL tests to use PIGLIT_GL_CONFIG_BEGIN/END

This patch has two components.

1. In tests/util/piglit-framework-gl.h, replace the definition of
PIGLIT_GL_TEST_MAIN with the macro block PIGLIT_GL_CONFIG_BEGIN/END.

The macro PIGLIT_GL_TEST_MAIN was very restrictive. It was a fixed-arity
macro function that allowed a test to set only set 3 values: window width,
height, and visual. It would have been difficult to shoehorn optional test
attributes into such a fixed-arity macro function. Allowing optional
attributes is an essential feature because a following commit adds
optional fields to struct piglit_gl_test_config.

The macro block PIGLIT_GL_TEST_CONFIG_BEGIN/END is more flexible. Within
it the test is allowed to arbitrarilty modify the piglit_gl_test_config
structure.

2. In each GL test source, replace PIGLIT_GL_TEST_MAIN with
a PIGLIT_GL_TEST_CONFIG_BEGIN/END block.
Reviewed-and-tested-by: Jordan Justen's avatarJordan Justen <jordan.l.justen@intel.com>
Tested-by: Paul Berry's avatarPaul Berry <stereotype441@gmail.com>
Acked-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent 8ed4af46
......@@ -30,10 +30,13 @@
#define TRUE (!FALSE)
#endif
PIGLIT_GL_TEST_MAIN(
250 /*window_width*/,
250 /*window_height*/,
PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_DEPTH)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 250;
config.window_height = 250;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_DEPTH;
PIGLIT_GL_TEST_CONFIG_END
char *
unix_line_endings(const char *input, size_t length)
......
......@@ -8,10 +8,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
......
......@@ -9,10 +9,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
......
......@@ -36,10 +36,13 @@
*/
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
PIGLIT_GL_TEST_CONFIG_END
float color[7][4] = {
{ 0.1, 0.2, 0.3, 1.0 },
......
......@@ -5,10 +5,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
128 /*window_width*/,
128 /*window_height*/,
PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_RGB)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 128;
config.window_height = 128;
config.window_visual = PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_RGB;
PIGLIT_GL_TEST_CONFIG_END
#define BITMAP_WIDTH 1
#define BITMAP_HEIGHT 1
......
......@@ -32,10 +32,13 @@
*/
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
128 /*window_width*/,
128 /*window_height*/,
PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_RGB)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 128;
config.window_height = 128;
config.window_visual = PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_RGB;
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char**argv)
......
......@@ -36,10 +36,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
128 /*window_width*/,
128 /*window_height*/,
PIGLIT_GL_VISUAL_RGB)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 128;
config.window_height = 128;
config.window_visual = PIGLIT_GL_VISUAL_RGB;
PIGLIT_GL_TEST_CONFIG_END
static GLuint fb;
static GLuint tex;
......
......@@ -25,10 +25,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
400 /*window_width*/,
300 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 400;
config.window_height = 300;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
PIGLIT_GL_TEST_CONFIG_END
static GLuint vBuffer;
......
......@@ -5,10 +5,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
250 /*window_width*/,
250 /*window_height*/,
PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_RGB)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 250;
config.window_height = 250;
config.window_visual = PIGLIT_GL_VISUAL_SINGLE | PIGLIT_GL_VISUAL_RGB;
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
......
......@@ -26,10 +26,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL;
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
......
......@@ -26,10 +26,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL;
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char **argv)
......
......@@ -34,10 +34,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
16 /*window_width*/,
16 /*window_height*/,
PIGLIT_GL_VISUAL_RGBA)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 16;
config.window_height = 16;
config.window_visual = PIGLIT_GL_VISUAL_RGBA;
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result piglit_display(void)
{
......
......@@ -40,10 +40,13 @@
#define TEST_COLS 5
#define BOX_SIZE (1 << (TEST_COLS + 1))
PIGLIT_GL_TEST_MAIN(
(BOX_SIZE + 2) * TEST_COLS + 1 /*window_width*/,
(BOX_SIZE + 1) + 1 /*window_height*/,
PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = (BOX_SIZE+2)*TEST_COLS+1;
config.window_height = (BOX_SIZE+1)+1;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
PIGLIT_GL_TEST_CONFIG_END
static GLuint tex[1];
......
......@@ -26,10 +26,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DEPTH | PIGLIT_GL_VISUAL_STENCIL;
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
......
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
512 /*window_width*/,
512 /*window_height*/,
PIGLIT_GL_VISUAL_RGBA)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 512;
config.window_height = 512;
config.window_visual = PIGLIT_GL_VISUAL_RGBA;
PIGLIT_GL_TEST_CONFIG_END
void
piglit_init(int argc, char *argv[])
......
......@@ -5,10 +5,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
......
......@@ -34,10 +34,13 @@
#define TEST_COLS 6
#define TEST_ROWS 2
PIGLIT_GL_TEST_MAIN(
1 + ((BOX_SIZE + 1) * TEST_COLS) /*window_width*/,
1 + ((BOX_SIZE + 1) * TEST_ROWS) /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 1+((BOX_SIZE+1)*TEST_COLS);
config.window_height = 1+((BOX_SIZE+1)*TEST_ROWS);
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
PIGLIT_GL_TEST_CONFIG_END
static float maxSize = 0.0f;
static GLuint tex;
......
......@@ -17,10 +17,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
PIGLIT_GL_TEST_CONFIG_END
static GLfloat colors[8][3] = {
{ 1.0, 1.0, 1.0 },
......
......@@ -32,10 +32,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
256 /*window_width*/,
128 /*window_height*/,
PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 256;
config.window_height = 128;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
PIGLIT_GL_TEST_CONFIG_END
static const GLfloat TextureColor[3] = { 1.0, 0.5, 0.0 };
......
......@@ -30,10 +30,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
400 /*window_width*/,
400 /*window_height*/,
PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 400;
config.window_height = 400;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
PIGLIT_GL_TEST_CONFIG_END
static void
make_texture(void)
......
......@@ -32,10 +32,13 @@
#include "piglit-util-gl-common.h"
PIGLIT_GL_TEST_MAIN(
100 /*window_width*/,
100 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 100;
config.window_height = 100;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
......
......@@ -35,10 +35,13 @@
#define BUF_WIDTH 32
PIGLIT_GL_TEST_MAIN(
50 /*window_width*/,
20 /*window_height*/,
PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH)
PIGLIT_GL_TEST_CONFIG_BEGIN
config.window_width = 50;
config.window_height = 20;
config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH;
PIGLIT_GL_TEST_CONFIG_END