[Mesa-dev] [PATCH 1/3] vbo: move vbo_draw_method into vbo_context.h

Marek Olšák maraeo at gmail.com
Mon May 7 16:12:51 PDT 2012


On Mon, May 7, 2012 at 6:34 PM, Brian Paul <brianp at vmware.com> wrote:
> On 05/07/2012 09:27 AM, Marek Olšák wrote:
>> As far as the gallium side is concerned, I don't think the array
>> object can fully encapsulate vertex buffers and vertex elements. Those
>> two also depend on the vertex shader, because vertex buffer bindings
>> currently map 1:1 to vertex elements unless the vertex attribs are
>> interleaved (though that can be changed), and vertex elements always
>> map 1:1 to vertex shader inputs. Whether it's worth to break the
>> dependency between those states is questionable. I think that binding
>> 32 vertex buffers and letting vertex elements decide which buffers to
>> use would be a disaster for our CPU performance. Who knows. All in
>> all, I've got no idea how to take advantage of array objects in
>> st/mesa, because it doesn't seem to map to gallium well. Maybe you
>> guys know better.
>
>
> I mentioned the idea before and Mathias is interested in it as well.
>
> The basic idea is:
>
> 1. OpenGL's vertex array objects (gl_array_object) basically encapsulates
> the state of a bunch of glVertexPointer, glTexCoordPointer, etc. arrays.
>
> 2. In gallium we have a set of pipe_vertex_element that basically encodes
> the same state.
>
> 3. Hopefully we could avoid re-deriving the later state from the former if
> we do the encapsulation that Mathias describes.
>
> But as you said, the derived array state that we pass to draw calls also
> depends on the currently bound vertex program and its inputs.
>
> It seems to me though, that a given gl_array_object state would almost
> always be used with a vertex shader (or set of vertex shaders) that use
> precisely the enabled arrays.  So there could be a quick check if the set of
> enabled arrays matched the set of vertex shader inputs and we could quickly
> re-use the pipe_vertex_element state.

AFAIK the "Enabled" flags aren't very useful in determining the final
number of vertex elements, because if an array is not enabled, the
corresponding zero-stride "current" attrib is used instead. So the
quick check would depend solely on vertex shader inputs. If your
definition of "enabled array" is that it's just used by the vertex
shader, then sorry for stating the obvious. ;)

Marek


More information about the mesa-dev mailing list