mesa: Add EXT_instanced_arrays support

The support for ARB_instanced_arrays already exists for big GL, reuse the same
PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR for this extension.

The OES_draw_elements_base_vertex and EXT_draw_elements_base_vertex both define
the DrawElementsInstancedBaseVertex method when EXT_instanced_arrays is defined.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22167>
This commit is contained in:
Corentin Noël 2023-03-28 16:56:17 +02:00 committed by Marge Bot
parent 8aa4d37b83
commit 45a682650c
6 changed files with 20 additions and 8 deletions

View File

@ -35,7 +35,7 @@
<param name="basevertex" type="const GLint *" count="primcount"/>
</function>
<function name="DrawElementsInstancedBaseVertex" es2="3.2" marshal="custom" exec="dlist">
<function name="DrawElementsInstancedBaseVertex" es2="2.0" marshal="custom" exec="dlist">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>

View File

@ -24,5 +24,16 @@
</category>
<category name="GL_EXT_instanced_arrays" number="156">
<enum name="VERTEX_ATTRIB_ARRAY_DIVISOR_EXT" value="0x88FE"/>
<function name="VertexAttribDivisorEXT" alias="VertexAttribDivisor" es2="2.0">
<param name="index" type="GLuint"/>
<param name="divisor" type="GLuint"/>
</function>
<!-- The rest of the bits for this is already in ARB_draw_instanced.xml. -->
</category>
</OpenGLAPI>

View File

@ -1106,7 +1106,7 @@
</function>
<function name="DrawElementsInstancedBaseVertexEXT" alias="DrawElementsInstancedBaseVertex"
es2="3.0">
es2="2.0">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>
@ -1248,7 +1248,7 @@
</function>
<function name="DrawElementsInstancedBaseVertexOES" alias="DrawElementsInstancedBaseVertex"
es2="3.0">
es2="2.0">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>

View File

@ -495,7 +495,7 @@ typedef enum
OPCODE_TEXPARAMETER_I,
OPCODE_TEXPARAMETER_UI,
/* GL_ARB_instanced_arrays */
/* GL_EXT/ARB_instanced_arrays */
OPCODE_VERTEX_ATTRIB_DIVISOR,
/* GL_NV_texture_barrier */
@ -8654,7 +8654,7 @@ save_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
}
}
/* GL_ARB_instanced_arrays */
/* GL_EXT/ARB_instanced_arrays */
void GLAPIENTRY
save_VertexAttribDivisor(GLuint index, GLuint divisor)
{
@ -12462,7 +12462,7 @@ execute_list(struct gl_context *ctx, GLuint list)
break;
case OPCODE_VERTEX_ATTRIB_DIVISOR:
/* GL_ARB_instanced_arrays */
/* GL_EXT/ARB_instanced_arrays */
CALL_VertexAttribDivisor(ctx->Dispatch.Exec, (n[1].ui, n[2].ui));
break;

View File

@ -260,6 +260,7 @@ EXT(EXT_gpu_program_parameters , EXT_gpu_program_parameters
* Additionally, EXT_gpu_shader4 would reintroduce functions that were removed in GLSL 1.40. */
EXT(EXT_gpu_shader4 , EXT_gpu_shader4 , GLL, x , x , x , 2006)
EXT(EXT_gpu_shader5 , ARB_gpu_shader5 , x , x , x , 31, 2014)
EXT(EXT_instanced_arrays , ARB_instanced_arrays , x , x , x , ES2, 2012)
EXT(EXT_map_buffer_range , ARB_map_buffer_range , x , x , ES1, ES2, 2012)
EXT(EXT_memory_object , EXT_memory_object , GLL, GLC, x , ES2, 2017)
EXT(EXT_memory_object_fd , EXT_memory_object_fd , GLL, GLC, x , ES2, 2017)

View File

@ -2396,8 +2396,8 @@ get_vertex_array_attrib(struct gl_context *ctx,
}
goto error;
case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB:
if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_instanced_arrays)
|| _mesa_is_gles3(ctx)) {
if (_mesa_has_ARB_instanced_arrays(ctx) ||
_mesa_has_EXT_instanced_arrays(ctx)) {
return vao->BufferBinding[array->BufferBindingIndex].InstanceDivisor;
}
goto error;