diff options
author | Fredrik Höglund <[email protected]> | 2015-03-02 18:30:12 +0100 |
---|---|---|
committer | Fredrik Höglund <[email protected]> | 2015-05-08 15:31:03 +0200 |
commit | 7ccc4f3f2392fa9acbbc034e03e3693c78127f70 (patch) | |
tree | fc665e97cf4bb124477e9a4e9055d9374667021d /src/mesa/main | |
parent | c99efbd3c2d496dc7e62adf11ab56b7eb006bbc3 (diff) |
mesa: Implement VertexArrayElementBuffer
v2: Add a doxygen comment.
Reviewed-by: Laura Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/arrayobj.c | 41 | ||||
-rw-r--r-- | src/mesa/main/arrayobj.h | 2 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 1 |
3 files changed, 44 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); +} diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index 1e7436bfc55..748eaf57a3a 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -100,4 +100,6 @@ void GLAPIENTRY _mesa_CreateVertexArrays(GLsizei n, GLuint *arrays); GLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id ); +void GLAPIENTRY _mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer); + #endif /* ARRAYOBJ_H */ diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index db3ea39e74e..4195f6beaf4 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1020,6 +1020,7 @@ const struct function gl_core_functions_possible[] = { { "glCreateVertexArrays", 45, -1 }, { "glDisableVertexArrayAttrib", 45, -1 }, { "glEnableVertexArrayAttrib", 45, -1 }, + { "glVertexArrayElementBuffer", 45, -1 }, { "glCreateSamplers", 45, -1 }, { "glCreateProgramPipelines", 45, -1 }, { "glCreateQueries", 45, -1 }, |