diff options
author | Marek Olšák <[email protected]> | 2012-05-12 12:56:19 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-05-12 23:13:45 +0200 |
commit | 1a840cc5925f52079916feb2c456816a7a91d627 (patch) | |
tree | 1d44a4feeddbd623ae08a93a0c94a7ec6a98981d | |
parent | 685a28fd8a046e8dac02c2c26ab8b169de7a2a29 (diff) |
gallium/graw: stop using user_buffer_create
This is compile-tested.
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 13 | ||||
-rw-r--r-- | src/gallium/tests/graw/fs-fragcoord.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/fs-frontface.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/fs-test.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/fs-write-z.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/gs-test.c | 18 | ||||
-rw-r--r-- | src/gallium/tests/graw/occlusion-query.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/quad-sample.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/quad-tex.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/shader-leak.c | 10 | ||||
-rw-r--r-- | src/gallium/tests/graw/tex-srgb.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/tex-swizzle.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/tri-gs.c | 10 | ||||
-rw-r--r-- | src/gallium/tests/graw/tri-instanced.c | 29 | ||||
-rw-r--r-- | src/gallium/tests/graw/tri.c | 9 | ||||
-rw-r--r-- | src/gallium/tests/graw/vs-test.c | 9 |
16 files changed, 106 insertions, 73 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index b0ba585b9bf..2ec1ccfe9d3 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -376,6 +376,19 @@ pipe_buffer_write_nooverlap(struct pipe_context *pipe, 0, 0); } +static INLINE struct pipe_resource * +pipe_buffer_create_with_data(struct pipe_context *pipe, + unsigned bind, + unsigned usage, + unsigned size, + void *ptr) +{ + struct pipe_resource *res = pipe_buffer_create(pipe->screen, + bind, usage, size); + pipe_buffer_write_nooverlap(pipe, res, 0, size, ptr); + return res; +} + static INLINE void pipe_buffer_read(struct pipe_context *pipe, struct pipe_resource *buf, diff --git a/src/gallium/tests/graw/fs-fragcoord.c b/src/gallium/tests/graw/fs-fragcoord.c index 471acbb3639..893170fe597 100644 --- a/src/gallium/tests/graw/fs-fragcoord.c +++ b/src/gallium/tests/graw/fs-fragcoord.c @@ -67,10 +67,11 @@ set_vertices(void) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = info.screen->user_buffer_create(info.screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/fs-frontface.c b/src/gallium/tests/graw/fs-frontface.c index e7252551815..d46ce554069 100644 --- a/src/gallium/tests/graw/fs-frontface.c +++ b/src/gallium/tests/graw/fs-frontface.c @@ -89,10 +89,11 @@ set_vertices(void) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = info.screen->user_buffer_create(info.screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index b42a86cfc8e..1c0d514667a 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -216,10 +216,11 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = screen->user_buffer_create(screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); ctx->set_vertex_buffers(ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/fs-write-z.c b/src/gallium/tests/graw/fs-write-z.c index 186e3ec5034..3eee2b2ab4e 100644 --- a/src/gallium/tests/graw/fs-write-z.c +++ b/src/gallium/tests/graw/fs-write-z.c @@ -93,10 +93,11 @@ set_vertices(void) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = info.screen->user_buffer_create(info.screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index a471abd9a3d..52eb6007976 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -251,15 +251,17 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; if (draw_strip) { - vbuf.buffer = screen->user_buffer_create(screen, - vertices_strip, - sizeof(vertices_strip), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices_strip), + vertices_strip); } else { - vbuf.buffer = screen->user_buffer_create(screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); } ctx->set_vertex_buffers(ctx, 1, &vbuf); diff --git a/src/gallium/tests/graw/occlusion-query.c b/src/gallium/tests/graw/occlusion-query.c index 5c4bc8cf479..cfaba34285d 100644 --- a/src/gallium/tests/graw/occlusion-query.c +++ b/src/gallium/tests/graw/occlusion-query.c @@ -94,10 +94,11 @@ set_vertices(struct vertex *vertices, unsigned bytes) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = info.screen->user_buffer_create(info.screen, - vertices, - bytes, - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + bytes, + vertices); info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index 712ff515bef..4703b83db0e 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -100,10 +100,11 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = screen->user_buffer_create(screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); ctx->set_vertex_buffers(ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index 9f81ad593ae..dc3a73796e7 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -56,10 +56,11 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = info.screen->user_buffer_create(info.screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c index 103aa6d3f3a..f24490e349f 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -11,6 +11,7 @@ #include "util/u_memory.h" /* Offset() */ #include "util/u_draw_quad.h" +#include "util/u_inlines.h" static int num_iters = 100; @@ -89,10 +90,11 @@ static void set_vertices( void ) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = screen->user_buffer_create(screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); ctx->set_vertex_buffers(ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/tex-srgb.c b/src/gallium/tests/graw/tex-srgb.c index 8eaf0bd1ec7..ea07b8d692d 100644 --- a/src/gallium/tests/graw/tex-srgb.c +++ b/src/gallium/tests/graw/tex-srgb.c @@ -72,10 +72,11 @@ set_vertices(struct vertex *verts, unsigned num_verts) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = info.screen->user_buffer_create(info.screen, - verts, - num_verts *sizeof(struct vertex), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + num_verts * sizeof(struct vertex), + verts); info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/tex-swizzle.c b/src/gallium/tests/graw/tex-swizzle.c index 80a96087e78..0709447f33e 100644 --- a/src/gallium/tests/graw/tex-swizzle.c +++ b/src/gallium/tests/graw/tex-swizzle.c @@ -54,10 +54,11 @@ static void set_vertices(void) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = info.screen->user_buffer_create(info.screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 733263133ca..7406fbc8956 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -11,6 +11,7 @@ #include "util/u_memory.h" /* Offset() */ #include "util/u_draw_quad.h" +#include "util/u_inlines.h" enum pipe_format formats[] = { PIPE_FORMAT_R8G8B8A8_UNORM, @@ -90,10 +91,11 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = screen->user_buffer_create(screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); ctx->set_vertex_buffers(ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index 837381592c2..d3de15c32c0 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -13,6 +13,7 @@ #include "util/u_memory.h" /* Offset() */ #include "util/u_draw_quad.h" +#include "util/u_inlines.h" enum pipe_format formats[] = { @@ -133,27 +134,29 @@ static void set_vertices( void ) /* vertex data */ vbuf[0].stride = sizeof( struct vertex ); vbuf[0].buffer_offset = 0; - vbuf[0].buffer = screen->user_buffer_create(screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf[0].buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); /* instance data */ vbuf[1].stride = sizeof( inst_data[0] ); vbuf[1].buffer_offset = 0; - vbuf[1].buffer = screen->user_buffer_create(screen, - inst_data, - sizeof(inst_data), - PIPE_BIND_VERTEX_BUFFER); - + vbuf[1].buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(inst_data), + inst_data); ctx->set_vertex_buffers(ctx, 2, vbuf); /* index data */ - ibuf.buffer = screen->user_buffer_create(screen, - indices, - sizeof(indices), - PIPE_BIND_VERTEX_BUFFER); + ibuf.buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_INDEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(indices), + indices); ibuf.offset = 0; ibuf.index_size = 2; diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index 75fa88cae9e..f6b2aa96c9d 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -55,10 +55,11 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = info.screen->user_buffer_create(info.screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); } diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index 23b7ada98ad..ad524c46537 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -172,10 +172,11 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = screen->user_buffer_create(screen, - vertices, - sizeof(vertices), - PIPE_BIND_VERTEX_BUFFER); + vbuf.buffer = pipe_buffer_create_with_data(ctx, + PIPE_BIND_VERTEX_BUFFER, + PIPE_USAGE_STATIC, + sizeof(vertices), + vertices); ctx->set_vertex_buffers(ctx, 1, &vbuf); } |