gallium: add hw atomic buffer binding API.
authorDave Airlie <airlied@redhat.com>
Wed, 1 Nov 2017 04:17:49 +0000 (14:17 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 9 Nov 2017 22:39:35 +0000 (08:39 +1000)
This API binds atomic buffers for all bound shaders (as per the
GL semantics).

This is needed to support cross shader hw atomic counters.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-By: Gert Wollny <gw.fossdev@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/docs/source/context.rst
src/gallium/include/pipe/p_context.h

index 8aee21b2ed480a656dc526f4e5982a1aa184bcdd..9d069b37d7e8319dc645ca02e3299d416caa66d8 100644 (file)
@@ -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
 ^^^^^^^^^^^^^^^^
 
index 0dd4ad12424f219b593bd17d06f89fa75cb8488a..b74e6492196ad74025acbc51064da3cf82bb9c6f 100644 (file)
@@ -331,6 +331,22 @@ struct pipe_context {
                               unsigned start_slot, unsigned count,
                               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