From 28256d3d7b488e232628ef1e913b4b53c90ba5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 28 Sep 2020 10:33:06 -0400 Subject: [PATCH] gallium/u_threaded_context: don't call memcpy in tc_set_constant_buffer In sysprof, the CPU time spend in tc_set_constant_buffer drops from 7% to 1.4% in a release build. It doesn't make sense to me. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/auxiliary/util/u_threaded_context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 9d519bd89e6..09be4a6a657 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -696,7 +696,9 @@ tc_set_constant_buffer(struct pipe_context *_pipe, } else { tc_set_resource_reference(&p->cb.buffer, cb->buffer); - memcpy(&p->cb, cb, sizeof(*cb)); + p->cb.user_buffer = NULL; + p->cb.buffer_offset = cb->buffer_offset; + p->cb.buffer_size = cb->buffer_size; } } else { memset(&p->cb, 0, sizeof(*cb));