mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 18:50:10 +01:00
mesa: Implement VertexArrayBindingDivisor
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
This commit is contained in:
parent
f2ef09d44a
commit
0a895c379e
4 changed files with 62 additions and 20 deletions
|
|
@ -518,6 +518,12 @@
|
|||
<param name="bindingindex" type="GLuint" />
|
||||
</function>
|
||||
|
||||
<function name="VertexArrayBindingDivisor" offset="assign">
|
||||
<param name="vaobj" type="GLuint" />
|
||||
<param name="bindingindex" type="GLuint" />
|
||||
<param name="divisor" type="GLuint" />
|
||||
</function>
|
||||
|
||||
<!-- Sampler object functions -->
|
||||
|
||||
<function name="CreateSamplers" offset="assign">
|
||||
|
|
|
|||
|
|
@ -1027,6 +1027,7 @@ const struct function gl_core_functions_possible[] = {
|
|||
{ "glVertexArrayAttribIFormat", 45, -1 },
|
||||
{ "glVertexArrayAttribLFormat", 45, -1 },
|
||||
{ "glVertexArrayAttribBinding", 45, -1 },
|
||||
{ "glVertexArrayBindingDivisor", 45, -1 },
|
||||
{ "glCreateSamplers", 45, -1 },
|
||||
{ "glCreateProgramPipelines", 45, -1 },
|
||||
{ "glCreateQueries", 45, -1 },
|
||||
|
|
|
|||
|
|
@ -2041,16 +2041,40 @@ _mesa_VertexArrayAttribBinding(GLuint vaobj, GLuint attribIndex, GLuint bindingI
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
vertex_array_binding_divisor(struct gl_context *ctx,
|
||||
struct gl_vertex_array_object *vao,
|
||||
GLuint bindingIndex, GLuint divisor,
|
||||
const char *func)
|
||||
{
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!ctx->Extensions.ARB_instanced_arrays) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "%s()", func);
|
||||
return;
|
||||
}
|
||||
|
||||
/* The ARB_vertex_attrib_binding spec says:
|
||||
*
|
||||
* "An INVALID_VALUE error is generated if <bindingindex> is greater
|
||||
* than or equal to the value of MAX_VERTEX_ATTRIB_BINDINGS."
|
||||
*/
|
||||
if (bindingIndex >= ctx->Const.MaxVertexAttribBindings) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"%s(bindingindex=%u > "
|
||||
"GL_MAX_VERTEX_ATTRIB_BINDINGS)",
|
||||
func, bindingIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
vertex_binding_divisor(ctx, vao, VERT_ATTRIB_GENERIC(bindingIndex), divisor);
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_VertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (!ctx->Extensions.ARB_instanced_arrays) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glVertexBindingDivisor()");
|
||||
return;
|
||||
}
|
||||
|
||||
/* The ARB_vertex_attrib_binding spec says:
|
||||
*
|
||||
|
|
@ -2064,21 +2088,30 @@ _mesa_VertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
|
|||
return;
|
||||
}
|
||||
|
||||
/* The ARB_vertex_attrib_binding spec says:
|
||||
*
|
||||
* "An INVALID_VALUE error is generated if <bindingindex> is greater
|
||||
* than or equal to the value of MAX_VERTEX_ATTRIB_BINDINGS."
|
||||
*/
|
||||
if (bindingIndex >= ctx->Const.MaxVertexAttribBindings) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glVertexBindingDivisor(bindingindex=%u > "
|
||||
"GL_MAX_VERTEX_ATTRIB_BINDINGS)",
|
||||
bindingIndex);
|
||||
return;
|
||||
}
|
||||
vertex_array_binding_divisor(ctx, ctx->Array.VAO,
|
||||
bindingIndex, divisor,
|
||||
"glVertexBindingDivisor");
|
||||
}
|
||||
|
||||
vertex_binding_divisor(ctx, ctx->Array.VAO,
|
||||
VERT_ATTRIB_GENERIC(bindingIndex), divisor);
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_VertexArrayBindingDivisor(GLuint vaobj, GLuint bindingIndex, GLuint divisor)
|
||||
{
|
||||
struct gl_vertex_array_object *vao;
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
/* The ARB_direct_state_access specification says:
|
||||
*
|
||||
* "An INVALID_OPERATION error is generated by VertexArrayBindingDivisor
|
||||
* if <vaobj> is not [compatibility profile: zero or] the name of an
|
||||
* existing vertex array object."
|
||||
*/
|
||||
vao = _mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayBindingDivisor");
|
||||
if (!vao)
|
||||
return;
|
||||
|
||||
vertex_array_binding_divisor(ctx, vao, bindingIndex, divisor,
|
||||
"glVertexArrayBindingDivisor");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -340,6 +340,8 @@ _mesa_VertexArrayAttribBinding(GLuint vaobj, GLuint attribIndex,
|
|||
extern void GLAPIENTRY
|
||||
_mesa_VertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_VertexArrayBindingDivisor(GLuint vaobj, GLuint bindingIndex, GLuint divisor);
|
||||
|
||||
extern void
|
||||
_mesa_copy_client_array(struct gl_context *ctx,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue