[Mesa-dev] Gallium proposal: add a user pointer in pipe_resource

Keith Whitwell keithw at vmware.com
Tue Feb 8 13:39:50 PST 2011


On Tue, 2011-02-08 at 22:29 +0100, Marek Olšák wrote:
> 
> 
> Keith,
> 
> redefine_user_buffer() would be a good compromise and I believe the
> performance hit wouldn't be so noticable. It would also allow partial
> uploads of constants in a user buffer, which is something we'd like to
> have
> too.
> 
> Currently, st/mesa in st_draw_vbo is doing:
> - N calls to resource_destroy
> - some unnecessary computations
> - N calls to user_buffer_create
> - 1 call to set_vertex_buffers
> - 1 call to set_vertex_elements_state
> 
> If we can replace this by N calls to redefine_user_buffer, then I am
> all for
> it, provided neither _NEW_ARRAY nor _NEW_PROGRAM is dirty of course.
> 
> Can the function look, let's say, like this?
> 
> void redefine_user_buffer(struct pipe_context *, struct pipe_resource
> *,
> const struct pipe_box *);
> 

That looks good, but wouldn't you also want to be able to change the
size of the userbuffer?  I can see you might be able to implicitly grow
the buffer this way (when box->x +  box->width > resource->width0), but
that's fairly obtuse and it doesn't permit shrinking.

So perhaps as above with a "unsigned new_width0" parameter?

Keith



More information about the mesa-dev mailing list