[Piglit] [PATCH 3/4] arb_vertex_attrib_64bit: add MAX_VERTEX_ATTRIB test

Andres Gomez agomez at igalia.com
Tue May 17 23:31:56 UTC 2016


From: Alejandro Piñeiro <apinheiro at igalia.com>

This test extend the already existing glsl-max-vertex-attrib test, by
testing the new functions added by the ARB_vertex_attrib_64
specification.

One alternative option would be to directly extend that test. Having
said so, this kind of isolated subtests for the new functionality
defined on a specification is really common.

Contributed by Andres Gomez.
---
 tests/all.py                                       |   1 +
 .../execution/CMakeLists.gl.txt                    |   1 +
 .../execution/max-vertex-attrib.c                  | 123 +++++++++++++++++++++
 3 files changed, 125 insertions(+)
 create mode 100644 tests/spec/arb_vertex_attrib_64bit/execution/max-vertex-attrib.c

diff --git a/tests/all.py b/tests/all.py
index 53d3bf3..aa88b1b 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4675,6 +4675,7 @@ with profile.group_manager(
     g(['arb_vertex_attrib_64bit-double_attribs'], 'double_attribs')
     g(['arb_vertex_attrib_64bit-check-explicit-location'], 'check-explicit-location')
     g(['arb_vertex_attrib_64bit-getactiveattrib'], 'getactiveattrib')
+    g(['arb_vertex_attrib_64bit-max-vertex-attrib'], 'max-vertex-attrib')
 
 with profile.group_manager(
         PiglitGLTest,
diff --git a/tests/spec/arb_vertex_attrib_64bit/execution/CMakeLists.gl.txt b/tests/spec/arb_vertex_attrib_64bit/execution/CMakeLists.gl.txt
index 9b19668..114ee3c 100644
--- a/tests/spec/arb_vertex_attrib_64bit/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_vertex_attrib_64bit/execution/CMakeLists.gl.txt
@@ -11,3 +11,4 @@ link_libraries (
 piglit_add_executable (arb_vertex_attrib_64bit-double_attribs double_attribs.c)
 piglit_add_executable (arb_vertex_attrib_64bit-check-explicit-location check-explicit-location.c)
 piglit_add_executable (arb_vertex_attrib_64bit-getactiveattrib  getactiveattrib.c)
+piglit_add_executable (arb_vertex_attrib_64bit-max-vertex-attrib max-vertex-attrib.c)
diff --git a/tests/spec/arb_vertex_attrib_64bit/execution/max-vertex-attrib.c b/tests/spec/arb_vertex_attrib_64bit/execution/max-vertex-attrib.c
new file mode 100644
index 0000000..8da8238
--- /dev/null
+++ b/tests/spec/arb_vertex_attrib_64bit/execution/max-vertex-attrib.c
@@ -0,0 +1,123 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * 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
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * 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 NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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 max-vertex-attrib.c
+ *
+ * Test setting vertex attrib value of GL_MAX_VERTEX_ATTRIBS attrib
+ * for the New Procedures and Functions defined by the
+ * GL_ARB_vertex_attrib_64bit extension.
+ *
+ * Note that this test is based on glsl-max-vertex-attrib.c which is
+ * already testing the already previously existing vertex attrib
+ * methods.
+ *
+ * Queries the value for GL_MAX_VERTEX_ATTRIBS and uses that as index
+ * to set a value. GL specification states that GL_INVALID_VALUE
+ * should occur if index >= GL_MAX_VERTEX_ATTRIBS.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+	config.supports_gl_compat_version = 32;
+	config.supports_gl_core_version = 32;
+
+	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+PIGLIT_GL_TEST_CONFIG_END
+
+static int test = 0;
+
+#define CHECK_GL_INVALID_VALUE \
+	if (glGetError() != GL_INVALID_VALUE) return PIGLIT_FAIL; \
+	else printf("max-vertex-attrib test %d passed\n", ++test);
+
+enum piglit_result
+piglit_display(void)
+{
+	return PIGLIT_FAIL;
+}
+
+static GLboolean
+run_test(void)
+{
+	GLdouble doublev[] = { 1.0, 1.0, 1.0, 1.0 };
+	GLdouble quad[] = { -1.0, 1.0, 1.0, 1.0, -1.0, -1.0, 1.0, -1.0 };
+
+	int maxAttribCount;
+
+	glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxAttribCount);
+
+	glVertexAttribL1d(maxAttribCount, doublev[0]);
+	CHECK_GL_INVALID_VALUE;
+
+	glVertexAttribL2d(maxAttribCount, doublev[0], doublev[1]);
+	CHECK_GL_INVALID_VALUE;
+
+	glVertexAttribL3d(maxAttribCount, doublev[0], doublev[1], doublev[2]);
+	CHECK_GL_INVALID_VALUE;
+
+	glVertexAttribL4d(maxAttribCount, doublev[0], doublev[1], doublev[2],
+			 doublev[3]);
+	CHECK_GL_INVALID_VALUE;
+
+	glVertexAttribL1dv(maxAttribCount, doublev);
+	CHECK_GL_INVALID_VALUE;
+
+	glVertexAttribL2dv(maxAttribCount, doublev);
+	CHECK_GL_INVALID_VALUE;
+
+	glVertexAttribL3dv(maxAttribCount, doublev);
+	CHECK_GL_INVALID_VALUE;
+
+	glVertexAttribL4dv(maxAttribCount, doublev);
+	CHECK_GL_INVALID_VALUE;
+
+	glVertexAttribLPointer(maxAttribCount, 2, GL_DOUBLE, 0, quad);
+	CHECK_GL_INVALID_VALUE;
+
+	glGetVertexAttribLdv(maxAttribCount, GL_CURRENT_VERTEX_ATTRIB, doublev);
+	CHECK_GL_INVALID_VALUE;
+
+	if (piglit_is_extension_supported("GL_EXT_direct_state_access")) {
+		unsigned int vaobj;
+
+		glGenVertexArrays(1, &vaobj);
+		glBindVertexArray(vaobj);
+
+		glVertexArrayVertexAttribLOffsetEXT(vaobj, 0, maxAttribCount, 3,
+						    GL_DOUBLE, 0, 0);
+		glDeleteVertexArrays(1, &vaobj);
+		CHECK_GL_INVALID_VALUE;
+	}
+
+	return PIGLIT_PASS;
+}
+
+void piglit_init(int argc, char **argv)
+{
+	piglit_require_extension("GL_ARB_vertex_attrib_64bit");
+
+	piglit_report_result(run_test());
+}
-- 
2.8.1



More information about the Piglit mailing list