<div dir="ltr"><div>LGTM.<br><br></div>Reviewed-by: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br></div><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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This test verifies that glVertexArrayElementBuffer works as expected.<br>
---<br>
 tests/all.py                                       |   1 +<br>
 .../spec/arb_direct_state_access/CMakeLists.gl.txt |   1 +<br>
 .../vao-element-array-buffer.c                     | 123 +++++++++++++++++++++<br>
 3 files changed, 125 insertions(+)<br>
 create mode 100644 tests/spec/arb_direct_state_access/vao-element-array-buffer.c<br>
<br>
diff --git a/tests/all.py b/tests/all.py<br>
index 442f5b6..6b44069 100755<br>
--- a/tests/all.py<br>
+++ b/tests/all.py<br>
@@ -4285,6 +4285,7 @@ with profile.group_manager(<br>
     g(['arb_direct_state_access-vao-attrib-format'], 'vao-attrib-format')<br>
     g(['arb_direct_state_access-vao-attrib-binding'], 'vao-attrib-binding')<br>
     g(['arb_direct_state_access-vao-binding-divisor'], 'vao-binding-divisor')<br>
+    g(['arb_direct_state_access-vao-element-array-buffer'], 'vao-element-array-buffer')<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 e45da46..fe17530 100644<br>
--- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
@@ -41,4 +41,5 @@ piglit_add_executable (arb_direct_state_access-vao-attrib-enabledisable vao-attr<br>
 piglit_add_executable (arb_direct_state_access-vao-attrib-format vao-attrib-format.c dsa-utils.c)<br>
 piglit_add_executable (arb_direct_state_access-vao-attrib-binding vao-attrib-binding.c dsa-utils.c)<br>
 piglit_add_executable (arb_direct_state_access-vao-binding-divisor vao-binding-divisor.c dsa-utils.c)<br>
+piglit_add_executable (arb_direct_state_access-vao-element-array-buffer vao-element-array-buffer.c)<br>
 # vim: ft=cmake:<br>
diff --git a/tests/spec/arb_direct_state_access/vao-element-array-buffer.c b/tests/spec/arb_direct_state_access/vao-element-array-buffer.c<br>
new file mode 100644<br>
index 0000000..8e0a9e1<br>
--- /dev/null<br>
+++ b/tests/spec/arb_direct_state_access/vao-element-array-buffer.c<br>
@@ -0,0 +1,123 @@<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-element-array-buffer.c<br>
+ *<br>
+ * Verifies that glVertexArrayElementBuffer works 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>
+static bool<br>
+check_ibo_binding_(GLuint vao, GLuint expected, int line)<br>
+{<br>
+       GLuint value;<br>
+       glGetVertexArrayiv(vao, GL_ELEMENT_ARRAY_BUFFER_BINDING,<br>
+                          (GLint *) &value);<br>
+<br>
+       if (value != expected) {<br>
+               fprintf(stderr, "GL_ELEMENT_ARRAY_BUFFER_BINDING was %u, "<br>
+                               "expected %u (%s:%d)\n",<br>
+                       value, expected, __FILE__, line);<br>
+               return false;<br>
+       }<br>
+<br>
+       return true;<br>
+}<br>
+<br>
+<br>
+#define check_ibo_binding(vao, expected) \<br>
+       check_ibo_binding_(vao, expected, __LINE__)<br>
+<br>
+<br>
+void<br>
+piglit_init(int argc, char *argv[])<br>
+{<br>
+       GLuint vao, ibo;<br>
+       bool pass = true;<br>
+<br>
+       piglit_require_extension("GL_ARB_direct_state_access");<br>
+       piglit_require_extension("GL_ARB_vertex_array_object");<br>
+<br>
+       /* Create a buffer object */<br>
+       glCreateBuffers(1, &ibo);<br>
+<br>
+       /* Create a VAO and verify that no element array buffer is<br>
+        * bound by default<br>
+        */<br>
+       glCreateVertexArrays(1, &vao);<br>
+       pass = check_ibo_binding(vao, 0) && pass;<br>
+<br>
+       /* Bind the buffer object as an element array buffer and verify<br>
+        * that it was successfully bound<br>
+        */<br>
+       glVertexArrayElementBuffer(vao, ibo);<br>
+       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+       pass = check_ibo_binding(vao, ibo) && pass;<br>
+<br>
+       /* Unbind the buffer object from the VAO and verify that it was<br>
+        * successfully unbound<br>
+        */<br>
+       glVertexArrayElementBuffer(vao, 0);<br>
+       pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+       pass = check_ibo_binding(vao, 0) && pass;<br>
+<br>
+       glDeleteVertexArrays(1, &vao);<br>
+<br>
+       /* The ARB_direct_state_access spec says:<br>
+        *<br>
+        *    "An INVALID_OPERATION error is generated by<br>
+        *     VertexArrayElementBuffer if <vaobj> is not<br>
+        *     [compatibility profile: zero or] the name of an existing<br>
+        *     vertex array object."<br>
+        */<br>
+       glGenVertexArrays(1, &vao);<br>
+       glVertexArrayElementBuffer(vao, ibo);<br>
+       pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;<br>
+       glDeleteVertexArrays(1, &vao);<br>
+<br>
+       glDeleteBuffers(1, &ibo);<br>
+<br>
+       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+}<br>
+<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.4<br>
<br>
_______________________________________________<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>