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

Marek Olšák maraeo at gmail.com
Tue Feb 8 13:51:29 PST 2011


On Tue, Feb 8, 2011 at 10:39 PM, Keith Whitwell <keithw at vmware.com> wrote:

> 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?
>

I had in mind that width0 would be ~0, but I guess that's not nice. What
about this?

void redefine_user_buffer(
        struct pipe_context*,
        struct pipe_resource*,
        unsigned offset,
        unsigned size);

and new width0 would implicitly be offset+size;

Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110208/fbb70118/attachment.htm>


More information about the mesa-dev mailing list