summaryrefslogtreecommitdiffstats
path: root/src/gallium/tests/graw
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/tests/graw')
-rw-r--r--src/gallium/tests/graw/SConscript26
-rw-r--r--src/gallium/tests/graw/clear.c25
-rw-r--r--src/gallium/tests/graw/fs-test.c26
-rw-r--r--src/gallium/tests/graw/gs-test.c27
-rw-r--r--src/gallium/tests/graw/quad-tex.c25
-rw-r--r--src/gallium/tests/graw/shader-leak.c1
-rw-r--r--src/gallium/tests/graw/tri-gs.c1
-rw-r--r--src/gallium/tests/graw/tri-instanced.c26
-rw-r--r--src/gallium/tests/graw/tri.c25
-rw-r--r--src/gallium/tests/graw/vs-test.c26
10 files changed, 93 insertions, 115 deletions
diff --git a/src/gallium/tests/graw/SConscript b/src/gallium/tests/graw/SConscript
index ffde61965b4..3341b884985 100644
--- a/src/gallium/tests/graw/SConscript
+++ b/src/gallium/tests/graw/SConscript
@@ -1,20 +1,17 @@
Import('*')
-try:
- graw
-except NameError:
- print 'warning: graw library not avaiable: skipping build of graw test'
- Return()
-
env = env.Clone()
+env.Prepend(LIBS = [gallium])
+
env.Prepend(LIBPATH = [graw.dir])
-env.Prepend(LIBS = ['graw'] + gallium)
+env.Prepend(LIBS = ['graw'])
+
-if platform in ('freebsd8', 'sunos5'):
+if env['platform'] in ('freebsd8', 'sunos5'):
env.Append(LIBS = ['m'])
-if platform == 'freebsd8':
+if env['platform'] == 'freebsd8':
env.Append(LIBS = ['pthread'])
progs = [
@@ -29,9 +26,10 @@ progs = [
'tri-gs',
]
-for prog in progs:
- env.Program(
- target = prog,
- source = prog + '.c',
+for name in progs:
+ program = env.Program(
+ target = name,
+ source = name + '.c',
)
-
+ #env.Depends(program, graw)
+ env.Alias('graw-progs', program)
diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c
index ce52a93aa1b..ee4581ef1ed 100644
--- a/src/gallium/tests/graw/clear.c
+++ b/src/gallium/tests/graw/clear.c
@@ -8,8 +8,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
-
enum pipe_format formats[] = {
PIPE_FORMAT_R8G8B8A8_UNORM,
PIPE_FORMAT_B8G8R8A8_UNORM,
@@ -31,17 +29,7 @@ static void draw( void )
ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
-#if 0
- /* At the moment, libgraw leaks out/makes available some of the
- * symbols from gallium/auxiliary, including these debug helpers.
- * Will eventually want to bless some of these paths, and lock the
- * others down so they aren't accessible from test programs.
- *
- * This currently just happens to work on debug builds - a release
- * build will probably fail to link here:
- */
- debug_dump_surface_bmp(ctx, "result.bmp", surf);
-#endif
+ graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, surf, window);
}
@@ -103,10 +91,21 @@ static void init( void )
ctx->set_framebuffer_state(ctx, &fb);
}
+static void args(int argc, char *argv[])
+{
+ int i;
+ for (i = 1; i < argc;) {
+ if (graw_parse_args(&i, argc, argv)) {
+ continue;
+ }
+ exit(1);
+ }
+}
int main( int argc, char *argv[] )
{
+ args(argc, argv);
init();
graw_set_display_func( draw );
diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
index 53fbb744d86..19af83fda88 100644
--- a/src/gallium/tests/graw/fs-test.c
+++ b/src/gallium/tests/graw/fs-test.c
@@ -10,7 +10,6 @@
#include "pipe/p_defines.h"
#include <stdio.h> /* for fread(), etc */
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
#include "util/u_inlines.h"
#include "util/u_memory.h" /* Offset() */
#include "util/u_draw_quad.h"
@@ -279,17 +278,7 @@ static void draw( void )
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
-#if 0
- /* At the moment, libgraw leaks out/makes available some of the
- * symbols from gallium/auxiliary, including these debug helpers.
- * Will eventually want to bless some of these paths, and lock the
- * others down so they aren't accessible from test programs.
- *
- * This currently just happens to work on debug builds - a release
- * build will probably fail to link here:
- */
- debug_dump_surface_bmp(ctx, "result.bmp", surf);
-#endif
+ graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, surf, window);
}
@@ -526,16 +515,21 @@ static void args(int argc, char *argv[])
{
int i;
- for (i = 1; i < argc; i++) {
+ for (i = 1; i < argc;) {
+ if (graw_parse_args(&i, argc, argv)) {
+ continue;
+ }
if (strcmp(argv[i], "-fps") == 0) {
show_fps = 1;
+ i++;
}
else if (i == argc - 1) {
- filename = argv[i];
+ filename = argv[i];
+ i++;
}
else {
- usage(argv[0]);
- exit(1);
+ usage(argv[0]);
+ exit(1);
}
}
diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
index 62714900bd9..ef29f134980 100644
--- a/src/gallium/tests/graw/gs-test.c
+++ b/src/gallium/tests/graw/gs-test.c
@@ -10,7 +10,6 @@
#include "pipe/p_defines.h"
#include <stdio.h> /* for fread(), etc */
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
#include "util/u_inlines.h"
#include "util/u_memory.h" /* Offset() */
#include "util/u_draw_quad.h"
@@ -343,17 +342,7 @@ static void draw( void )
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
-#if 0
- /* At the moment, libgraw leaks out/makes available some of the
- * symbols from gallium/auxiliary, including these debug helpers.
- * Will eventually want to bless some of these paths, and lock the
- * others down so they aren't accessible from test programs.
- *
- * This currently just happens to work on debug builds - a release
- * build will probably fail to link here:
- */
- debug_dump_surface_bmp(ctx, "result.bmp", surf);
-#endif
+ graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, surf, window);
}
@@ -591,19 +580,25 @@ static void args(int argc, char *argv[])
{
int i;
- for (i = 1; i < argc; i++) {
+ for (i = 1; i < argc;) {
+ if (graw_parse_args(&i, argc, argv)) {
+ continue;
+ }
if (strcmp(argv[i], "-fps") == 0) {
show_fps = 1;
+ i++;
}
else if (strcmp(argv[i], "-strip") == 0) {
draw_strip = 1;
+ i++;
}
else if (i == argc - 1) {
- filename = argv[i];
+ filename = argv[i];
+ i++;
}
else {
- usage(argv[0]);
- exit(1);
+ usage(argv[0]);
+ exit(1);
}
}
diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c
index c50ef12ab5a..35eade939e6 100644
--- a/src/gallium/tests/graw/quad-tex.c
+++ b/src/gallium/tests/graw/quad-tex.c
@@ -9,7 +9,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
#include "util/u_inlines.h"
#include "util/u_memory.h" /* Offset() */
#include "util/u_draw_quad.h"
@@ -150,17 +149,7 @@ static void draw( void )
util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
-#if 0
- /* At the moment, libgraw leaks out/makes available some of the
- * symbols from gallium/auxiliary, including these debug helpers.
- * Will eventually want to bless some of these paths, and lock the
- * others down so they aren't accessible from test programs.
- *
- * This currently just happens to work on debug builds - a release
- * build will probably fail to link here:
- */
- debug_dump_surface_bmp(ctx, "result.bmp", surf);
-#endif
+ graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, surf, window);
}
@@ -392,9 +381,21 @@ static void init( void )
set_fragment_shader();
}
+static void args(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc;) {
+ if (graw_parse_args(&i, argc, argv)) {
+ continue;
+ }
+ exit(1);
+ }
+}
int main( int argc, char *argv[] )
{
+ args(argc, argv);
init();
graw_set_display_func( draw );
diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c
index ec30871e82c..0a6c362d172 100644
--- a/src/gallium/tests/graw/shader-leak.c
+++ b/src/gallium/tests/graw/shader-leak.c
@@ -9,7 +9,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
#include "util/u_memory.h" /* Offset() */
#include "util/u_draw_quad.h"
diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c
index 152ae408eb0..731c4e10cfd 100644
--- a/src/gallium/tests/graw/tri-gs.c
+++ b/src/gallium/tests/graw/tri-gs.c
@@ -8,7 +8,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
#include "util/u_memory.h" /* Offset() */
#include "util/u_draw_quad.h"
diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c
index 8859f745fdb..76443811629 100644
--- a/src/gallium/tests/graw/tri-instanced.c
+++ b/src/gallium/tests/graw/tri-instanced.c
@@ -11,7 +11,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
#include "util/u_memory.h" /* Offset() */
#include "util/u_draw_quad.h"
@@ -215,17 +214,7 @@ static void draw( void )
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
-#if 0
- /* At the moment, libgraw leaks out/makes available some of the
- * symbols from gallium/auxiliary, including these debug helpers.
- * Will eventually want to bless some of these paths, and lock the
- * others down so they aren't accessible from test programs.
- *
- * This currently just happens to work on debug builds - a release
- * build will probably fail to link here:
- */
- debug_dump_surface_bmp(ctx, "result.bmp", surf);
-#endif
+ graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, surf, window);
}
@@ -322,9 +311,18 @@ static void init( void )
static void options(int argc, char *argv[])
{
int i;
- for (i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-e") == 0)
+
+ for (i = 1; i < argc;) {
+ if (graw_parse_args(&i, argc, argv)) {
+ continue;
+ }
+ if (strcmp(argv[i], "-e") == 0) {
draw_elements = 1;
+ i++;
+ }
+ else {
+ i++;
+ }
}
if (draw_elements)
printf("Using pipe_context::draw_elements_instanced()\n");
diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c
index f7e39588a4d..025a1470dc9 100644
--- a/src/gallium/tests/graw/tri.c
+++ b/src/gallium/tests/graw/tri.c
@@ -10,7 +10,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
#include "util/u_memory.h" /* Offset() */
#include "util/u_draw_quad.h"
@@ -143,17 +142,7 @@ static void draw( void )
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
-#if 0
- /* At the moment, libgraw leaks out/makes available some of the
- * symbols from gallium/auxiliary, including these debug helpers.
- * Will eventually want to bless some of these paths, and lock the
- * others down so they aren't accessible from test programs.
- *
- * This currently just happens to work on debug builds - a release
- * build will probably fail to link here:
- */
- debug_dump_surface_bmp(ctx, "result.bmp", surf);
-#endif
+ graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, surf, window);
}
@@ -252,9 +241,21 @@ static void init( void )
set_fragment_shader();
}
+static void args(int argc, char *argv[])
+{
+ int i;
+
+ for (i = 1; i < argc;) {
+ if (graw_parse_args(&i, argc, argv)) {
+ continue;
+ }
+ exit(1);
+ }
+}
int main( int argc, char *argv[] )
{
+ args(argc, argv);
init();
graw_set_display_func( draw );
diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c
index e1cd814bf72..440c40bdcda 100644
--- a/src/gallium/tests/graw/vs-test.c
+++ b/src/gallium/tests/graw/vs-test.c
@@ -11,7 +11,6 @@
#include <stdio.h> /* for fread(), etc */
-#include "util/u_debug.h" /* debug_dump_surface_bmp() */
#include "util/u_inlines.h"
#include "util/u_memory.h" /* Offset() */
#include "util/u_draw_quad.h"
@@ -230,17 +229,7 @@ static void draw( void )
util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, Elements(vertices));
ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
-#if 0
- /* At the moment, libgraw leaks out/makes available some of the
- * symbols from gallium/auxiliary, including these debug helpers.
- * Will eventually want to bless some of these paths, and lock the
- * others down so they aren't accessible from test programs.
- *
- * This currently just happens to work on debug builds - a release
- * build will probably fail to link here:
- */
- debug_dump_surface_bmp(ctx, "result.bmp", surf);
-#endif
+ graw_save_surface_to_file(ctx, surf, NULL);
screen->flush_frontbuffer(screen, surf, window);
}
@@ -478,16 +467,21 @@ static void args(int argc, char *argv[])
{
int i;
- for (i = 1; i < argc; i++) {
+ for (i = 1; i < argc;) {
+ if (graw_parse_args(&i, argc, argv)) {
+ continue;
+ }
if (strcmp(argv[i], "-fps") == 0) {
show_fps = 1;
+ i++;
}
else if (i == argc - 1) {
- filename = argv[i];
+ filename = argv[i];
+ i++;
}
else {
- usage(argv[0]);
- exit(1);
+ usage(argv[0]);
+ exit(1);
}
}