From e73bf3b805de78299f1a652668ba4e6eab9bac94 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 29 Mar 2012 17:51:50 +0200 Subject: gallium: add start_slot parameter to set_vertex_buffers This allows updating only a subrange of buffer bindings. set_vertex_buffers(pipe, start_slot, count, NULL) unbinds buffers in that range. Binding NULL resources unbinds buffers too (both buffer and user_buffer must be NULL). The meta ops are adapted to only save, change, and restore the single slot they use. The cso_context can save and restore only one vertex buffer slot. The clients can query which one it is using cso_get_aux_vertex_buffer_slot. It's currently set to 0. (the Draw module breaks if it's set to non-zero) It should decrease the CPU overhead when using a lot of meta ops, but the drivers must be able to treat each vertex buffer slot as a separate state (only r600g does so at the moment). I can imagine this also being useful for optimizing some OpenGL use cases. Reviewed-by: Brian Paul --- 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 | 2 +- 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 | 2 +- src/gallium/tests/graw/tri.c | 2 +- src/gallium/tests/graw/vs-test.c | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/gallium/tests') diff --git a/src/gallium/tests/graw/fs-fragcoord.c b/src/gallium/tests/graw/fs-fragcoord.c index eac9627e860..fc4e6b6d4e7 100644 --- a/src/gallium/tests/graw/fs-fragcoord.c +++ b/src/gallium/tests/graw/fs-fragcoord.c @@ -74,7 +74,7 @@ set_vertices(void) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); } diff --git a/src/gallium/tests/graw/fs-frontface.c b/src/gallium/tests/graw/fs-frontface.c index 5f9d8d2d910..b9598f562bb 100644 --- a/src/gallium/tests/graw/fs-frontface.c +++ b/src/gallium/tests/graw/fs-frontface.c @@ -96,7 +96,7 @@ set_vertices(void) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); } diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c index 51be87478f7..9cde75cff25 100644 --- a/src/gallium/tests/graw/fs-test.c +++ b/src/gallium/tests/graw/fs-test.c @@ -181,7 +181,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 1, &vbuf); + 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 0bcecd7436a..a196cbbe54a 100644 --- a/src/gallium/tests/graw/fs-write-z.c +++ b/src/gallium/tests/graw/fs-write-z.c @@ -100,7 +100,7 @@ set_vertices(void) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); } diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c index e9b0829e6ce..c43f54595bf 100644 --- a/src/gallium/tests/graw/gs-test.c +++ b/src/gallium/tests/graw/gs-test.c @@ -266,7 +266,7 @@ static void set_vertices( void ) vertices); } - ctx->set_vertex_buffers(ctx, 1, &vbuf); + 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 a4f13cbdae4..d522bce038c 100644 --- a/src/gallium/tests/graw/occlusion-query.c +++ b/src/gallium/tests/graw/occlusion-query.c @@ -100,7 +100,7 @@ set_vertices(struct vertex *vertices, unsigned bytes) bytes, vertices); - info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); } diff --git a/src/gallium/tests/graw/quad-sample.c b/src/gallium/tests/graw/quad-sample.c index ca6fe3ec9f2..ab5f299f3e3 100644 --- a/src/gallium/tests/graw/quad-sample.c +++ b/src/gallium/tests/graw/quad-sample.c @@ -107,7 +107,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 1, &vbuf); + 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 02d78ad1fa8..7eb9104a574 100644 --- a/src/gallium/tests/graw/quad-tex.c +++ b/src/gallium/tests/graw/quad-tex.c @@ -63,7 +63,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); + 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 6100af3192c..be93771f577 100644 --- a/src/gallium/tests/graw/shader-leak.c +++ b/src/gallium/tests/graw/shader-leak.c @@ -97,7 +97,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 1, &vbuf); + 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 af3e1c36f15..5442f94f722 100644 --- a/src/gallium/tests/graw/tex-srgb.c +++ b/src/gallium/tests/graw/tex-srgb.c @@ -79,7 +79,7 @@ set_vertices(struct vertex *verts, unsigned num_verts) num_verts * sizeof(struct vertex), verts); - info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); + 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 7dc35eb43a3..7807b0b80a2 100644 --- a/src/gallium/tests/graw/tex-swizzle.c +++ b/src/gallium/tests/graw/tex-swizzle.c @@ -61,7 +61,7 @@ static void set_vertices(void) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); + 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 be1f0352029..573bc8a83f4 100644 --- a/src/gallium/tests/graw/tri-gs.c +++ b/src/gallium/tests/graw/tri-gs.c @@ -98,7 +98,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 1, &vbuf); + 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 ce81c9c0217..4e3a80b61dd 100644 --- a/src/gallium/tests/graw/tri-instanced.c +++ b/src/gallium/tests/graw/tri-instanced.c @@ -150,7 +150,7 @@ static void set_vertices( void ) sizeof(inst_data), inst_data); - ctx->set_vertex_buffers(ctx, 2, vbuf); + ctx->set_vertex_buffers(ctx, 0, 2, vbuf); /* index data */ ibuf.buffer = pipe_buffer_create_with_data(ctx, diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c index 7b6507eab11..71dd51afd87 100644 --- a/src/gallium/tests/graw/tri.c +++ b/src/gallium/tests/graw/tri.c @@ -62,7 +62,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - info.ctx->set_vertex_buffers(info.ctx, 1, &vbuf); + info.ctx->set_vertex_buffers(info.ctx, 0, 1, &vbuf); } diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c index 7fb97d84948..0677f04f28f 100644 --- a/src/gallium/tests/graw/vs-test.c +++ b/src/gallium/tests/graw/vs-test.c @@ -180,7 +180,7 @@ static void set_vertices( void ) sizeof(vertices), vertices); - ctx->set_vertex_buffers(ctx, 1, &vbuf); + ctx->set_vertex_buffers(ctx, 0, 1, &vbuf); } static void set_vertex_shader( void ) -- cgit v1.2.3