mesa: Implement VertexArrayAttribBinding
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
This commit is contained in:
@@ -512,6 +512,12 @@
|
||||
<param name="relativeoffset" type="GLuint" />
|
||||
</function>
|
||||
|
||||
<function name="VertexArrayAttribBinding" offset="assign">
|
||||
<param name="vaobj" type="GLuint" />
|
||||
<param name="attribindex" type="GLuint" />
|
||||
<param name="bindingindex" type="GLuint" />
|
||||
</function>
|
||||
|
||||
<!-- Sampler object functions -->
|
||||
|
||||
<function name="CreateSamplers" offset="assign">
|
||||
|
||||
@@ -1026,6 +1026,7 @@ const struct function gl_core_functions_possible[] = {
|
||||
{ "glVertexArrayAttribFormat", 45, -1 },
|
||||
{ "glVertexArrayAttribIFormat", 45, -1 },
|
||||
{ "glVertexArrayAttribLFormat", 45, -1 },
|
||||
{ "glVertexArrayAttribBinding", 45, -1 },
|
||||
{ "glCreateSamplers", 45, -1 },
|
||||
{ "glCreateProgramPipelines", 45, -1 },
|
||||
{ "glCreateQueries", 45, -1 },
|
||||
|
||||
+59
-26
@@ -1957,11 +1957,49 @@ _mesa_VertexArrayAttribLFormat(GLuint vaobj, GLuint attribIndex,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
vertex_array_attrib_binding(struct gl_context *ctx,
|
||||
struct gl_vertex_array_object *vao,
|
||||
GLuint attribIndex, GLuint bindingIndex,
|
||||
const char *func)
|
||||
{
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
/* The ARB_vertex_attrib_binding spec says:
|
||||
*
|
||||
* "<attribindex> must be less than the value of MAX_VERTEX_ATTRIBS and
|
||||
* <bindingindex> must be less than the value of
|
||||
* MAX_VERTEX_ATTRIB_BINDINGS, otherwise the error INVALID_VALUE
|
||||
* is generated."
|
||||
*/
|
||||
if (attribIndex >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"%s(attribindex=%u >= "
|
||||
"GL_MAX_VERTEX_ATTRIBS)",
|
||||
func, attribIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bindingIndex >= ctx->Const.MaxVertexAttribBindings) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"%s(bindingindex=%u >= "
|
||||
"GL_MAX_VERTEX_ATTRIB_BINDINGS)",
|
||||
func, bindingIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(VERT_ATTRIB_GENERIC(attribIndex) < ARRAY_SIZE(vao->VertexAttrib));
|
||||
|
||||
vertex_attrib_binding(ctx, vao,
|
||||
VERT_ATTRIB_GENERIC(attribIndex),
|
||||
VERT_ATTRIB_GENERIC(bindingIndex));
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
/* The ARB_vertex_attrib_binding spec says:
|
||||
*
|
||||
@@ -1975,35 +2013,30 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
|
||||
return;
|
||||
}
|
||||
|
||||
/* The ARB_vertex_attrib_binding spec says:
|
||||
vertex_array_attrib_binding(ctx, ctx->Array.VAO,
|
||||
attribIndex, bindingIndex,
|
||||
"glVertexAttribBinding");
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_VertexArrayAttribBinding(GLuint vaobj, GLuint attribIndex, GLuint bindingIndex)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct gl_vertex_array_object *vao;
|
||||
|
||||
/* The ARB_direct_state_access specification says:
|
||||
*
|
||||
* "<attribindex> must be less than the value of MAX_VERTEX_ATTRIBS and
|
||||
* <bindingindex> must be less than the value of
|
||||
* MAX_VERTEX_ATTRIB_BINDINGS, otherwise the error INVALID_VALUE
|
||||
* is generated."
|
||||
* "An INVALID_OPERATION error is generated by VertexArrayAttribBinding
|
||||
* if <vaobj> is not [compatibility profile: zero or] the name of an
|
||||
* existing vertex array object."
|
||||
*/
|
||||
if (attribIndex >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glVertexAttribBinding(attribindex=%u >= "
|
||||
"GL_MAX_VERTEX_ATTRIBS)",
|
||||
attribIndex);
|
||||
vao = _mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayAttribBinding");
|
||||
if (!vao)
|
||||
return;
|
||||
}
|
||||
|
||||
if (bindingIndex >= ctx->Const.MaxVertexAttribBindings) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glVertexAttribBinding(bindingindex=%u >= "
|
||||
"GL_MAX_VERTEX_ATTRIB_BINDINGS)",
|
||||
bindingIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(VERT_ATTRIB_GENERIC(attribIndex) <
|
||||
ARRAY_SIZE(ctx->Array.VAO->VertexAttrib));
|
||||
|
||||
vertex_attrib_binding(ctx, ctx->Array.VAO,
|
||||
VERT_ATTRIB_GENERIC(attribIndex),
|
||||
VERT_ATTRIB_GENERIC(bindingIndex));
|
||||
vertex_array_attrib_binding(ctx, vao, attribIndex, bindingIndex,
|
||||
"glVertexArrayAttribBinding");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -333,6 +333,10 @@ _mesa_VertexArrayAttribLFormat(GLuint vaobj, GLuint attribIndex,
|
||||
extern void GLAPIENTRY
|
||||
_mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_VertexArrayAttribBinding(GLuint vaobj, GLuint attribIndex,
|
||||
GLuint bindingIndex);
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_VertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user