[Mesa-dev] [PATCH 6/9] mesa: Add a new GetTransformFeedbackVertexCount() driver hook.
eric at anholt.net
Tue Oct 22 02:55:43 CEST 2013
Kenneth Graunke <kenneth at whitecape.org> writes:
> DrawTransformFeedback() needs to obtain the number of vertices written
> to a particular stream during the last Begin/EndTransformFeedback block.
> The new driver hook returns exactly that information.
> Gallium drivers already implement this functionality by passing the
> transform feedback object to the drawing function. I prefer to avoid
> this for two reasons:
> 1. Complexity:
> Normally, the drawing function takes an array of _mesa_prim objects,
> each of which specifies a vertex count. If tfb_vertcount != NULL,
> however, there will only be one _mesa_prim object with an invalid
> vertex count (of 1), so it needs to be ignored.
> Since the _mesa_prim pointers are const, you can't even override it to
> the proper value; you need to pass around extra "ignore that, here's
> the real count" parameters.
> The drawing function is already terribly complicated, so I don't want to
> make it even more complicated.
> 2. Primitive restart:
> vbo_draw_arrays() performs software primitive restart, splitting a draw
> call in two when necessary. vbo_draw_transform_feedback() currently
> doesn't because it has no idea how many vertices need to be drawn. The
> new driver hook gives it that information, allowing us to reuse the
> existing vbo_draw_arrays() code to do everything right.
This interface means synchronizing with the GPU, which sucks when we
have the ability to actually do DTFB in the hardware pipeline (Indirect
Parameter Enable of 3DPRIMITIVE). We could mostly use the hw pipelined
version only, as long as we had core contexts (meaning that we don't
need vertex start/count to figure out how much user vertex array data to
But, given that we have sw primitive restart on some lame hardware that
we want to support this on, we've got to have this path anyway.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 835 bytes
Desc: not available
More information about the mesa-dev