<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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This tests behavior specific to the compatibility profile.<br>
---<br>
tests/all.py | 1 +<br>
.../spec/arb_direct_state_access/CMakeLists.gl.txt | 1 +<br>
tests/spec/arb_direct_state_access/vao-compat.c | 199 +++++++++++++++++++++<br>
3 files changed, 201 insertions(+)<br>
create mode 100644 tests/spec/arb_direct_state_access/vao-compat.c<br>
<br>
diff --git a/tests/all.py b/tests/all.py<br>
index e85763e..0dbb59d 100755<br>
--- a/tests/all.py<br>
+++ b/tests/all.py<br>
@@ -4290,6 +4290,7 @@ with profile.group_manager(<br>
g(['arb_direct_state_access-vao-vertex-buffers'], 'vao-vertex-buffers')<br>
g(['arb_direct_state_access-vao-get'], 'vao-get')<br>
g(['arb_direct_state_access-vao-core'], 'vao-core')<br>
+ g(['arb_direct_state_access-vao-compat'], 'vao-compat')<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 bc610b6..5dd4835 100644<br>
--- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt<br>
@@ -46,4 +46,5 @@ piglit_add_executable (arb_direct_state_access-vao-vertex-buffer vao-vertex-buff<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>
piglit_add_executable (arb_direct_state_access-vao-core vao-core.c dsa-utils.c)<br>
+piglit_add_executable (arb_direct_state_access-vao-compat vao-compat.c dsa-utils.c)<br>
# vim: ft=cmake:<br>
diff --git a/tests/spec/arb_direct_state_access/vao-compat.c b/tests/spec/arb_direct_state_access/vao-compat.c<br>
new file mode 100644<br>
index 0000000..92f94c1<br>
--- /dev/null<br>
+++ b/tests/spec/arb_direct_state_access/vao-compat.c<br>
@@ -0,0 +1,199 @@<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-compat.c<br>
+ *<br>
+ * Tests behavior specific to the compatibility profile.<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+#include "dsa-utils.h"<br>
+<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<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>
+ * Calls all DSA functions on the given vaobj, with valid parameters<br>
+ * and checks that expected_error is generated.<br>
+ */<br>
+static bool<br>
+test_all_functions(GLuint vaobj, GLenum expected_error)<br>
+{<br>
+ GLint value;<br>
+ GLint64 value64;<br>
+ bool pass = true;<br>
+<br>
+ glDisableVertexArrayAttrib(vaobj, 0);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ glEnableVertexArrayAttrib(vaobj, 0);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ glVertexArrayElementBuffer(vaobj, 0);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ glVertexArrayVertexBuffer(vaobj, 0, 0, 0, 0);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ glVertexArrayVertexBuffers(vaobj, 0, 1, NULL, NULL, NULL);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ glVertexArrayAttribFormat(vaobj, 0, 4, GL_FLOAT, GL_FALSE, 0);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ if (piglit_get_gl_version() >= 30) {<br>
+ glVertexArrayAttribIFormat(vaobj, 0, 4, GL_INT, 0);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+ }<br>
+<br>
+ if (piglit_is_extension_supported("GL_ARB_vertex_attrib_64bit")) {<br>
+ glVertexArrayAttribLFormat(vaobj, 0, 4, GL_DOUBLE, 0);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+ }<br>
+<br>
+ glVertexArrayAttribBinding(vaobj, 0, 4);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ if (piglit_is_extension_supported("GL_ARB_instanced_arrays")) {<br>
+ glVertexArrayBindingDivisor(vaobj, 0, 1);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+ }<br>
+<br>
+ glGetVertexArrayiv(vaobj, GL_ELEMENT_ARRAY_BUFFER_BINDING, &value);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ glGetVertexArrayIndexediv(vaobj, 0, GL_VERTEX_ATTRIB_ARRAY_ENABLED,<br>
+ &value);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ glGetVertexArrayIndexed64iv(vaobj, 0, GL_VERTEX_BINDING_OFFSET,<br>
+ &value64);<br>
+ pass = piglit_check_gl_error(expected_error) && pass;<br>
+<br>
+ return pass;<br>
+}<br>
+<br>
+<br>
+void<br>
+piglit_init(int argc, char *argv[])<br>
+{<br>
+ GLuint vao;<br>
+ GLuint buffer;<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>
+ /* vaobj must not be a non-generated name */<br></blockquote><div>Again, remove the double negative (it's confusing).<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ pass = test_all_functions(1, GL_INVALID_OPERATION) && pass;<br>
+<br>
+ /* vaobj must be an existing vertex array object */<br>
+ glGenVertexArrays(1, &vao);<br>
+ pass = test_all_functions(vao, GL_INVALID_OPERATION) && pass;<br>
+<br>
+ /* vaobj is allowed to be zero in the compatibility profile */<br>
+ pass = test_all_functions(0, GL_NO_ERROR) && pass;<br>
+<br>
+ /* Create the VAO */<br>
+ glBindVertexArray(vao);<br>
+<br>
+ /* VertexArrayElementBuffer and VertexArrayVertexBuffers<br>
+ * do not accept non-generated buffer names...<br>
+ */<br>
+ buffer = 1;<br>
+ glVertexArrayElementBuffer(vao, buffer);<br>
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;<br>
+ pass = !glIsBuffer(buffer) && pass;<br>
+<br>
+ buffer = 2;<br></blockquote><div>Remove extra space ^^^^ <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ {<br>
+ const GLuint buffers[] = { buffer };<br>
+ const GLintptr offsets[] = { 0 };<br>
+ const GLsizeiptr strides[] = { 0 };<br>
+<br>
+ glVertexArrayVertexBuffers(vao, 0, 1,<br>
+ buffers, offsets, strides);<br>
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;<br>
+ pass = !glIsBuffer(buffer) && pass;<br>
+ }<br>
+<br>
+ /* ...but VertexArrayVertexBuffer does. */<br>
+ buffer = 3;<br></blockquote><div>Remove extra space ^^^^^ <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ glVertexArrayVertexBuffer(vao, 0, buffer, 0, 0);<br>
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+ pass = check_vbo_binding(vao, 0, buffer, 0, 0) && pass;<br>
+ pass = glIsBuffer(buffer) && pass;<br>
+ glDeleteBuffers(1, &buffer);<br>
+<br>
+ /* VertexArrayElementBuffer and VertexArrayVertexBuffers do not<br>
+ * create buffer objects...<br>
+ */<br>
+ glGenBuffers(1, &buffer);<br>
+ glVertexArrayElementBuffer(vao, buffer);<br>
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;<br>
+ pass = !glIsBuffer(buffer) && pass;<br>
+ glDeleteBuffers(1, &buffer);<br>
+<br>
+ glGenBuffers(1, &buffer);<br>
+ {<br>
+ const GLuint buffers[] = { buffer };<br>
+ const GLintptr offsets[] = { 0 };<br>
+ const GLsizeiptr strides[] = { 0 };<br>
+<br>
+ glVertexArrayVertexBuffers(vao, 0, 1,<br>
+ buffers, offsets, strides);<br>
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;<br>
+ pass = !glIsBuffer(buffer) && pass;<br>
+ }<br>
+ glDeleteBuffers(1, &buffer);<br>
+<br>
+ /* ...but VertexArrayVertexBuffer does */<br>
+ glGenBuffers(1, &buffer);<br>
+ glVertexArrayVertexBuffer(vao, 0, buffer, 16, 32);<br>
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
+ pass = check_vbo_binding(vao, 0, buffer, 16, 32) && pass;<br>
+ pass = glIsBuffer(buffer) && pass;<br>
+ glDeleteBuffers(1, &buffer);<br>
+<br>
+ glDeleteVertexArrays(1, &vao);<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>With those fixed,<br><br></div><div>Reviewed-by: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>> <br></div></div><br></div></div>