mesa: Implement GetVertexArrayiv
authorFredrik Höglund <fredrik@kde.org>
Mon, 2 Mar 2015 17:56:31 +0000 (18:56 +0100)
committerFredrik Höglund <fredrik@kde.org>
Fri, 8 May 2015 13:31:03 +0000 (15:31 +0200)
Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
src/mapi/glapi/gen/ARB_direct_state_access.xml
src/mesa/main/arrayobj.c
src/mesa/main/arrayobj.h
src/mesa/main/tests/dispatch_sanity.cpp

index 0b19166c55406761ab19c017e49d8d859ec270cf..019061da6beefc4c489dc3f9319e545442465c5c 100644 (file)
       <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">
index 5ce33a082f84cf1947ffe27ff81e044cd7e15b30..7c4004043de55be5fda1a0d73c7d551d3543ed1c 100644 (file)
@@ -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;
+}
index 748eaf57a3af87ee2717da2f94bb1a8105c0f5cb..6a4247f4aaaf37af07f0974d42b64b788f650bd2 100644 (file)
@@ -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 */
index c1e6283cd92b2a73789edfc4c0fa9f1e7796777b..0d61a1e61ca4f1095cb46dd598969d094fa82c72 100644 (file)
@@ -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 },