summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Höglund <[email protected]>2015-03-02 18:56:31 +0100
committerFredrik Höglund <[email protected]>2015-05-08 15:31:03 +0200
commit1085c0112128e6bbb6cdc7ef3ae40e5e69499098 (patch)
tree4159ca981e9f3110f88980467064ca7d896f350c
parent0a895c379e649b64efd5c0978fb6252dabf9d285 (diff)
mesa: Implement GetVertexArrayiv
Reviewed-by: Laura Ekstrand <[email protected]>
-rw-r--r--src/mapi/glapi/gen/ARB_direct_state_access.xml6
-rw-r--r--src/mesa/main/arrayobj.c34
-rw-r--r--src/mesa/main/arrayobj.h2
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp1
4 files changed, 43 insertions, 0 deletions
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 @@
<param name="divisor" type="GLuint" />
</function>
+ <function name="GetVertexArrayiv" offset="assign">
+ <param name="vaobj" type="GLuint" />
+ <param name="pname" type="GLenum" />
+ <param name="param" type="GLint *" />
+ </function>
+
<!-- Sampler object functions -->
<function name="CreateSamplers" offset="assign">
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 <vaobj> 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 <pname> 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 },