graw/tests: Use pipe_context::draw_vbo.
authorChia-I Wu <olv@lunarg.com>
Thu, 29 Jul 2010 08:04:28 +0000 (16:04 +0800)
committerChia-I Wu <olv@lunarg.com>
Thu, 29 Jul 2010 08:21:10 +0000 (16:21 +0800)
The other drawing variants such as draw_arrays or
draw_elements_instanced were removed.

This fixes fdo bug #29287.

src/gallium/tests/graw/fs-test.c
src/gallium/tests/graw/gs-test.c
src/gallium/tests/graw/quad-tex.c
src/gallium/tests/graw/tri-gs.c
src/gallium/tests/graw/tri-instanced.c
src/gallium/tests/graw/tri.c
src/gallium/tests/graw/vs-test.c

index dea087357d62d64a463130612eabb4292210fac6..53fbb744d86f3ed62d6cbeace6c3cfa98b0a6728 100644 (file)
@@ -13,6 +13,7 @@
 #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"
 #include "util/u_box.h"    
 
 static const char *filename = NULL;
@@ -275,7 +276,7 @@ static void draw( void )
    float clear_color[4] = {.1,.3,.5,0};
 
    ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
-   ctx->draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
+   util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
    ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
 #if 0
index 3087d446fcaf709b97955fa37117b9150474b1b5..62714900bd9d5ce3bcb50ec14b6dbe91aa8ff388 100644 (file)
@@ -13,6 +13,7 @@
 #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"
 #include "util/u_box.h"    
 
 static const char *filename = NULL;
@@ -336,9 +337,9 @@ static void draw( void )
 
    ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
    if (draw_strip)
-      ctx->draw_arrays(ctx, PIPE_PRIM_TRIANGLE_STRIP, 0, 4);
+      util_draw_arrays(ctx, PIPE_PRIM_TRIANGLE_STRIP, 0, 4);
    else
-      ctx->draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
+      util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
 
    ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
index 6a0a2ba2950f98fa30c049d05bf90134ee22c8ae..c50ef12ab5a95c8b1fb73deaf35d4e0d3e90be69 100644 (file)
@@ -12,6 +12,7 @@
 #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"
 #include "util/u_box.h"    
 
 enum pipe_format formats[] = {
@@ -146,7 +147,7 @@ static void draw( void )
    float clear_color[4] = {.5,.5,.5,1};
 
    ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
-   ctx->draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4);
+   util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4);
    ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
 #if 0
index d187505f8d4909030e860cc843f614d2bba07beb..152ae408eb06c49ed0596a7facc3c60404438c3a 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "util/u_debug.h"       /* debug_dump_surface_bmp() */
 #include "util/u_memory.h"      /* Offset() */
+#include "util/u_draw_quad.h"
 
 enum pipe_format formats[] = {
    PIPE_FORMAT_R8G8B8A8_UNORM,
@@ -161,7 +162,7 @@ static void draw( void )
    float clear_color[4] = {1,0,1,1};
 
    ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
-   ctx->draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
+   util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
    ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
    screen->flush_frontbuffer(screen, surf, window);
index 30e205f1434a457fafb8af40dfdfea13ffcdd9d8..8859f745fdb4f50cc97ac260f7811887cbde5ed1 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "util/u_debug.h"       /* debug_dump_surface_bmp() */
 #include "util/u_memory.h"      /* Offset() */
+#include "util/u_draw_quad.h"
 
 
 enum pipe_format formats[] = {
@@ -27,7 +28,6 @@ static const int HEIGHT = 300;
 static struct pipe_screen *screen = NULL;
 static struct pipe_context *ctx = NULL;
 static struct pipe_surface *surf = NULL;
-static struct pipe_resource *indexBuffer = NULL;
 static void *window = NULL;
 
 struct vertex {
@@ -105,6 +105,7 @@ static void set_vertices( void )
 {
    struct pipe_vertex_element ve[3];
    struct pipe_vertex_buffer vbuf[2];
+   struct pipe_index_buffer ibuf;
    void *handle;
 
    memset(ve, 0, sizeof ve);
@@ -151,11 +152,14 @@ static void set_vertices( void )
    ctx->set_vertex_buffers(ctx, 2, vbuf);
 
    /* index data */
-   indexBuffer = screen->user_buffer_create(screen,
+   ibuf.buffer = screen->user_buffer_create(screen,
                                             indices,
                                             sizeof(indices),
                                             PIPE_BIND_VERTEX_BUFFER);
+   ibuf.offset = 0;
+   ibuf.index_size = 2;
 
+   ctx->set_index_buffer(ctx, &ibuf);
 
 }
 
@@ -195,18 +199,19 @@ static void set_fragment_shader( void )
 static void draw( void )
 {
    float clear_color[4] = {1,0,1,1};
+   struct pipe_draw_info info;
 
    ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
 
+   util_draw_init_info(&info);
+   info.indexed = (draw_elements != 0);
+   info.mode = PIPE_PRIM_TRIANGLES;
+   info.start = 0;
+   info.count = 3;
    /* draw NUM_INST triangles */
-   if (draw_elements)
-      ctx->draw_elements_instanced(ctx, indexBuffer, 2,
-                                   0, /* indexBias */
-                                   PIPE_PRIM_TRIANGLES,
-                                   0, 3, /* start, count */
-                                   0, NUM_INST); /* startInst, instCount */
-   else
-      ctx->draw_arrays_instanced(ctx, PIPE_PRIM_TRIANGLES, 0, 3, 0, NUM_INST);
+   info.instance_count = NUM_INST;
+
+   ctx->draw_vbo(ctx, &info);
 
    ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
index 80377f526d6225fef20d1179e5315df645b67cae..4dbd2c062a5f6ac96050811529b80e4e6d32e9fb 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "util/u_debug.h"       /* debug_dump_surface_bmp() */
 #include "util/u_memory.h"      /* Offset() */
+#include "util/u_draw_quad.h"
 
 enum pipe_format formats[] = {
    PIPE_FORMAT_R8G8B8A8_UNORM,
@@ -134,7 +135,7 @@ static void draw( void )
    float clear_color[4] = {1,0,1,1};
 
    ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
-   ctx->draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
+   util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
    ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
 #if 0
index 7f93db42c0dc435f130b268f96970174940eefac..e1cd814bf72ae52fcd96881f2d36998f7ae67321 100644 (file)
@@ -14,6 +14,7 @@
 #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"
 #include "util/u_box.h"    
 
 static const char *filename = NULL;
@@ -226,7 +227,7 @@ static void draw( void )
    float clear_color[4] = {.1,.3,.5,0};
 
    ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
-   ctx->draw_arrays(ctx, PIPE_PRIM_POINTS, 0, Elements(vertices));
+   util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, Elements(vertices));
    ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
 
 #if 0