[Mesa-dev] [PATCH 17/22] mesa: Implement GetVertexArrayiv
Fredrik Höglund
fredrik at kde.org
Wed Mar 18 16:18:43 PDT 2015
---
src/mapi/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 5ab30f2..35857d6 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -455,5 +455,11 @@
<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>
+
</category>
</OpenGLAPI>
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index decdc51..87bc993 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -671,3 +671,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 748eaf5..6a4247f 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 b805fe6..83f8ecc 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -981,6 +981,7 @@ const struct function gl_core_functions_possible[] = {
{ "glVertexArrayAttribLFormat", 45, -1 },
{ "glVertexArrayAttribBinding", 45, -1 },
{ "glVertexArrayBindingDivisor", 45, -1 },
+ { "glGetVertexArrayiv", 45, -1 },
/* GL_EXT_polygon_offset_clamp */
{ "glPolygonOffsetClampEXT", 11, -1 },
--
1.8.5.3
More information about the mesa-dev
mailing list