gallium/tests: Fix trivial examples
authorJakob Bornecrantz <wallbraker@gmail.com>
Sat, 17 Apr 2010 19:40:36 +0000 (20:40 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Sat, 17 Apr 2010 20:13:23 +0000 (21:13 +0100)
src/gallium/tests/trivial/Makefile
src/gallium/tests/trivial/quad-tex.c
src/gallium/tests/trivial/tri.c

index c6eb7269c8230b6f6395fe20b48420c741f56d48..346e33c28e3947e9dd52aa224dd0bb43864db7f4 100644 (file)
@@ -41,4 +41,4 @@ $(OBJECTS): %.o: %.c
        $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $(PROG_DEFINES) $< -o $@
 
 $(PROGS): %: %.o
-       $(CC) $(LDFLAGS) $< $(LINKS) -lm -lpthread -o $@
+       $(CC) $(LDFLAGS) $< $(LINKS) -lm -lpthread -ldl -o $@
index 7ad157c5ac79ac0006e0276b6ecad49fd60b103f..522ff3cb42de8ec20c97b6cff26f51e3fa71901d 100644 (file)
@@ -89,9 +89,9 @@ struct program
 
        float clear_color[4];
 
-       struct pipe_buffer *vbuf;
-       struct pipe_texture *target;
-       struct pipe_texture *tex;
+       struct pipe_resource *vbuf;
+       struct pipe_resource *target;
+       struct pipe_resource *tex;
        struct pipe_sampler_view *view;
 };
 
@@ -132,13 +132,13 @@ static void init_prog(struct program *p)
                        }
                };
 
