<div dir="ltr"><div><div>Hi,<br></div>I lost this mail in the mail box.<br><br>I am sorry about patch related to pipe. My work is based on Ilia Mirkin pipe commits. As per my previous mail, you can ignore pipe patch.<br></div>My current work is related to R600 backend.<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 6, 2015 at 8:54 AM, Jose Fonseca <span dir="ltr"><<a href="mailto:jfonseca@vmware.com" target="_blank">jfonseca@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Do we really need a new pipe_context::set_counter_<u></u>buffer method? Shouldn't this case be covered by pipe_context::set_shader_<u></u>resources ?<br>
<br>
If we really need new method, I'd like we have better names for them, so we can clearly distinguish them.<br></blockquote><div><br></div><div>I wanted to know whether this is exactly the way or it should be redone.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
IIUC GL_ARB_shader_atomic_counters correctly, this roughly matches D3D11s "unordered access views" [1], though D3D11's UAVs can by typed [2], or raw [3].<br>
<br>
Also, are counter buffers in user memory really supported?  I can't spot any mention of that in GL_ARB_shader_atomic_counters.<br>
<br>
I think that rather than mimicking pipe_constant_buffer, this feature should more closely to sampler views.<br>
<br></blockquote><div><br></div><div>I'll check it.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I confess I'm not familiar with counter buffers / UAVs, but I think this needs a bit more thought to avoid being completely redone in the medium term.<br>
<br>
<br>
Jose<br>
<br>
<br>
[1] <a href="http://msdn.microsoft.com/en-gb/library/windows/desktop/ff476335.aspx#Unordered_Access" target="_blank">http://msdn.microsoft.com/en-<u></u>gb/library/windows/desktop/<u></u>ff476335.aspx#Unordered_Access</a><br>
[2] <a href="http://msdn.microsoft.com/en-gb/library/windows/desktop/ff476258.aspx" target="_blank">http://msdn.microsoft.com/en-<u></u>gb/library/windows/desktop/<u></u>ff476258.aspx</a><br>
[3] <a href="http://msdn.microsoft.com/en-gb/library/windows/desktop/ff476900.aspx#Raw_Buffer_Views" target="_blank">http://msdn.microsoft.com/en-<u></u>gb/library/windows/desktop/<u></u>ff476900.aspx#Raw_Buffer_Views</a><div class="HOEnZb"><div class="h5"><br>
<br>
On 04/01/15 21:44, adityaatluri wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
  src/gallium/include/pipe/p_<u></u>context.h |  5 +++++<br>
  src/gallium/include/pipe/p_<u></u>defines.h |  7 ++++++-<br>
  src/gallium/include/pipe/p_<u></u>state.h   | 10 ++++++++++<br>
  3 files changed, 21 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/gallium/include/pipe/p_<u></u>context.h b/src/gallium/include/pipe/p_<u></u>context.h<br>
index af5674f..bf3be31 100644<br>
--- a/src/gallium/include/pipe/p_<u></u>context.h<br>
+++ b/src/gallium/include/pipe/p_<u></u>context.h<br>
@@ -44,6 +44,7 @@ struct pipe_blit_info;<br>
  struct pipe_box;<br>
  struct pipe_clip_state;<br>
  struct pipe_constant_buffer;<br>
+struct pipe_counter_buffer;<br>
  struct pipe_depth_stencil_alpha_<u></u>state;<br>
  struct pipe_draw_info;<br>
  struct pipe_fence_handle;<br>
@@ -201,6 +202,10 @@ struct pipe_context {<br>
                                  uint shader, uint index,<br>
                                  struct pipe_constant_buffer *buf );<br>
<br>
+   void (*set_counter_buffer)( struct pipe_context *,<br>
+                               uint shader, uint index,<br>
+                               struct pipe_counter_buffer *buf );<br>
+<br>
</blockquote>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
     void (*set_framebuffer_state)( struct pipe_context *,<br>
                                    const struct pipe_framebuffer_state * );<br>
