From 1085c0112128e6bbb6cdc7ef3ae40e5e69499098 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fredrik=20H=C3=B6glund?= Date: Mon, 2 Mar 2015 18:56:31 +0100 Subject: [PATCH] mesa: Implement GetVertexArrayiv Reviewed-by: Laura Ekstrand --- .../glapi/gen/ARB_direct_state_access.xml | 6 ++++ src/mesa/main/arrayobj.c | 34 +++++++++++++++++++ src/mesa/main/arrayobj.h | 2 ++ src/mesa/main/tests/dispatch_sanity.cpp | 1 + 4 files changed, 43 insertions(+) diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml index 0b19166c554..019061da6be 100644 --- a/src/mapi/glapi/gen/ARB_direct_state_access.xml +++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml @@ -524,6 +524,12 @@ + + + + + + diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 5ce33a082f8..7c4004043de 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -685,3 +685,37 @@ _mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer) if (bufObj) _mesa_reference_buffer_object(ctx, &vao->IndexBufferObj, bufObj); } + + +void GLAPIENTRY +_mesa_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_vertex_array_object *vao; + + ASSERT_OUTSIDE_BEGIN_END(ctx); + + /* The GL_ARB_direct_state_access specification says: + * + * "An INVALID_OPERATION error is generated if is not + * [compatibility profile: zero or] the name of an existing + * vertex array object." + */ + vao =_mesa_lookup_vao_err(ctx, vaobj, "glGetVertexArrayiv"); + if (!vao) + return; + + /* The GL_ARB_direct_state_access specification says: + * + * "An INVALID_ENUM error is generated if is not + * ELEMENT_ARRAY_BUFFER_BINDING." + */ + if (pname != GL_ELEMENT_ARRAY_BUFFER_BINDING) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetVertexArrayiv(pname != " + "GL_ELEMENT_ARRAY_BUFFER_BINDING)"); + return; + } + + param[0] = vao->IndexBufferObj->Name; +} diff --git a/src/mesa/main/arrayobj.h b/src/mesa/main/arrayobj.h index 748eaf57a3a..6a4247f4aaa 100644 --- a/src/mesa/main/arrayobj.h +++ b/src/mesa/main/arrayobj.h @@ -102,4 +102,6 @@ GLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id ); void GLAPIENTRY _mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer); +void GLAPIENTRY _mesa_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param); + #endif /* ARRAYOBJ_H */ diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index c1e6283cd92..0d61a1e61ca 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -1028,6 +1028,7 @@ const struct function gl_core_functions_possible[] = { { "glVertexArrayAttribLFormat", 45, -1 }, { "glVertexArrayAttribBinding", 45, -1 }, { "glVertexArrayBindingDivisor", 45, -1 }, + { "glGetVertexArrayiv", 45, -1 }, { "glCreateSamplers", 45, -1 }, { "glCreateProgramPipelines", 45, -1 }, { "glCreateQueries", 45, -1 }, -- 2.30.2