[Mesa-dev] [PATCH V3 06/13] vbo: Flesh out implementation of indirect draws
Kenneth Graunke
kenneth at whitecape.org
Tue Nov 12 12:24:11 PST 2013
On 11/09/2013 01:02 AM, Chris Forbes wrote:
> Based on part of Patch 2 of Christoph Bumiller's ARB_draw_indirect series.
>
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
> src/mesa/vbo/vbo_exec_array.c | 216 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 216 insertions(+)
I think this would be a great place to introduce the indirect_offset
parameter from patch 1.
> diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
> index 4ea10ee..1c6b8b3 100644
> --- a/src/mesa/vbo/vbo_exec_array.c
> +++ b/src/mesa/vbo/vbo_exec_array.c
> @@ -1564,6 +1564,164 @@ vbo_exec_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
> vbo_draw_transform_feedback(ctx, mode, obj, stream, primcount);
> }
>
> +static void
> +vbo_validated_drawarraysindirect(struct gl_context *ctx,
> + GLenum mode, const GLvoid *indirect)
> +{
> + struct vbo_context *vbo = vbo_context(ctx);
> + struct vbo_exec_context *exec = &vbo->exec;
> + struct _mesa_prim prim[1];
> +
> + vbo_bind_arrays(ctx);
> +
> + memset(prim, 0, sizeof(prim));
> + prim[0].begin = 1;
> + prim[0].end = 1;
> + prim[0].mode = mode;
> + prim[0].indirect_offset = (GLsizeiptr)indirect;
> +
> + /* NOTE: We do NOT want to handle primitive restart here, nor perform any
> + * other checks that require knowledge of the values in the command buffer.
> + * That would deafeat the whole purpose of this function.
> + */
"defeat" (typo).
> +
> + check_buffers_are_unmapped(exec->array.inputs);
> + vbo->draw_prims(ctx, prim, 1,
> + NULL, GL_TRUE, 0, ~0,
> + NULL,
> + ctx->DrawIndirectBuffer);
> +
> + if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
> + _mesa_flush(ctx);
> +}
> +
> +static void
> +vbo_validated_multidrawarraysindirect(struct gl_context *ctx,
> + GLenum mode,
> + const GLvoid *indirect,
> + GLsizei primcount, GLsizei stride)
> +{
> + struct vbo_context *vbo = vbo_context(ctx);
> + struct vbo_exec_context *exec = &vbo->exec;
> + struct _mesa_prim *prim;
> + GLsizei i;
> + GLsizeiptr offset = (GLsizeiptr)indirect;
> +
> + if (primcount == 0)
> + return;
See, you even no-op primcount == 0 here :)
Other than the typo fix, this is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
More information about the mesa-dev
mailing list