graw: Export graw_save_surface_to_file().
[mesa.git] / src / gallium / tests / graw / tri-instanced.c
index 8859f745fdb4f50cc97ac260f7811887cbde5ed1..76443811629ed7668273654bdc9a64709d7463d0 100644 (file)
@@ -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");