Mesa (master): gallium/u_threaded: add a fast path for unbinding shader buffers
Marek Olšák
mareko at kemper.freedesktop.org
Thu May 18 20:15:16 UTC 2017
Module: Mesa
Branch: master
Commit: d88ca123508ae960c47c5ba1e4ce6e2d19d6a540
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d88ca123508ae960c47c5ba1e4ce6e2d19d6a540
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri May 12 21:38:12 2017 +0200
gallium/u_threaded: add a fast path for unbinding shader buffers
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/auxiliary/util/u_threaded_context.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index e33c846379..8ea7f8aa26 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -824,6 +824,7 @@ tc_set_shader_images(struct pipe_context *_pipe,
struct tc_shader_buffers {
ubyte shader, start, count;
+ bool unbind;
struct pipe_shader_buffer slot[0]; /* more will be allocated if needed */
};
@@ -833,6 +834,11 @@ tc_call_set_shader_buffers(struct pipe_context *pipe, union tc_payload *payload)
struct tc_shader_buffers *p = (struct tc_shader_buffers *)payload;
unsigned count = p->count;
+ if (p->unbind) {
+ pipe->set_shader_buffers(pipe, p->shader, p->start, p->count, NULL);
+ return;
+ }
+
pipe->set_shader_buffers(pipe, p->shader, p->start, p->count, p->slot);
for (unsigned i = 0; i < count; i++)
@@ -849,11 +855,13 @@ tc_set_shader_buffers(struct pipe_context *_pipe, unsigned shader,
struct threaded_context *tc = threaded_context(_pipe);
struct tc_shader_buffers *p =
- tc_add_slot_based_call(tc, TC_CALL_set_shader_buffers, tc_shader_buffers, count);
+ tc_add_slot_based_call(tc, TC_CALL_set_shader_buffers, tc_shader_buffers,
+ buffers ? count : 0);
p->shader = shader;
p->start = start;
p->count = count;
+ p->unbind = buffers == NULL;
if (buffers) {
for (unsigned i = 0; i < count; i++) {
@@ -871,8 +879,6 @@ tc_set_shader_buffers(struct pipe_context *_pipe, unsigned shader,
src->buffer_offset + src->buffer_size);
}
}
- } else {
- memset(p->slot, 0, count * sizeof(buffers[0]));
}
}
More information about the mesa-commit
mailing list