On Wed, Mar 18, 2015 at 4:18 PM, Fredrik Höglund <fred...@kde.org> wrote:
> --- > src/mapi/glapi/gen/ARB_direct_state_access.xml | 5 ++++ > src/mesa/main/arrayobj.c | 34 > ++++++++++++++++++++++++++ > src/mesa/main/arrayobj.h | 2 ++ > src/mesa/main/tests/dispatch_sanity.cpp | 1 + > 4 files changed, 42 insertions(+) > > diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml > b/src/mapi/glapi/gen/ARB_direct_state_access.xml > index f92734d..a6ff206 100644 > --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml > +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml > @@ -396,5 +396,10 @@ > <param name="index" type="GLuint" /> > </function> > > + <function name="VertexArrayElementBuffer" offset="assign"> > + <param name="vaobj" type="GLuint" /> > + <param name="buffer" type="GLuint" /> > + </function> > + > </category> > </OpenGLAPI> > diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c > index 862bbb7..decdc51 100644 > --- a/src/mesa/main/arrayobj.c > +++ b/src/mesa/main/arrayobj.c > @@ -637,3 +637,37 @@ _mesa_IsVertexArray( GLuint id ) > > return obj->EverBound; > } > + > Since this looks like an entirely new function, it would be nice to have a comment here saying something to the effect of "This is the ARB_direct_state_access equivalent of BindBuffer(GL_ELEMENT_ARRAY_BUFFER...)." It took me a while to figure that out. > +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 1e7436b..748eaf5 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 2b7d4cb..5926061 100644 > --- a/src/mesa/main/tests/dispatch_sanity.cpp > +++ b/src/mesa/main/tests/dispatch_sanity.cpp > @@ -973,6 +973,7 @@ const struct function gl_core_functions_possible[] = { > { "glCreateVertexArrays", 45, -1 }, > { "glDisableVertexArrayAttrib", 45, -1 }, > { "glEnableVertexArrayAttrib", 45, -1 }, > + { "glVertexArrayElementBuffer", 45, -1 }, > > /* GL_EXT_polygon_offset_clamp */ > { "glPolygonOffsetClampEXT", 11, -1 }, > -- > 1.8.5.3 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev