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>
This commit is contained in:
@@ -48,6 +48,8 @@ buffers, surfaces) are bound to the driver.
|
||||
type. index is used to indicate which buffer to set (some APIs may allow
|
||||
multiple ones to be set, and binding a specific one later, though drivers
|
||||
are mostly restricted to the first one right now).
|
||||
If take_ownership is true, the buffer reference is passed to the driver, so
|
||||
that the driver doesn't have to increment the reference count.
|
||||
|
||||
* ``set_inlinable_constants`` sets inlinable constants for constant buffer 0.
|
||||
|
||||
|
Reference in New Issue
Block a user