<br>
diff --git a/src/gallium/include/pipe/p_<u></u>defines.h b/src/gallium/include/pipe/p_<u></u>defines.h<br>
index 8c4e415..717ab6a 100644<br>
--- a/src/gallium/include/pipe/p_<u></u>defines.h<br>
+++ b/src/gallium/include/pipe/p_<u></u>defines.h<br>
@@ -341,6 +341,7 @@ enum pipe_flush_flags {<br>
  #define PIPE_BIND_VERTEX_BUFFER        (1 << 4) /* set_vertex_buffers */<br>
  #define PIPE_BIND_INDEX_BUFFER         (1 << 5) /* draw_elements */<br>
  #define PIPE_BIND_CONSTANT_BUFFER      (1 << 6) /* set_constant_buffer */<br>
+#define PIPE_BIND_COUNTER_BUFFER       (1 << 7) /* set_counter_buffer */<br>
  #define PIPE_BIND_DISPLAY_TARGET       (1 << 8) /* flush_front_buffer */<br>
  #define PIPE_BIND_TRANSFER_WRITE       (1 << 9) /* transfer_map */<br>
  #define PIPE_BIND_TRANSFER_READ        (1 << 10) /* transfer_map */<br>
@@ -572,6 +573,8 @@ enum pipe_cap {<br>
     PIPE_CAP_MAX_VERTEX_ATTRIB_<u></u>STRIDE = 109,<br>
     PIPE_CAP_SAMPLER_VIEW_TARGET = 110,<br>
     PIPE_CAP_CLIP_HALFZ = 111,<br>
+   PIPE_CAP_USER_COUNTER_BUFFERS = 112,<br>
+   PIPE_CAP_COUNTER_BUFFER_<u></u>OFFSET_ALIGNMENT = 113,<br>
  };<br>
<br>
  #define PIPE_QUIRK_TEXTURE_BORDER_<u></u>COLOR_SWIZZLE_NV50 (1 << 0)<br>
@@ -631,7 +634,9 @@ enum pipe_shader_cap<br>
     PIPE_SHADER_CAP_PREFERRED_IR,<br>
     PIPE_SHADER_CAP_TGSI_SQRT_<u></u>SUPPORTED,<br>
     PIPE_SHADER_CAP_MAX_SAMPLER_<u></u>VIEWS,<br>
-   PIPE_SHADER_CAP_DOUBLES<br>
+   PIPE_SHADER_CAP_DOUBLES,<br>
+   PIPE_SHADER_CAP_MAX_COUNTER_<u></u>BUFFER_SIZE,<br>
+   PIPE_SHADER_CAP_MAX_COUNTER_<u></u>BUFFERS<br>
  };<br>
<br>
  /**<br>
diff --git a/src/gallium/include/pipe/p_<u></u>state.h b/src/gallium/include/pipe/p_<u></u>state.h<br>
index 43bc48b..49fae5d 100644<br>
--- a/src/gallium/include/pipe/p_<u></u>state.h<br>
+++ b/src/gallium/include/pipe/p_<u></u>state.h<br>
@@ -57,6 +57,7 @@ extern "C" {<br>
  #define PIPE_MAX_CLIP_PLANES       8<br>
  #define PIPE_MAX_COLOR_BUFS        8<br>
  #define PIPE_MAX_CONSTANT_BUFFERS 32<br>
+#define PIPE_MAX_COUNTER_BUFFERS  32<br>
  #define PIPE_MAX_SAMPLERS         16<br>
  #define PIPE_MAX_SHADER_INPUTS    32<br>
  #define PIPE_MAX_SHADER_OUTPUTS   48 /* 32 GENERICs + POS, PSIZE, FOG, etc. */<br>
@@ -462,6 +463,15 @@ struct pipe_constant_buffer {<br>
     const void *user_buffer;  /**< pointer to a user buffer if buffer == NULL */<br>
  };<br>
<br>
+/**<br>
+ * A Counter buffer. A new buffer is set everytime a variable with<br>
+ * atomic_uint is defined.<br>
+ */<br>
+struct pipe_counter_buffer{<br>
+   struct pipe_resource *buffer; /**< The actual buffer */<br>
+   unsigned buffer_offset; /**< The offset to start of data in buffer in bytes */<br>
+   const void *user_buffer; /**< The buffer which is created by the compiler */<br>
+};<br>
<br>
  /**<br>
   * A stream output target. The structure specifies the range vertices can<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div><font style="font-family:trebuchet ms,sans-serif">Regards,<br></font></div><font style="font-family:trebuchet ms,sans-serif"><b style="background-color:rgb(255,255,255);color:rgb(0,0,153)">Aditya Atluri,<br></b></font></div><div><font style="font-family:trebuchet ms,sans-serif"><b style="background-color:rgb(255,255,255);color:rgb(0,0,153)">USA.<br></b></font></div><font style="font-family:trebuchet ms,sans-serif"><b style="background-color:rgb(255,255,255);color:rgb(0,0,153)"></b><span style="background-color:rgb(255,255,255);color:rgb(0,0,153)"></span></font><br></div></div>
</div></div>