From 479e76bc1f6edd8f988ad003b6ffe43f96870a32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 10 May 2017 19:52:46 +0200 Subject: [PATCH] gallium/tests: fix build after index buffer changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit for some reason, only scons can build these. Reviewed-by: Nicolai Hähnle --- src/gallium/tests/graw/fs-fragcoord.c | 2 +- src/gallium/tests/graw/fs-frontface.c | 2 +- src/gallium/tests/graw/fs-test.c | 2 +- src/gallium/tests/graw/fs-write-z.c | 2 +- src/gallium/tests/graw/gs-test.c | 4 ++-- src/gallium/tests/graw/occlusion-query.c | 2 +- src/gallium/tests/graw/quad-sample.c | 2 +- src/gallium/tests/graw/quad-tex.c | 2 +- src/gallium/tests/graw/shader-leak.c | 2 +- src/gallium/tests/graw/tex-srgb.c | 2 +- src/gallium/tests/graw/tex-swizzle.c | 2 +- src/gallium/tests/graw/tri-gs.c | 2 +- src/gallium/tests/graw/tri-instanced.c | 32 ++++++++++++++++---------------- src/gallium/tests/graw/tri-large.c | 2 +- src/gallium/tests/graw/tri.c | 2 +- src/gallium/tests/graw/vs-test.c | 2 +- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/gallium/tests/graw/fs-fragcoord.c b/src/gallium/tests/graw/fs-fragcoord.c index 9b85cf7..cf7642c 100644 --- a/src/gallium/tests/graw/fs-fragcoord.c +++ b/src/gallium/tests/graw/fs-fragcoord.c @@ -68,7 +68,7 @@ set_vertices(void) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/fs-frontface.c b/src/gallium/tests/graw/fs-frontface.c index a0c8a2d..32a13cb 100644 --- a/src/gallium/tests/graw/fs-frontface.c +++ b/src/gallium/tests/graw/fs-frontface.c @@ -90,7 +90,7 @@ set_vertices(void) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index e2e7ac8..d1ade1d 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -173,7 +173,7 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/fs-write-z.c b/src/gallium/tests/graw/fs-write-z.c index eabae64..12267ed 100644 --- a/src/gallium/tests/graw/fs-write-z.c +++ b/src/gallium/tests/graw/fs-write-z.c @@ -94,7 +94,7 @@ set_vertices(void) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index 46042c6..dad3298 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -235,13 +235,13 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; if (draw_strip) { - vbuf.buffer = pipe_buffer_create_with_data(ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices_strip), vertices_strip); } else { - vbuf.buffer = pipe_buffer_create_with_data(ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/occlusion-query.c b/src/gallium/tests/graw/occlusion-query.c index d03934f..444b645 100644 --- a/src/gallium/tests/graw/occlusion-query.c +++ b/src/gallium/tests/graw/occlusion-query.c @@ -94,7 +94,7 @@ set_vertices(struct vertex *vertices, unsigned bytes) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, bytes, diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index 03f51fc..7917420 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -99,7 +99,7 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c index 8a9d1b8..444f64e 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -57,7 +57,7 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c index dddb69c..fb4344c 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -89,7 +89,7 @@ static void set_vertices( void ) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/tex-srgb.c b/src/gallium/tests/graw/tex-srgb.c index 9d3af94..503350a 100644 --- a/src/gallium/tests/graw/tex-srgb.c +++ b/src/gallium/tests/graw/tex-srgb.c @@ -73,7 +73,7 @@ set_vertices(struct vertex *verts, unsigned num_verts) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, num_verts * sizeof(struct vertex), diff --git a/src/gallium/tests/graw/tex-swizzle.c b/src/gallium/tests/graw/tex-swizzle.c index bc56a95..787f324 100644 --- a/src/gallium/tests/graw/tex-swizzle.c +++ b/src/gallium/tests/graw/tex-swizzle.c @@ -55,7 +55,7 @@ static void set_vertices(void) vbuf.stride = sizeof(struct vertex); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c index 6d9e41d..2ca36ce 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -90,7 +90,7 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c index b1fa21d..6c6783c 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -104,7 +104,6 @@ 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); @@ -133,7 +132,7 @@ static void set_vertices( void ) /* vertex data */ vbuf[0].stride = sizeof( struct vertex ); vbuf[0].buffer_offset = 0; - vbuf[0].buffer = pipe_buffer_create_with_data(ctx, + vbuf[0].buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), @@ -142,25 +141,13 @@ static void set_vertices( void ) /* instance data */ vbuf[1].stride = sizeof( inst_data[0] ); vbuf[1].buffer_offset = 0; - vbuf[1].buffer = pipe_buffer_create_with_data(ctx, + vbuf[1].buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(inst_data), inst_data); ctx->set_vertex_buffers(ctx, 0, 2, vbuf); - - /* index data */ - ibuf.buffer = pipe_buffer_create_with_data(ctx, - PIPE_BIND_INDEX_BUFFER, - PIPE_USAGE_DEFAULT, - sizeof(indices), - indices); - ibuf.offset = 0; - ibuf.index_size = 2; - - ctx->set_index_buffer(ctx, &ibuf); - } static void set_vertex_shader( void ) @@ -203,16 +190,29 @@ static void draw( void ) ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0); + util_draw_init_info(&info); - info.indexed = (draw_elements != 0); + info.index_size = draw_elements ? 2 : 0; info.mode = PIPE_PRIM_TRIANGLES; info.start = 0; info.count = 3; /* draw NUM_INST triangles */ info.instance_count = NUM_INST; + /* index data */ + if (info.index_size) { + info.index.resource = + pipe_buffer_create_with_data(ctx, + PIPE_BIND_INDEX_BUFFER, + PIPE_USAGE_DEFAULT, + sizeof(indices), + indices); + } + ctx->draw_vbo(ctx, &info); + pipe_resource_reference(&info.index.resource, NULL); + ctx->flush(ctx, NULL, 0); graw_save_surface_to_file(ctx, surf, NULL); diff --git a/src/gallium/tests/graw/tri-large.c b/src/gallium/tests/graw/tri-large.c index 4ccb7c5..1ca915a 100644 --- a/src/gallium/tests/graw/tri-large.c +++ b/src/gallium/tests/graw/tri-large.c @@ -59,7 +59,7 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index 0968387..b62a2ab 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -56,7 +56,7 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(info.ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(info.ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index 14e63cd..e3b50ea 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -167,7 +167,7 @@ static void set_vertices( void ) vbuf.stride = sizeof( struct vertex ); vbuf.buffer_offset = 0; - vbuf.buffer = pipe_buffer_create_with_data(ctx, + vbuf.buffer.resource = pipe_buffer_create_with_data(ctx, PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_DEFAULT, sizeof(vertices), -- 2.7.4