<div dir="auto">Actually, pipe_buffer_union is also used in pipe_draw_info::index, which replaces pipe_index_buffer::*buffer.<div dir="auto"><br></div><div dir="auto">Marek</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Apr 12, 2017 12:00 PM, "Marek Olšák" <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Apr 12, 2017 at 5:59 AM, Brian Paul <<a href="mailto:brianp@vmware.com">brianp@vmware.com</a>> wrote:<br>
> On 04/11/2017 02:15 PM, Marek Olšák wrote:<br>
>><br>
>> From: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
>><br>
>> New interface:<br>
>><br>
>> union pipe_buffer_binding {<br>
>> struct pipe_resource *buffer; /**< the actual buffer */<br>
>> const void *user_buffer; /**< pointer to a user buffer */<br>
>> };<br>
>><br>
>> struct pipe_vertex_buffer<br>
>> {<br>
>> uint16_t stride; /**< stride to same attrib in next vertex, in<br>
>> bytes */<br>
>> bool is_user_buffer;<br>
>> unsigned buffer_offset; /**< offset to start of data in buffer, in<br>
>> bytes */<br>
>> union pipe_buffer_binding u;<br>
>> };<br>
>> ---<br>
>> src/gallium/include/pipe/p_<wbr>state.h | 11 ++++++++---<br>
>> 1 file changed, 8 insertions(+), 3 deletions(-)<br>
>><br>
>> diff --git a/src/gallium/include/pipe/p_<wbr>state.h<br>
>> b/src/gallium/include/pipe/p_<wbr>state.h<br>
>> index ce9ca34..9576f18 100644<br>
>> --- a/src/gallium/include/pipe/p_<wbr>state.h<br>
>> +++ b/src/gallium/include/pipe/p_<wbr>state.h<br>
>> @@ -534,6 +534,11 @@ struct pipe_transfer<br>
>> };<br>
>><br>
>><br>
>> +union pipe_buffer_binding {<br>
>> + struct pipe_resource *buffer; /**< the actual buffer */<br>
>> + const void *user_buffer; /**< pointer to a user buffer */<br>
>> +};<br>
>> +<br>
>><br>
>> /**<br>
>> * A vertex buffer. Typically, all the vertex data/attributes for<br>
>> @@ -542,10 +547,10 @@ struct pipe_transfer<br>
>> */<br>
>> struct pipe_vertex_buffer<br>
>> {<br>
>> - unsigned stride; /**< stride to same attrib in next vertex, in<br>
>> bytes */<br>
>> + uint16_t stride; /**< stride to same attrib in next vertex, in<br>
>> bytes */<br>
>> + bool is_user_buffer;<br>
>> unsigned buffer_offset; /**< offset to start of data in buffer, in<br>
>> bytes */<br>
>> - struct pipe_resource *buffer; /**< the actual buffer */<br>
>> - const void *user_buffer; /**< pointer to a user buffer if buffer ==<br>
>> NULL */<br>
>> + union pipe_buffer_binding u;<br>
>> };<br>
><br>
><br>
> Why have the separate pipe_buffer_binding union at all? Do you anticipate<br>
> it being needed elsewhere in Gallium?<br>
<br>
No, I don't.<br>
<br>
><br>
> How about something like this:<br>
><br>
> struct pipe_vertex_buffer<br>
> {<br>
> uint16_t stride;<br>
> bool is_user_buffer;<br>
> ...<br>
> union {<br>
> struct pipe_resource *resource;<br>
> const void *user;<br>
> } buffer;<br>
> };<br>
><br>
> Similarly in patch 3:<br>
><br>
> struct pipe_draw_info<br>
> {<br>
> ...<br>
> union {<br>
> struct pipe_resource *resource;<br>
> const void *user;<br>
> } index;<br>
> };<br>
><br>
> If you really want the separate union type, can I suggest calling it<br>
> "pipe_buffer_union" instead? I don't know what "binding" has to do with it.<br>
<br>
OK.<br>
<br>
Marek<br>
</blockquote></div></div>