[Mesa-dev] draw_stream_output seems to be broken by design

Luca Barbieri luca at luca-barbieri.com
Mon Sep 20 12:21:40 PDT 2010


>
>> 2. How do you pass to Gallium the id parameter to DrawTransformFeedback?
>
> You bind the buffer with the given id before issuing draw_stream_output.
Bind to what?
Note that the id parameter to DrawTransformFeedback is _not_ the place
to write to stream output to, but the place to take the count of
primitives to draw from.
That's because there is one count for each transform feedback object
in GL, not just a per-context one like in D3D10, and you pass the one
you want to use as the amount of primitives to draw to
DrawTransformFeedback (and if desired you use BindTransformFeedback to
choose the one to use for writing, which is unrelated).

>> 3. How do you handle pause/resume in ARB_transform_feedback2? (it must
>> _not_ reset the count)
>
> You just append to the buffer.
> You do not append to the buffer =)
OK, but how do you tell the GPU to start writing from 0 and reset the
count in some cases, and to append and not reset the count in the
others?

For instance in GL you can pause a transform feedback object, bind
some other object, then resume the first, and it must start where it
left off.
In general, the OpenGL semantics are much more complex and need a more
powerful Gallium interface than the D3D10 ones.

> The question is "how much data is in this pipe_buffer" so you hold that in the
> pipe_buffer itself.
No, the question is "how many primitives were streamed out when that
transform feedback object was bound to GL and not paused between the
last Begin and End GL calls?".
Or more precisely, how to design a Gallium interface that can express that.

> You hold the size of the buffer in the buffer and different so objects do
> whatever they want (append, rewrite,...)

As far as I can tell in OpenGL each transform feedback object has its
own count and several transform feedback objects can have the same
buffer bound, so you can't associate the primitive count to the
buffer.

Anyway, trying to implement ARB_transform_feedback2 (or, better,
ARB_transform_feedback3) will quickly show the requirements for the
Gallium interface.


More information about the mesa-dev mailing list