graw: Export graw_save_surface_to_file().
[mesa.git] / src / gallium / tests / graw / vs-test.c
index e1cd814bf72ae52fcd96881f2d36998f7ae67321..440c40bdcdab9bfb0917345cb3ce7b68f83a5f67 100644 (file)
@@ -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);
       }
    }