[Mesa-dev] [PATCH 1/7] mesa/vbo: Add draw_id field to struct _mesa_prim
Anuj Phogat
anuj.phogat at gmail.com
Tue Dec 15 11:19:41 PST 2015
On Tue, Dec 15, 2015 at 12:28 AM, Kristian Høgsberg Kristensen
<krh at bitplanet.net> wrote:
> The drivers will need this for passing in gl_DrawIDARB. For indirect
> multidraw calls, we get the prim array and prim[i].draw_id == i and is
> redundant. But for non-indirect calls, we get one primitive at a time
> and need the draw_id field.
> ---
> src/mesa/vbo/vbo.h | 1 +
> src/mesa/vbo/vbo_exec_array.c | 5 +++++
> 2 files changed, 6 insertions(+)
>
> diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
> index 00e843c..cef3b8c 100644
> --- a/src/mesa/vbo/vbo.h
> +++ b/src/mesa/vbo/vbo.h
> @@ -58,6 +58,7 @@ struct _mesa_prim {
> GLint basevertex;
> GLuint num_instances;
> GLuint base_instance;
> + GLuint draw_id;
>
> GLsizeiptr indirect_offset;
> };
> diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
> index e27fdd9..7ff78dc 100644
> --- a/src/mesa/vbo/vbo_exec_array.c
> +++ b/src/mesa/vbo/vbo_exec_array.c
> @@ -1,3 +1,4 @@
> +
> /**************************************************************************
> *
> * Copyright 2003 VMware, Inc.
> @@ -1341,6 +1342,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
> prim[i].indexed = 1;
> prim[i].num_instances = 1;
> prim[i].base_instance = 0;
> + prim[i].draw_id = i;
> prim[i].is_indirect = 0;
> if (basevertex != NULL)
> prim[i].basevertex = basevertex[i];
> @@ -1371,6 +1373,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
> prim[0].indexed = 1;
> prim[0].num_instances = 1;
> prim[0].base_instance = 0;
> + prim[0].draw_id = i;
> prim[0].is_indirect = 0;
> if (basevertex != NULL)
> prim[0].basevertex = basevertex[i];
> @@ -1598,6 +1601,7 @@ vbo_validated_multidrawarraysindirect(struct gl_context *ctx,
> prim[i].mode = mode;
> prim[i].indirect_offset = offset;
> prim[i].is_indirect = 1;
> + prim[i].draw_id = i;
> }
>
> check_buffers_are_unmapped(exec->array.inputs);
> @@ -1684,6 +1688,7 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx,
> prim[i].indexed = 1;
> prim[i].indirect_offset = offset;
> prim[i].is_indirect = 1;
> + prim[i].draw_id = i;
> }
>
> check_buffers_are_unmapped(exec->array.inputs);
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
More information about the mesa-dev
mailing list