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

Luca Barbieri luca at luca-barbieri.com
Sun Sep 19 10:44:33 PDT 2010

The current version of draw_stream_output in softpipe seems to attempt
to draw using the currently bound stream output buffer as input.

This does not match D3D10/11's DrawAuto, which instead draws with the
current vertex buffer (and requires having only one bound), but using
the primitive count from the latest stream output draw call.
MSDN says:
<<After data has been streamed out to stream-output stage buffers,
those buffers can be again bound to the Input Assembler stage at input
slot 0 and DrawAuto will draw them [...] >>

It also doesn't match DrawTransformFeedback, which draws according to
the transform feedback object provided as a parameter.

In addition to that, the softpipe approach seems obviously wrong
because it makes it impossible to both draw the last stream output
buffer and also capture new stream output to another buffer (which is
common in the DirectX examples, flipping between two buffers).

I think a candidate for a Gallium design would be to add the stream
output "CSO" as a parameter to draw_stream_output.
If it is passed as NULL, then it draws according to the last draw with
stream output on the context (according to D3D10) and if not NULL
according to the draw with stream output with that specific CSO bound
(according to ARB_transform_feedback2).
Furthermore a flag in the CSO to enable/disable CSO-specific SO count
recording might allow some driver optimization in the D3D10 case.

More information about the mesa-dev mailing list