summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Höglund <fredrik@kde.org>2015-03-22 13:44:30 +0100
committerFredrik Höglund <fredrik@kde.org>2015-04-03 00:51:32 +0200
commit15a081f362fe91215a80d3efa50882a1e51dd8da (patch)
tree4a2dd73b1b0c7a02fddb1509a59c952ba06e5aae
parentb45a1e7eb26368239e5b2bb4674dc58d87d8a0a9 (diff)
arb_direct_state_access: Add a core-profile test
This tests behavior specific to the core profile. v2: Fix compiler warnings. Remove a double-negative in a comment. Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
-rwxr-xr-xtests/all.py1
-rw-r--r--tests/spec/arb_direct_state_access/CMakeLists.gl.txt1
-rw-r--r--tests/spec/arb_direct_state_access/vao-core.c186
3 files changed, 188 insertions, 0 deletions
diff --git a/tests/all.py b/tests/all.py
index 3affcf9c5..e85763e3a 100755
--- a/tests/all.py
+++ b/tests/all.py
@@ -4289,6 +4289,7 @@ with profile.group_manager(
g(['arb_direct_state_access-vao-vertex-buffer'], 'vao-vertex-buffer')
g(['arb_direct_state_access-vao-vertex-buffers'], 'vao-vertex-buffers')
g(['arb_direct_state_access-vao-get'], 'vao-get')
+ g(['arb_direct_state_access-vao-core'], 'vao-core')
with profile.group_manager(
PiglitGLTest,
diff --git a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
index c855797a6..bc610b649 100644
--- a/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
+++ b/tests/spec/arb_direct_state_access/CMakeLists.gl.txt
@@ -45,4 +45,5 @@ piglit_add_executable (arb_direct_state_access-vao-element-array-buffer vao-elem
piglit_add_executable (arb_direct_state_access-vao-vertex-buffer vao-vertex-buffer.c dsa-utils.c)
piglit_add_executable (arb_direct_state_access-vao-vertex-buffers vao-vertex-buffers.c dsa-utils.c)
piglit_add_executable (arb_direct_state_access-vao-get vao-get.c)
+piglit_add_executable (arb_direct_state_access-vao-core vao-core.c dsa-utils.c)
# vim: ft=cmake:
diff --git a/tests/spec/arb_direct_state_access/vao-core.c b/tests/spec/arb_direct_state_access/vao-core.c
new file mode 100644
index 000000000..dd0b7740b
--- /dev/null
+++ b/tests/spec/arb_direct_state_access/vao-core.c
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2015 Fredrik Höglund
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * @file vao-core.c
+ *
+ * Tests behavior specific to the core profile.
+ */
+
+#include "piglit-util-gl.h"
+#include "dsa-utils.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_core_version = 31;
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+
+enum piglit_result
+piglit_display(void)
+{
+ /* unreached */
+ return PIGLIT_FAIL;
+}
+
+
+/**
+ * Calls all DSA functions on the given vao, with valid parameters,
+ * and checks that expected_error is generated.
+ */
+static bool
+test_all_functions(GLuint vao, GLenum expected_error)
+{
+ GLint value;
+ GLint64 value64;
+ bool pass = true;
+
+ glDisableVertexArrayAttrib(vao, 0);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ glEnableVertexArrayAttrib(vao, 0);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ glVertexArrayElementBuffer(vao, 0);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ glVertexArrayVertexBuffer(vao, 0, 0, 0, 0);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ glVertexArrayVertexBuffers(vao, 0, 1, NULL, NULL, NULL);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ glVertexArrayAttribFormat(vao, 0, 4, GL_FLOAT, GL_FALSE, 0);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ glVertexArrayAttribIFormat(vao, 0, 4, GL_INT, 0);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ if (piglit_is_extension_supported("GL_ARB_vertex_attrib_64bit")) {
+ glVertexArrayAttribLFormat(vao, 0, 4, GL_DOUBLE, 0);
+ pass = piglit_check_gl_error(expected_error) && pass;
+ }
+
+ glVertexArrayAttribBinding(vao, 0, 4);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ if (piglit_is_extension_supported("GL_ARB_instanced_arrays")) {
+ glVertexArrayBindingDivisor(vao, 0, 1);
+ pass = piglit_check_gl_error(expected_error) && pass;
+ }
+
+ glGetVertexArrayiv(vao, GL_ELEMENT_ARRAY_BUFFER_BINDING, &value);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ glGetVertexArrayIndexediv(vao, 0, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &value);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ glGetVertexArrayIndexed64iv(vao, 0, GL_VERTEX_BINDING_OFFSET, &value64);
+ pass = piglit_check_gl_error(expected_error) && pass;
+
+ return pass;
+}
+
+
+void
+piglit_init(int argc, char *argv[])
+{
+ GLuint vao;
+ GLuint buffer;
+ bool pass = true;
+
+ piglit_require_extension("GL_ARB_direct_state_access");
+ piglit_require_extension("GL_ARB_vertex_attrib_binding");
+
+ /* vaobj must not be zero in the core profile */
+ pass = test_all_functions(0, GL_INVALID_OPERATION) && pass;
+
+ /* vaobj must be a generated name */
+ pass = test_all_functions(1, GL_INVALID_OPERATION) && pass;
+
+ /* vaobj must be an existing vertex array object */
+ glGenVertexArrays(1, &vao);
+ pass = test_all_functions(vao, GL_INVALID_OPERATION) && pass;
+
+ /* Create the VAO */
+ glBindVertexArray(vao);
+
+ /* Non-generated buffer names are not supported */
+ buffer = 1;
+ glVertexArrayElementBuffer(vao, buffer);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+
+ buffer = 2;
+ glVertexArrayVertexBuffer(vao, 0, buffer, 0, 0);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+
+ buffer = 3;
+ {
+ const GLuint buffers[] = { buffer };
+ const GLintptr offsets[] = { 0 };
+ const GLsizei strides[] = { 0 };
+
+ glVertexArrayVertexBuffers(vao, 0, 1,
+ buffers, offsets, strides);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+ }
+
+ /* VertexArrayElementBuffer and VertexArrayVertexBuffers do not
+ * create buffer objects...
+ */
+ glGenBuffers(1, &buffer);
+ glVertexArrayElementBuffer(vao, buffer);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+ pass = !glIsBuffer(buffer) && pass;
+ glDeleteBuffers(1, &buffer);
+
+ glGenBuffers(1, &buffer);
+ {
+ const GLuint buffers[] = { buffer };
+ const GLintptr offsets[] = { 0 };
+ const GLsizei strides[] = { 0 };
+
+ glVertexArrayVertexBuffers(vao, 0, 1,
+ buffers, offsets, strides);
+ pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
+ pass = !glIsBuffer(buffer) && pass;
+ }
+ glDeleteBuffers(1, &buffer);
+
+ /* ...but VertexArrayVertexBuffer does */
+ glGenBuffers(1, &buffer);
+ glVertexArrayVertexBuffer(vao, 0, buffer, 16, 32);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+ pass = check_vbo_binding(vao, 0, buffer, 16, 32) && pass;
+ pass = glIsBuffer(buffer) && pass;
+ glDeleteBuffers(1, &buffer);
+
+ glDeleteVertexArrays(1, &vao);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+