[Mesa-dev] [PATCH] Expose support for OES/EXT_draw_elements_base_vertex to OpenGL ES
Ilia Mirkin
imirkin at alum.mit.edu
Sun Nov 1 17:00:17 PST 2015
On Fri, Oct 30, 2015 at 3:57 PM, Ryan Houdek <sonicadvance1 at gmail.com> wrote:
> ---
> src/mapi/glapi/gen/es_EXT.xml | 88 +++++++++++++++++++++++++++++++++++++++++++
> src/mesa/main/extensions.c | 2 +
> src/mesa/vbo/vbo_exec_array.c | 19 ++++++++--
> 3 files changed, 105 insertions(+), 4 deletions(-)
>
> diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
> index cfca5a9..1bc82d3 100644
> --- a/src/mapi/glapi/gen/es_EXT.xml
> +++ b/src/mapi/glapi/gen/es_EXT.xml
> @@ -817,4 +817,92 @@
> </function>
> </category>
>
> +<category name="GL_EXT_draw_elements_base_vertex" number="204">
> +
> + <function name="DrawElementsBaseVertexEXT" alias="DrawElementsBaseVertex"
> + exec="dynamic">
> + <param name="mode" type="GLenum"/>
> + <param name="count" type="GLsizei"/>
> + <param name="type" type="GLenum"/>
> + <param name="indices" type="const GLvoid *"/>
> + <param name="basevertex" type="GLint"/>
> + </function>
> +
> + <function name="DrawRangeElementsBaseVertexEXT" alias="DrawRangeElementsBaseVertex"
> + exec="dynamic">
> + <param name="mode" type="GLenum"/>
> + <param name="start" type="GLuint"/>
> + <param name="end" type="GLuint"/>
> + <param name="count" type="GLsizei"/>
> + <param name="type" type="GLenum"/>
> + <param name="indices" type="const GLvoid *"/>
> + <param name="basevertex" type="GLint"/>
> + </function>
> +
> + <function name="MultiDrawElementsBaseVertexEXT" alias="MultiDrawElementsBaseVertex"
> + exec="dynamic">
> + <param name="mode" type="GLenum"/>
> + <param name="count" type="const GLsizei *"/>
> + <param name="type" type="GLenum"/>
> + <param name="indices" type="const GLvoid * const *"/>
> + <param name="primcount" type="GLsizei"/>
> + <param name="basevertex" type="const GLint *"/>
> + </function>
> +
> + <function name="DrawElementsInstancedBaseVertexEXT" alias="DrawElementsInstancedBaseVertex"
> + exec="dynamic">
> + <param name="mode" type="GLenum"/>
> + <param name="count" type="GLsizei"/>
> + <param name="type" type="GLenum"/>
> + <param name="indices" type="const GLvoid *"/>
> + <param name="primcount" type="GLsizei"/>
> + <param name="basevertex" type="GLint"/>
> + </function>
> +
> +</category>
> +
> +<category name="GL_OES_draw_elements_base_vertex" number="219">
> +
> + <function name="DrawElementsBaseVertexOES" alias="DrawElementsBaseVertex"
> + exec="dynamic">
> + <param name="mode" type="GLenum"/>
> + <param name="count" type="GLsizei"/>
> + <param name="type" type="GLenum"/>
> + <param name="indices" type="const GLvoid *"/>
> + <param name="basevertex" type="GLint"/>
> + </function>
> +
> + <function name="DrawRangeElementsBaseVertexOES" alias="DrawRangeElementsBaseVertex"
> + exec="dynamic">
> + <param name="mode" type="GLenum"/>
> + <param name="start" type="GLuint"/>
> + <param name="end" type="GLuint"/>
> + <param name="count" type="GLsizei"/>
> + <param name="type" type="GLenum"/>
> + <param name="indices" type="const GLvoid *"/>
> + <param name="basevertex" type="GLint"/>
> + </function>
> +
> + <function name="MultiDrawElementsBaseVertexOES" alias="MultiDrawElementsBaseVertex"
> + exec="dynamic">
> + <param name="mode" type="GLenum"/>
> + <param name="count" type="const GLsizei *"/>
> + <param name="type" type="GLenum"/>
> + <param name="indices" type="const GLvoid * const *"/>
> + <param name="primcount" type="GLsizei"/>
> + <param name="basevertex" type="const GLint *"/>
> + </function>
> +
> + <function name="DrawElementsInstancedBaseVertexOES" alias="DrawElementsInstancedBaseVertex"
> + exec="dynamic">
> + <param name="mode" type="GLenum"/>
> + <param name="count" type="GLsizei"/>
> + <param name="type" type="GLenum"/>
> + <param name="indices" type="const GLvoid *"/>
> + <param name="primcount" type="GLsizei"/>
> + <param name="basevertex" type="GLint"/>
> + </function>
> +
> +</category>
Please confirm that "make check" doesn't start failing in
dispatch_tests. I don't think it will due to the fact that you use
alias, but... good to check.
> +
> </OpenGLAPI>
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index b2c88c3..e968104 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -229,6 +229,7 @@ static const struct extension extension_table[] = {
> { "GL_EXT_depth_bounds_test", o(EXT_depth_bounds_test), GL, 2002 },
> { "GL_EXT_draw_buffers", o(dummy_true), ES2, 2012 },
> { "GL_EXT_draw_buffers2", o(EXT_draw_buffers2), GL, 2006 },
> + { "GL_EXT_draw_elements_base_vertex", o(ARB_draw_elements_base_vertex), ES2, 2014 },
> { "GL_EXT_draw_instanced", o(ARB_draw_instanced), GL, 2006 },
> { "GL_EXT_draw_range_elements", o(dummy_true), GLL, 1997 },
> { "GL_EXT_fog_coord", o(dummy_true), GLL, 1999 },
> @@ -305,6 +306,7 @@ static const struct extension extension_table[] = {
> { "GL_OES_depth32", o(dummy_false), DISABLE, 2005 },
> { "GL_OES_depth_texture", o(ARB_depth_texture), ES2, 2006 },
> { "GL_OES_depth_texture_cube_map", o(OES_depth_texture_cube_map), ES2, 2012 },
> + { "GL_OES_draw_elements_base_vertex", o(ARB_draw_elements_base_vertex), ES2, 2014 },
> { "GL_OES_draw_texture", o(OES_draw_texture), ES1, 2004 },
> { "GL_OES_EGL_sync", o(dummy_true), ES1 | ES2, 2010 },
> /* FIXME: Mesa expects GL_OES_EGL_image to be available in OpenGL contexts. */
> diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
> index 34d2c1d..620d350 100644
> --- a/src/mesa/vbo/vbo_exec_array.c
> +++ b/src/mesa/vbo/vbo_exec_array.c
> @@ -1807,13 +1807,24 @@ vbo_initialize_exec_dispatch(const struct gl_context *ctx,
> SET_EvalMesh2(exec, vbo_exec_EvalMesh2);
> }
>
> + if (_mesa_is_desktop_gl(ctx) ||
> + (_mesa_is_gles(ctx) && ctx->Extensions.ARB_draw_elements_base_vertex)) {
Actually that'll catch GLES 1 contexts too; the ext says it requires
GLES 2.0. You want ctx->API == API_OPENGLES2 (which covers GLES3/3.1
as well)
> + SET_DrawElementsBaseVertex(exec, vbo_exec_DrawElementsBaseVertex);
> +
> + if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
> + SET_DrawRangeElementsBaseVertex(exec, vbo_exec_DrawRangeElementsBaseVertex);
> + SET_DrawElementsInstancedBaseVertex(exec, vbo_exec_DrawElementsInstancedBaseVertex);
> + }
> +
> + if (_mesa_is_desktop_gl(ctx) ||
> + (_mesa_is_gles(ctx) && ctx->Extensions.ARB_draw_indirect)) {
> + SET_MultiDrawElementsBaseVertex(exec, vbo_exec_MultiDrawElementsBaseVertex);
What does this have to do with indirect? The ext talks about
EXT_multi_draw_arrays, which is always enabled in mesa.
> + }
> + }
> +
> if (_mesa_is_desktop_gl(ctx)) {
> - SET_DrawElementsBaseVertex(exec, vbo_exec_DrawElementsBaseVertex);
> - SET_DrawRangeElementsBaseVertex(exec, vbo_exec_DrawRangeElementsBaseVertex);
> - SET_MultiDrawElementsBaseVertex(exec, vbo_exec_MultiDrawElementsBaseVertex);
> SET_DrawArraysInstancedBaseInstance(exec, vbo_exec_DrawArraysInstancedBaseInstance);
> SET_DrawElementsInstancedBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseInstance);
> - SET_DrawElementsInstancedBaseVertex(exec, vbo_exec_DrawElementsInstancedBaseVertex);
> SET_DrawElementsInstancedBaseVertexBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseVertexBaseInstance);
> }
>
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list