diff options
author | Kenneth Graunke <[email protected]> | 2013-05-27 11:27:18 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-10-31 11:04:37 -0700 |
commit | ded34f65ad6bd69a4af94945527de74761a866e6 (patch) | |
tree | dc4678ef360cad66092f00d5603b6787b923d5f3 /src/mesa/main/dd.h | |
parent | 684958d1e7415267e8276654390ea610eefaa95f (diff) |
mesa: Add a new GetTransformFeedbackVertexCount() driver hook.
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 by passing the transform feedback
object to the drawing function, counting the number of vertices written
on the GPU, and using draw indirect. This is efficient, but doesn't
always work:
If vertex data comes from user arrays, then the VBO module needs to
know how many vertices to upload, so we need to synchronously count.
Gallium drivers are currently broken in this case.
It also doesn't work if primitive restart is done in software. For
normal drawing, vbo_draw_arrays() performs software primitive restart,
splitting the draw call in two. 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.
On Intel hardware (at least Ivybridge), using the draw indirect approach
is difficult since the hardware counts primitives, rather than vertices,
which requires doing some simple math. So we always use this hook.
Gallium drivers will likely want to use this hook in some cases, but
want to use the existing draw indirect approach where possible. Hence,
I've added a flag to allow drivers to opt-in to this call.
v2: Make it possible to implement this hook but only use this path
when necessary (suggested by Marek).
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/dd.h')
-rw-r--r-- | src/mesa/main/dd.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 50119219906..d7c43271355 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -843,6 +843,14 @@ struct dd_function_table { struct gl_transform_feedback_object *obj); /** + * Return the number of vertices written to a stream during the last + * Begin/EndTransformFeedback block. + */ + GLsizei (*GetTransformFeedbackVertexCount)(struct gl_context *ctx, + struct gl_transform_feedback_object *obj, + GLuint stream); + + /** * \name GL_NV_texture_barrier interface */ void (*TextureBarrier)(struct gl_context *ctx); |