[Mesa-dev] [PATCH 04/10] gallium: add hw atomic buffer binding API.
Dave Airlie
airlied at gmail.com
Thu Nov 2 05:42:44 UTC 2017
From: Dave Airlie <airlied at redhat.com>
This API binds atomic buffers for all bound shaders (as per the
GL semantics).
This is needed to support cross shader hw atomic counters.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/gallium/docs/source/context.rst | 8 ++++++++
src/gallium/include/pipe/p_context.h | 16 ++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index ba7fef8..5898157 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -145,6 +145,14 @@ to the array index which is used for sampling.
* ``sampler_view_destroy`` destroys a sampler view and releases its reference
to associated texture.
+Hardware Atomic buffers
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Buffers containing hw atomics are required to support the feature
+on some drivers.
+
+Drivers that require this need to fill the ``set_hw_atomic_buffers`` method.
+
Shader Resources
^^^^^^^^^^^^^^^^
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index 4609d4d..c2153f7 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -332,6 +332,22 @@ struct pipe_context {
const struct pipe_shader_buffer *buffers);
/**
+ * Bind an array of hw atomic buffers for use by all shaders.
+ * And buffers that were previously bound to the specified range
+ * will be unbound.
+ *
+ * \param start_slot first buffer slot to bind.
+ * \param count number of consecutive buffers to bind.
+ * \param buffers array of pointers to the buffers to bind, it
+ * should contain at least \a count elements
+ * unless it's NULL, in which case no buffers will
+ * be bound.
+ */
+ void (*set_hw_atomic_buffers)(struct pipe_context *,
+ unsigned start_slot, unsigned count,
+ const struct pipe_shader_buffer *buffers);
+
+ /**
* Bind an array of images that will be used by a shader.
* Any images that were previously bound to the specified range
* will be unbound.
--
2.9.5
More information about the mesa-dev
mailing list