[Mesa-dev] [PATCH V3 02/13] glapi: add plumbing for GL_ARB_draw_indirect and GL_ARB_multi_draw_indirect

Ian Romanick idr at freedesktop.org
Tue Nov 19 11:27:29 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>

I assume 'make check' actually passes? :)

With the change below,

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>.

> ---
>  src/mapi/glapi/gen/ARB_draw_indirect.xml | 45 ++++++++++++++++++++++++++++++++
>  src/mapi/glapi/gen/Makefile.am           |  1 +
>  src/mapi/glapi/gen/gl_API.xml            |  4 ++-
>  src/mesa/main/tests/dispatch_sanity.cpp  |  8 +++---
>  src/mesa/vbo/vbo_exec_array.c            | 32 +++++++++++++++++++++++
>  5 files changed, 85 insertions(+), 5 deletions(-)
>  create mode 100644 src/mapi/glapi/gen/ARB_draw_indirect.xml
> 
> diff --git a/src/mapi/glapi/gen/ARB_draw_indirect.xml b/src/mapi/glapi/gen/ARB_draw_indirect.xml
> new file mode 100644
> index 0000000..7de03cd
> --- /dev/null
> +++ b/src/mapi/glapi/gen/ARB_draw_indirect.xml
> @@ -0,0 +1,45 @@
> +<?xml version="1.0"?>
> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
> +
> +<OpenGLAPI>
> +
> +<category name="GL_ARB_draw_indirect" number="87">
> +
> +    <enum name="DRAW_INDIRECT_BUFFER"                   value="0x8F3F"/>
> +    <enum name="DRAW_INDIRECT_BUFFER_BINDING"           value="0x8F43"/>
> +
> +    <function name="DrawArraysIndirect" offset="assign" exec="dynamic">
> +        <param name="mode" type="GLenum"/>
> +        <param name="indirect" type="const GLvoid *"/>
> +    </function>
> +
> +    <function name="DrawElementsIndirect" offset="assign" exec="dynamic">
> +        <param name="mode" type="GLenum"/>
> +        <param name="type" type="GLenum"/>
> +        <param name="indirect" type="const GLvoid *"/>
> +    </function>
> +
> +</category>
> +
> +
> +<category name="GL_ARB_multi_draw_indirect" number="133">
> +
> +    <function name="MultiDrawArraysIndirect" offset="assign" exec="dynamic">
> +        <param name="mode" type="GLenum"/>
> +        <param name="indirect" type="const GLvoid *"/>
> +        <param name="primcount" type="GLsizei"/>
> +        <param name="stride" type="GLsizei"/>
> +    </function>
> +
> +    <function name="MultiDrawElementsIndirect" offset="assign" exec="dynamic">
> +        <param name="mode" type="GLenum"/>
> +        <param name="type" type="GLenum"/>
> +        <param name="indirect" type="const GLvoid *"/>
> +        <param name="primcount" type="GLsizei"/>
> +        <param name="stride" type="GLsizei"/>
> +    </function>
> +
> +</category>
> +
> +
> +</OpenGLAPI>
> diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
> index 476d943..7af769a 100644
> --- a/src/mapi/glapi/gen/Makefile.am
> +++ b/src/mapi/glapi/gen/Makefile.am
> @@ -98,6 +98,7 @@ API_XML = \
>  	ARB_draw_buffers.xml \
>  	ARB_draw_buffers_blend.xml \
>  	ARB_draw_elements_base_vertex.xml \
> +	ARB_draw_indirect.xml \
>  	ARB_draw_instanced.xml \
>  	ARB_ES2_compatibility.xml \
>  	ARB_ES3_compatibility.xml \
> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
> index a2d914a..5c877aa 100644
> --- a/src/mapi/glapi/gen/gl_API.xml
> +++ b/src/mapi/glapi/gen/gl_API.xml
> @@ -8241,6 +8241,8 @@
>  
>  <!-- ARB extensions #86...#93 -->
>  
> +<xi:include href="ARB_draw_indirect.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
> +
>  <category name="GL_ARB_transform_feedback3" number="94">
>    <enum name="MAX_TRANSFORM_FEEDBACK_BUFFERS" value="0x8E70"/>
>    <enum name="MAX_VERTEX_STREAMS"             value="0x8E71"/>
> @@ -8470,7 +8472,7 @@
>  
>  <xi:include href="ARB_invalidate_subdata.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
>  
> -<!-- ARB extensions #133...#138 -->
> +<!-- ARB extensions #134...#138 -->
>  
>  <xi:include href="ARB_texture_buffer_range.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
>  
> diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
> index 922f0ac..e57fb52 100644
> --- a/src/mesa/main/tests/dispatch_sanity.cpp
> +++ b/src/mesa/main/tests/dispatch_sanity.cpp
> @@ -667,8 +667,8 @@ const struct function gl_core_functions_possible[] = {
>     { "glVertexAttribP3uiv", 43, -1 },
>     { "glVertexAttribP4ui", 43, -1 },
>     { "glVertexAttribP4uiv", 43, -1 },
> -// { "glDrawArraysIndirect", 43, -1 },                  // XXX: Add to xml
> -// { "glDrawElementsIndirect", 43, -1 },                // XXX: Add to xml
> +   { "glDrawArraysIndirect", 43, -1 },
> +   { "glDrawElementsIndirect", 43, -1 },
>  // { "glUniform1d", 43, -1 },                           // XXX: Add to xml
>  // { "glUniform2d", 43, -1 },                           // XXX: Add to xml
>  // { "glUniform3d", 43, -1 },                           // XXX: Add to xml
> @@ -877,8 +877,8 @@ const struct function gl_core_functions_possible[] = {
>     { "glInvalidateBufferData", 43, -1 },
>     { "glInvalidateFramebuffer", 43, -1 },
>     { "glInvalidateSubFramebuffer", 43, -1 },
> -// { "glMultiDrawArraysIndirect", 43, -1 },             // XXX: Add to xml
> -// { "glMultiDrawElementsIndirect", 43, -1 },           // XXX: Add to xml
> +   { "glMultiDrawArraysIndirect", 43, -1 },
> +   { "glMultiDrawElementsIndirect", 43, -1 },
>  // { "glGetProgramInterfaceiv", 43, -1 },               // XXX: Add to xml
>  // { "glGetProgramResourceIndex", 43, -1 },             // XXX: Add to xml
>  // { "glGetProgramResourceName", 43, -1 },              // XXX: Add to xml
> diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
> index a2c0c7d..4ea10ee 100644
> --- a/src/mesa/vbo/vbo_exec_array.c
> +++ b/src/mesa/vbo/vbo_exec_array.c
> @@ -1564,6 +1564,34 @@ vbo_exec_DrawTransformFeedbackStreamInstanced(GLenum mode, GLuint name,
>     vbo_draw_transform_feedback(ctx, mode, obj, stream, primcount);
>  }
>  
> +/**
> + * Like [Multi]DrawArrays/Elements, but they take most arguments from
> + * a buffer object.
> + */
> +static void GLAPIENTRY
> +vbo_exec_DrawArraysIndirect(GLenum mode, const GLvoid *indirect)
> +{
> +}
> +
> +static void GLAPIENTRY
> +vbo_exec_DrawElementsIndirect(GLenum mode, GLenum type,
> +                              const GLvoid *indirect)
> +{
> +}
> +
> +static void GLAPIENTRY
> +vbo_exec_MultiDrawArraysIndirect(GLenum mode,
> +                                 const GLvoid *indirect,
> +                                 GLsizei primcount, GLsizei stride)
> +{
> +}
> +
> +static void GLAPIENTRY
> +vbo_exec_MultiDrawElementsIndirect(GLenum mode, GLenum type,
> +                                   const GLvoid *indirect,
> +                                   GLsizei primcount, GLsizei stride)
> +{
> +}
>  
>  /**
>   * Initialize the dispatch table with the VBO functions for drawing.
> @@ -1595,6 +1623,10 @@ vbo_initialize_exec_dispatch(const struct gl_context *ctx,
>        SET_DrawElementsInstancedBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseInstance);
>        SET_DrawElementsInstancedBaseVertex(exec, vbo_exec_DrawElementsInstancedBaseVertex);
>        SET_DrawElementsInstancedBaseVertexBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseVertexBaseInstance);
> +      SET_DrawArraysIndirect(exec, vbo_exec_DrawArraysIndirect);
> +      SET_DrawElementsIndirect(exec, vbo_exec_DrawElementsIndirect);
> +      SET_MultiDrawArraysIndirect(exec, vbo_exec_MultiDrawArraysIndirect);
> +      SET_MultiDrawElementsIndirect(exec, vbo_exec_MultiDrawElementsIndirect);

We should only set these dispatch pointers if it's core profile because
the next patch only allows the extensions for core.

>     }
>  
>     if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
> 



More information about the mesa-dev mailing list