diff options
Diffstat (limited to 'src/mesa/main/arrayobj.c')
-rw-r--r-- | src/mesa/main/arrayobj.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 42214d8d6a0..5ce33a082f8 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -644,3 +644,44 @@ _mesa_IsVertexArray( GLuint id ) return obj->EverBound; } + + +/** + * Sets the element array buffer binding of a vertex array object. + * + * This is the ARB_direct_state_access equivalent of + * glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, buffer). + */ +void GLAPIENTRY +_mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_vertex_array_object *vao; + struct gl_buffer_object *bufObj; + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + /* The GL_ARB_direct_state_access specification says: + * + * "An INVALID_OPERATION error is generated by VertexArrayElementBuffer + * if <vaobj> is not [compatibility profile: zero or] the name of an + * existing vertex array object." + */ + vao =_mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayElementBuffer"); + if (!vao) + return; + + /* The GL_ARB_direct_state_access specification says: + * + * "An INVALID_OPERATION error is generated if <buffer> is not zero or + * the name of an existing buffer object." + */ + if (buffer != 0) + bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, + "glVertexArrayElementBuffer"); + else + bufObj = ctx->Shared->NullBufferObj; + + if (bufObj) + _mesa_reference_buffer_object(ctx, &vao->IndexBufferObj, bufObj); +} |