-               p->vbuf = pipe_buffer_create(p->screen, 16, PIPE_BUFFER_USAGE_VERTEX, sizeof(vertices));
-               pipe_buffer_write(p->screen, p->vbuf, 0, sizeof(vertices), vertices);
+               p->vbuf = pipe_buffer_create(p->screen, PIPE_BIND_VERTEX_BUFFER, sizeof(vertices));
+               pipe_buffer_write(p->pipe, p->vbuf, 0, sizeof(vertices), vertices);
        }
 
        /* render target texture */
        {
-               struct pipe_texture tmplt;
+               struct pipe_resource tmplt;
                memset(&tmplt, 0, sizeof(tmplt));
                tmplt.target = PIPE_TEXTURE_2D;
                tmplt.format = PIPE_FORMAT_B8G8R8A8_UNORM; /* All drivers support this */
@@ -155,8 +155,10 @@ static void init_prog(struct program *p)
        {
                uint32_t *ptr;
                struct pipe_transfer *t;
-               struct pipe_texture t_tmplt;
+               struct pipe_resource t_tmplt;
                struct pipe_sampler_view v_tmplt;
+               struct pipe_subresource sub;
+               struct pipe_box box;
 
                memset(&t_tmplt, 0, sizeof(t_tmplt));
                t_tmplt.target = PIPE_TEXTURE_2D;
@@ -169,10 +171,12 @@ static void init_prog(struct program *p)
 
                p->tex = p->screen->resource_create(p->screen, &t_tmplt);
 
-               t = p->pipe->get_tex_transfer(p->pipe, p->tex,
-                                             0, 0, 0, /* face, level, zslice */
-                                             PIPE_TRANSFER_WRITE,
-                                             0, 0, 2, 2); /* x, y, width, height */
+               memset(&sub, 0, sizeof(sub));
+               memset(&box, 0, sizeof(box));
+               box.width = 2;
+               box.height = 2;
+
+               t = p->pipe->get_transfer(p->pipe, p->tex, sub, PIPE_TRANSFER_WRITE, &box);
 
                ptr = p->pipe->transfer_map(p->pipe, t);
                ptr[0] = 0xffff0000;
@@ -181,7 +185,7 @@ static void init_prog(struct program *p)
                ptr[3] = 0xffffff00;
                p->pipe->transfer_unmap(p->pipe, t);
 
-               p->pipe->tex_transfer_destroy(p->pipe, t);
+               p->pipe->transfer_destroy(p->pipe, t);
 
                u_sampler_view_default_template(&v_tmplt, p->tex, p->tex->format);
 
@@ -216,7 +220,7 @@ static void init_prog(struct program *p)
        p->framebuffer.width = WIDTH;
        p->framebuffer.height = HEIGHT;
        p->framebuffer.nr_cbufs = 1;
-       p->framebuffer.cbufs[0] = p->screen->get_tex_surface(p->screen, p->target, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
+       p->framebuffer.cbufs[0] = p->screen->get_tex_surface(p->screen, p->target, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
 
        /* viewport, depth isn't really needed */
        {
@@ -284,9 +288,9 @@ static void close_prog(struct program *p)
 
        pipe_surface_reference(&p->framebuffer.cbufs[0], NULL);
        pipe_sampler_view_reference(&p->view, NULL);
-       pipe_texture_reference(&p->target, NULL);
-       pipe_texture_reference(&p->tex, NULL);
-       pipe_buffer_reference(&p->vbuf, NULL);
+       pipe_resource_reference(&p->target, NULL);
+       pipe_resource_reference(&p->tex, NULL);
+       pipe_resource_reference(&p->vbuf, NULL);
 
        cso_destroy_context(p->cso);
        p->pipe->destroy(p->pipe);
index 6286aefe319c45b42ff4b947b5d0d442770d35bd..48305240a4b8d920ecebff69d379121216588407 100644 (file)
@@ -86,8 +86,8 @@ struct program
 
        float clear_color[4];
 
-       struct pipe_buffer *vbuf;
-       struct pipe_texture *target;
+       struct pipe_resource *vbuf;
+       struct pipe_resource *target;
 };
 
 static void init_prog(struct program *p)
@@ -123,13 +123,13 @@ static void init_prog(struct program *p)
                        }
                };
 
-               p->vbuf = pipe_buffer_create(p->screen, 16, PIPE_BUFFER_USAGE_VERTEX, sizeof(vertices));
-               pipe_buffer_write(p->screen, p->vbuf, 0, sizeof(vertices), vertices);
+               p->vbuf = pipe_buffer_create(p->screen, PIPE_BIND_VERTEX_BUFFER, sizeof(vertices));
+               pipe_buffer_write(p->pipe, p->vbuf, 0, sizeof(vertices), vertices);
        }
 
        /* render target texture */
        {
-               struct pipe_texture tmplt;
+               struct pipe_resource tmplt;
                memset(&tmplt, 0, sizeof(tmplt));
                tmplt.target = PIPE_TEXTURE_2D;
                tmplt.format = PIPE_FORMAT_B8G8R8A8_UNORM; /* All drivers support this */
@@ -160,7 +160,7 @@ static void init_prog(struct program *p)
        p->framebuffer.width = WIDTH;
        p->framebuffer.height = HEIGHT;
        p->framebuffer.nr_cbufs = 1;
-       p->framebuffer.cbufs[0] = p->screen->get_tex_surface(p->screen, p->target, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
+       p->framebuffer.cbufs[0] = p->screen->get_tex_surface(p->screen, p->target, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
 
        /* viewport, depth isn't really needed */
        {
@@ -224,8 +224,8 @@ static void close_prog(struct program *p)
        p->pipe->delete_fs_state(p->pipe, p->fs);
 
        pipe_surface_reference(&p->framebuffer.cbufs[0], NULL);
-       pipe_texture_reference(&p->target, NULL);
-       pipe_buffer_reference(&p->vbuf, NULL);
+       pipe_resource_reference(&p->target, NULL);
+       pipe_resource_reference(&p->vbuf, NULL);
 
        cso_destroy_context(p->cso);
        p->pipe->destroy(p->pipe);