summaryrefslogtreecommitdiff
path: root/src/gallium/tests
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2020-12-26 12:01:10 -0500
committerMarge Bot <eric+marge@anholt.net>2021-01-27 23:53:34 +0000
commita51d4b10f1a056a7e8ff592c034575139d19211c (patch)
tree685ffdbb701887397d595b320d33ad0aa454e627 /src/gallium/tests
parent0aa63c31ca807e8aaa01a75d918830ac87fc070c (diff)
gallium: add take_ownership param into set_constant_buffer to eliminate atomics
We often do this: pipe->set_constant_buffer(pipe, shader, slot, &cb); pipe_resource_reference(&cb->buffer, NULL); That results in atomic increment in set_constant_buffer followed by atomic decrement after set_constant_buffer. This new interface eliminates those atomics. For the case above, this should be used instead: pipe->set_constant_buffer(pipe, shader, slot, true, &cb); cb->buffer = NULL; // if cb is not a local variable, else do nothing AMD Zen benefits from this. The perf improvement is ~3% for Viewperf13/Catia. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8298>
Diffstat (limited to 'src/gallium/tests')
-rw-r--r--src/gallium/tests/graw/fs-test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
index f0c93b18ada..2373b93b05d 100644
--- a/src/gallium/tests/graw/fs-test.c
+++ b/src/gallium/tests/graw/fs-test.c
@@ -117,7 +117,7 @@ static void init_fs_constbuf( void )
cb1.user_buffer = constants1;
ctx->set_constant_buffer(ctx,
- PIPE_SHADER_FRAGMENT, 0,
+ PIPE_SHADER_FRAGMENT, 0, false,
&cb1);
memset(&cb2, 0, sizeof cb2);
@@ -125,7 +125,7 @@ static void init_fs_constbuf( void )
cb2.user_buffer = constants2;
ctx->set_constant_buffer(ctx,
- PIPE_SHADER_FRAGMENT, 1,
+ PIPE_SHADER_FRAGMENT, 1, false,
&cb2);
}