[Mesa-dev] [PATCH] gallium/tests: fix build after index buffer changes
Marek Olšák
maraeo at gmail.com
Wed May 10 17:54:26 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
for some reason, only scons can build these.
---
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
@@ -61,21 +61,21 @@ set_vertices(void)
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void
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
@@ -83,21 +83,21 @@ set_vertices(void)
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void
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
@@ -166,21 +166,21 @@ static void set_vertices( void )
ve[2].src_offset = Offset(struct vertex, texcoord);
ve[2].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = ctx->create_vertex_elements_state(ctx, 3, ve);
ctx->bind_vertex_elements_state(ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
ctx->set_vertex_buffers(ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
{
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
@@ -87,21 +87,21 @@ set_vertices(void)
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void
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
@@ -228,27 +228,27 @@ static void set_vertices( void )
ve[3].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = ctx->create_vertex_elements_state(ctx, 4, ve);
ctx->bind_vertex_elements_state(ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
}
ctx->set_vertex_buffers(ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
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
@@ -87,21 +87,21 @@ set_vertices(struct vertex *vertices, unsigned bytes)
ve[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
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,
vertices);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void
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
@@ -92,21 +92,21 @@ static void set_vertices( void )
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = ctx->create_vertex_elements_state(ctx, 2, ve);
ctx->bind_vertex_elements_state(ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
ctx->set_vertex_buffers(ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
{
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
@@ -50,21 +50,21 @@ static void set_vertices( void )
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
{
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
@@ -82,21 +82,21 @@ static void set_vertices( void )
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = ctx->create_vertex_elements_state(ctx, 2, ve);
ctx->bind_vertex_elements_state(ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
ctx->set_vertex_buffers(ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
{
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
@@ -66,21 +66,21 @@ set_vertices(struct vertex *verts, unsigned num_verts)
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
verts);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
{
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
@@ -48,21 +48,21 @@ static void set_vertices(void)
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void set_vertex_shader(void)
{
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
@@ -83,21 +83,21 @@ static void set_vertices( void )
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = ctx->create_vertex_elements_state(ctx, 2, ve);
ctx->bind_vertex_elements_state(ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
ctx->set_vertex_buffers(ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
{
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
@@ -97,21 +97,20 @@ static void set_viewport( float x, float y,
vp.translate[2] = half_depth + z;
ctx->set_viewport_states( ctx, 0, 1, &vp );
}
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);
/* pos */
ve[0].src_offset = Offset(struct vertex, position);
ve[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
ve[0].vertex_buffer_index = 0;
/* color */
@@ -126,48 +125,36 @@ static void set_vertices( void )
ve[2].instance_divisor = 1;
handle = ctx->create_vertex_elements_state(ctx, 3, ve);
ctx->bind_vertex_elements_state(ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
/* 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),
vertices);
/* 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 )
{
void *handle;
const char *text =
"VERT\n"
"DCL IN[0]\n"
"DCL IN[1]\n"
"DCL IN[2]\n"
@@ -196,30 +183,43 @@ static void set_fragment_shader( void )
}
static void draw( void )
{
union pipe_color_union clear_color = { {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.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);
screen->flush_frontbuffer(screen, tex, 0, 0, window, NULL);
}
static void init( void )
{
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
@@ -52,21 +52,21 @@ static void set_vertices( void )
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
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
@@ -49,21 +49,21 @@ static void set_vertices( void )
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
handle = info.ctx->create_vertex_elements_state(info.ctx, 2, ve);
info.ctx->bind_vertex_elements_state(info.ctx, handle);
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
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
@@ -160,21 +160,21 @@ static void set_vertices( void )
vertices[i].color[0] = .5;
vertices[i].color[1] = (float)x / (float)MESH_SZ;
vertices[i].color[2] = (float)y / (float)MESH_SZ;
}
}
memset(&vbuf, 0, sizeof vbuf);
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),
vertices);
ctx->set_vertex_buffers(ctx, 0, 1, &vbuf);
}
static void set_vertex_shader( void )
{
--
2.7.4
More information about the mesa-dev
mailing list