<div dir="ltr"><div>Hi,<br></div>I am having difficulty in understanding why you implemented pipe_surface in st_atom_atomicbuf.c.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 17, 2014 at 2:24 AM, Aditya Avinash <span dir="ltr"><<a href="mailto:adityaavinash1@gmail.com" target="_blank">adityaavinash1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><span class=""><br>On Sunday, November 16, 2014, Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The direction I went in was by adapting the shader resources interface<br>
for this. I believe it will be possible to use for<br>
shader_image_load_store as well.<br></blockquote><div><br></div></span>I asked some questions on mailing list about the implementation. I took the same path as uniform buffers. But, I realized that it's not efficient to do that.</div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
See <a href="https://github.com/imirkin/mesa/commits/atomic" target="_blank">https://github.com/imirkin/mesa/commits/atomic</a><br>
<br></blockquote><div><br></div><div>The commits are similar to my previous patch. I was doing atomics similar to uniform buffers, Now I was changing cso_context<span></span>. </div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I believe that makes a lot more sense than creating a special counter<br>
buffer type only to be used for this. pipe_surface has the requisite<br>
offset/etc options.</blockquote><div><br></div></span><div>I thought of using uniform buffer data structure with certain flags which differentiate between atomics, uniforms, index. Like a generic buffer.</div><div><div class="h5"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I feel like I've mentioned this before when you asked questions, but<br>
I'd highly recommend taking my work and improving on it (or at least<br>
understanding it). It's at the point where a driver can implement the<br>
backend logic, although some of the mesa/st bits are going to be<br>
subject to discussion (and need fixing, it messes up the DCE tgsi<br>
pass, so I just disabled it).<br>
<br>
On Thu, Nov 13, 2014 at 12:18 AM, adityaatluri <<a>adityaavinash1@gmail.com</a>> wrote:<br>
> ---<br>
>  src/gallium/include/pipe/p_context.h |  5 +++++<br>
>  src/gallium/include/pipe/p_defines.h |  7 ++++++-<br>
>  src/gallium/include/pipe/p_state.h   | 10 ++++++++++<br>
>  3 files changed, 21 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h<br>
> index af5674f..bf3be31 100644<br>
> --- a/src/gallium/include/pipe/p_context.h<br>
> +++ b/src/gallium/include/pipe/p_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_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>
>     void (*set_framebuffer_state)( struct pipe_context *,<br>
>                                    const struct pipe_framebuffer_state * );<br>
><br>
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h<br>
> index 8c4e415..717ab6a 100644<br>
> --- a/src/gallium/include/pipe/p_defines.h<br>
> +++ b/src/gallium/include/pipe/p_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_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_OFFSET_ALIGNMENT = 113,<br>
>  };<br>
><br>
>  #define PIPE_QUIRK_TEXTURE_BORDER_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_SUPPORTED,<br>
>     PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS,<br>
> -   PIPE_SHADER_CAP_DOUBLES<br>
> +   PIPE_SHADER_CAP_DOUBLES,<br>
> +   PIPE_SHADER_CAP_MAX_COUNTER_BUFFER_SIZE,<br>
> +   PIPE_SHADER_CAP_MAX_COUNTER_BUFFERS<br>
>  };<br>
><br>
>  /**<br>
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h<br>
> index 43bc48b..49fae5d 100644<br>
> --- a/src/gallium/include/pipe/p_state.h<br>
> +++ b/src/gallium/include/pipe/p_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>
> 1.9.1<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a>mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div></div><span class="HOEnZb"><font color="#888888"><br><br>-- <br><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><br>
</font></span></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>