<div class="gmail_quote">On Tue, Feb 8, 2011 at 10:39 PM, Keith Whitwell <span dir="ltr"><<a href="mailto:keithw@vmware.com" target="_blank">keithw@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>On Tue, 2011-02-08 at 22:29 +0100, Marek Olšák wrote:<br>
><br>
><br>
> Keith,<br>
><br>
> redefine_user_buffer() would be a good compromise and I believe the<br>
> performance hit wouldn't be so noticable. It would also allow partial<br>
> uploads of constants in a user buffer, which is something we'd like to<br>
> have<br>
> too.<br>
><br>
> Currently, st/mesa in st_draw_vbo is doing:<br>
> - N calls to resource_destroy<br>
> - some unnecessary computations<br>
> - N calls to user_buffer_create<br>
> - 1 call to set_vertex_buffers<br>
> - 1 call to set_vertex_elements_state<br>
><br>
> If we can replace this by N calls to redefine_user_buffer, then I am<br>
> all for<br>
> it, provided neither _NEW_ARRAY nor _NEW_PROGRAM is dirty of course.<br>
><br>
> Can the function look, let's say, like this?<br>
><br>
> void redefine_user_buffer(struct pipe_context *, struct pipe_resource<br>
> *,<br>
> const struct pipe_box *);<br>
><br>
<br>
</div>That looks good, but wouldn't you also want to be able to change the<br>
size of the userbuffer? I can see you might be able to implicitly grow<br>
the buffer this way (when box->x + box->width > resource->width0), but<br>
that's fairly obtuse and it doesn't permit shrinking.<br>
<br>
So perhaps as above with a "unsigned new_width0" parameter?<br></blockquote><div><br></div></div>I had in mind that width0 would be ~0, but I guess that's not nice. What about this?<br><br>void redefine_user_buffer(<br>
struct pipe_context*,<br> struct pipe_resource*,<br> unsigned offset,<br> unsigned size);<br><br>and new width0 would implicitly be offset+size;<br><br>Marek<br>