<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 31, 2015 at 10:26 AM, Fredrik Höglund <span dir="ltr"><<a href="mailto:fredrik@kde.org" target="_blank">fredrik@kde.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This test verifies that glGetVertexArrayiv,<br>
glGetVertexArrayIndexediv, and glGetVertexArrayIndexed64iv work<br>
as expected.<br>
---<br>
 tests/all.py                                       |   1 +<br>
 .../spec/arb_direct_state_access/CMakeLists.gl.txt |   1 +<br>
 tests/spec/arb_direct_state_access/vao-get.c       | 285 +++++++++++++++++++++<br>
 3 files changed, 287 insertions(+)<br>
 create mode 100644 tests/spec/arb_direct_state_access/vao-get.c<br>
<br>
diff --git a/tests/all.py b/tests/all.py<br>
index d0730d4..3affcf9 100755<br>
--- a/tests/all.py<br>
+++ b/tests/all.py<br>
@@ -4288,6 +4288,7 @@ with profile.group_manager(<br>
     g(['arb_direct_state_access-vao-element-array-buffer'], 'vao-element-array-buffer')<br>
     g(['arb_direct_state_access-vao-vertex-buffer'], 'vao-vertex-buffer')<br>
     g(['arb_direct_state_access-vao-vertex-buffers'], 'vao-vertex-buffers')<br>
+    g(['arb_direct_state_access-vao-get'], 'vao-get')<br>
<br>
 with profile.group_manager(<br>
         PiglitGLTest,<br>
diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
index 41e5c46..c855797 100644<br>
--- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
@@ -44,4 +44,5 @@ piglit_add_executable (arb_direct_state_access-vao-binding-divisor vao-binding-d<br>
 piglit_add_executable (arb_direct_state_access-vao-element-array-buffer vao-element-array-buffer.c)<br>
 piglit_add_executable (arb_direct_state_access-vao-vertex-buffer vao-vertex-buffer.c dsa-utils.c)<br>
 piglit_add_executable (arb_direct_state_access-vao-vertex-buffers vao-vertex-buffers.c dsa-utils.c)<br>
+piglit_add_executable (arb_direct_state_access-vao-get vao-get.c)<br>
 # vim: ft=cmake:<br>
diff --git a/tests/spec/arb_direct_state_access/vao-get.c b/tests/spec/arb_direct_state_access/vao-get.c<br>
new file mode 100644<br>
index 0000000..db4a89c<br>
--- /dev/null<br>
+++ b/tests/spec/arb_direct_state_access/vao-get.c<br>
@@ -0,0 +1,285 @@<br>
+/*<br>
+ * Copyright (C) 2015 Fredrik Höglund<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * on the rights to use, copy, modify, merge, publish, distribute, sub<br>
+ * license, and/or sell copies of the Software, and to permit persons to whom<br>
+ * the Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,<br>
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR<br>
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE<br>
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/**<br>
+ * @file vao-get.c<br>
+ *<br>
+ * Verifies that glGetVertexArrayiv, glGetVertexArrayIndexediv and<br>
+ * glGetVertexArrayIndexed64iv work as expected.<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+       config.supports_gl_core_version = 31;<br>
+       config.supports_gl_compat_version = 20;<br>
+<br>
+       config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+       /* unreached */<br>
+       return PIGLIT_FAIL;<br>
+}<br>
+<br>
+<br>
+/**<br>
+ * Verifies that glGetVertexArrayiv works as expected<br>
+ */<br>
+static bool<br>
+test_getvertexarrayiv(GLuint vao)<br>
+{<br>
+       bool pass = true;<br>
+       GLint param;<br>
+<br>
+       /* The ARB_direct_state_access specification says:<br>
+        *<br>
+        * "An INVALID_ENUM error is generated if <pname> is not<br>
+        *  ELEMENT_ARRAY_BUFFER_BINDING."<br>
+        */<br>
+       glGetVertexArrayiv(vao, GL_ARRAY_BUFFER_BINDING, &param);<br>
+       pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;<br>
+<br>
+       /* Verify that no error is generated when pname is<br>
+        * ELEMENT_ARRAY_BUFFER_BINDING.<br>
+        */<br>
+       glGetVertexArrayiv(vao, GL_ELEMENT_ARRAY_BUFFER_BINDING, &param);<br>
+       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+<br>
+       piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,<br>
+                                    "glGetVertexArrayiv");<br>
+       return pass;<br>
+}<br>
+<br>
+<br>
+/**<br>
+ * Verifies that glGetVertexArrayIndexediv works as expected<br>
+ */<br>
+static bool<br>
+test_getvertexarrayindexediv(GLuint vao)<br>
+{<br>
+       struct {<br>
+               GLenum pname;<br>
+               bool supported;<br>
+       } valid_pnames[] = {<br>
+               {<br>
+                       GL_VERTEX_ATTRIB_ARRAY_ENABLED,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_ATTRIB_ARRAY_SIZE,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_ATTRIB_ARRAY_STRIDE,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_ATTRIB_ARRAY_TYPE,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_ATTRIB_ARRAY_INTEGER,<br>
+                       piglit_get_gl_version() >= 30,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_ATTRIB_ARRAY_LONG,<br>
+                       piglit_is_extension_supported(<br>
+                               "GL_ARB_vertex_array_64bit"),<br>
+               },<br></blockquote><div>Have you filed a bug against the spec about the inconsistency in which params GetVertexArrayIndexediv accepts?  (If not, I can do that.) I would also leave a comment here about it, because I had initially forgotten that the following params (except relative offset) were allowed because of the spec inconsistency you found.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+               {<br>
+                       GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,<br>
+                       true,<br>
+               },<br></blockquote><div>Move relative offset up one so that it's in the order of accepted parameters in the OpenGL 4.5 spec.  Also, it would be really helpful if you left a comment here saying that you test vertex attrib array divisor below.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+               {<br>
+                       GL_VERTEX_ATTRIB_RELATIVE_OFFSET,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_ATTRIB_BINDING,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_BINDING_BUFFER,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_BINDING_STRIDE,<br>
+                       true,<br>
+               },<br>
+               {<br>
+                       GL_VERTEX_BINDING_DIVISOR,<br>
+                       piglit_is_extension_supported(<br>
+                               "GL_ARB_instanced_arrays"),<br>
+               },<br>
+       };<br>
+<br>
+       const GLenum invalid_pnames[] = {<br>
+               GL_VERTEX_ATTRIB_ARRAY_POINTER<br>
+       };<br>
+<br>
+       bool pass = true;<br>
+       GLint param;<br>
+       int i;<br>
+<br>
+       /* Verify that glGetVertexArrayIndexediv does not generate any error<br>
+        * for valid parameters. The returned values are not checked,<br>
+        * since this is covered by the other DSA tests.<br>
+        */<br>
+       for (i = 0; i < ARRAY_SIZE(valid_pnames); i++) {<br>
+               if (!valid_pnames[i].supported)<br>
+                       continue;<br>
+<br>
+               glGetVertexArrayIndexediv(vao, 0, valid_pnames[i].pname,<br>
+                                         &param);<br>
+               pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+       }<br>
+<br>
+       /* Verify that glGetVertexArrayIndexediv generates<br>
+        * GL_INVALID_ENUM for invalid parameters.<br>
+        */<br>
+       for (i = 0; i < ARRAY_SIZE(invalid_pnames); i++) {<br>
+               glGetVertexArrayIndexediv(vao, 0, invalid_pnames[i],<br>
+                                         &param);<br>
+               pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;<br>
+       }<br>
+<br>
+       /* Associate attrib #0 with bind point #10, and set the<br>
+        * divisor for that bind point to 5. Then verify that the<br>
+        * correct divisor value is returned for<br>
+        * GL_VERTEX_ATTRIB_ARRAY_DIVISOR. The reason we check this<br>
+        * return value is that the other DSA tests use<br>
+        * GL_VERTEX_BINDING_DIVISOR.<br>
+        */<br>
+       glVertexArrayAttribBinding(vao, 0, 10);<br>
+       glVertexArrayBindingDivisor(vao, 10, 5);<br>
+       glGetVertexArrayIndexediv(vao, 0,<br>
+                                 GL_VERTEX_ATTRIB_ARRAY_DIVISOR,<br>
+                                 &param);<br>
+       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+<br>
+       if (param != 5) {<br>
+               fprintf(stderr, "GL_VERTEX_ATTRIB_ARRAY_DIVISOR[0] "<br>
+                       "was %d, expected 5\n", param);<br>
+               pass = false;<br>
+       }<br>
+<br>
+       piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,<br>
+                                    "glGetVertexArrayIndexediv");<br>
+       return pass;<br>
+}<br>
+<br>
+<br>
+/**<br>
+ * Verifies that glGetVertexArrayIndexed64iv works as expected<br>
+ */<br>
+static bool<br>
+test_getvertexarrayindexed64iv(GLuint vao)<br>
+{<br>
+       /* glGetVertexArrayIndexed64iv should generate GL_INVALID_ENUM<br>
+        * for each of these parameters.<br>
+        */<br>
+       const GLenum invalid_pnames[] = {<br>
+               GL_VERTEX_ATTRIB_ARRAY_ENABLED,<br>
+               GL_VERTEX_ATTRIB_ARRAY_SIZE,<br>
+               GL_VERTEX_ATTRIB_ARRAY_STRIDE,<br>
+               GL_VERTEX_ATTRIB_ARRAY_TYPE,<br>
+               GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,<br>
+               GL_VERTEX_ATTRIB_ARRAY_INTEGER,<br>
+               GL_VERTEX_ATTRIB_ARRAY_LONG,<br>
+               GL_VERTEX_ATTRIB_ARRAY_DIVISOR,<br>
+               GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,<br>
+               GL_VERTEX_ATTRIB_ARRAY_POINTER,<br>
+               GL_VERTEX_ATTRIB_RELATIVE_OFFSET,<br>
+               GL_VERTEX_ATTRIB_BINDING,<br>
+               GL_VERTEX_BINDING_BUFFER,<br>
+               GL_VERTEX_BINDING_STRIDE,<br>
+               GL_VERTEX_BINDING_DIVISOR<br>
+       };<br>
+<br>
+       bool pass = true;<br>
+       GLint64 param;<br>
+       GLuint vbo;<br>
+       int i;<br>
+<br>
+       for (i = 0; i < ARRAY_SIZE(invalid_pnames); i++) {<br>
+               glGetVertexArrayIndexed64iv(vao, 0, invalid_pnames[i],<br>
+                                           &param);<br>
+               pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;<br>
+       }<br>
+<br>
+       /* Verify that glGetVertexArrayIndexed64iv returns the correct<br>
+        * value for GL_VERTEX_BINDING_OFFSET. This is the only valid<br>
+        * parameter for this function.<br>
+        */<br>
+       glCreateBuffers(1, &vbo);<br>
+       glVertexArrayVertexBuffer(vao, 0, vbo, 128, 0);<br>
+       glGetVertexArrayIndexed64iv(vao, 0, GL_VERTEX_BINDING_OFFSET,<br>
+                                   &param);<br>
+       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+       glDeleteBuffers(1, &vbo);<br>
+<br>
+       if (param != 128) {<br>
+               fprintf(stderr, "GL_VERTEX_BINDING_OFFSET[0] "<br>
+                       "was %lld, expected 128\n", param);<br>
+               pass = false;<br>
+       }<br>
+<br>
+       piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,<br>
+                                    "glGetVertexArrayIndexed64iv");<br>
+       return pass;<br>
+}<br>
+<br>
+<br>
+void<br>
+piglit_init(int argc, char *argv[])<br>
+{<br>
+       GLuint vao;<br>
+       bool pass = true;<br>
+<br>
+       piglit_require_extension("GL_ARB_direct_state_access");<br>
+       piglit_require_extension("GL_ARB_vertex_array_object");<br>
+       piglit_require_extension("GL_ARB_vertex_attrib_binding");<br>
+<br>
+       /* Create a VAO */<br>
+       glCreateVertexArrays(1, &vao);<br>
+<br>
+       pass = test_getvertexarrayiv(vao) && pass;<br>
+       pass = test_getvertexarrayindexediv(vao) && pass;<br>
+       pass = test_getvertexarrayindexed64iv(vao) && pass;<br>
+<br>
+       glDeleteVertexArrays(1, &vao);<br>
+<br>
+       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+}<br>
+<br>
<span class=""><font color="#888888">--<br>
2.1.4<br>
<br></font></span></blockquote><div>Other than the mess in what parameters the spec should accept, this looks okay.<br><br></div><div>Reviewed-by: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""><font color="#888888">
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>