[Piglit] [PATCH 2/2] Test that VERTEX_ATTRIB_ARRAY_DIVISOR may be passed to GetVertexAttrib* functions.

Nicholas Mack nichmack at gmail.com
Mon Nov 18 15:59:17 PST 2013


---
 tests/all.tests                                    |  1 +
 tests/spec/arb_instanced_arrays/CMakeLists.gl.txt  |  1 +
 .../vertex-attrib-divisor-query.c                  | 86 ++++++++++++++++++++++
 3 files changed, 88 insertions(+)
 create mode 100644 tests/spec/arb_instanced_arrays/vertex-attrib-divisor-query.c

diff --git a/tests/all.tests b/tests/all.tests
index b2b380c..4d010e1 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2546,6 +2546,7 @@ add_plain_test(ati_envmap_bumpmap, 'ati_envmap_bumpmap-bump')
 arb_instanced_arrays = Group()
 spec['ARB_instanced_arrays'] = arb_instanced_arrays
 add_plain_test(arb_instanced_arrays, 'vertex-attrib-divisor-index-error')
+add_plain_test(arb_instanced_arrays, 'vertex-attrib-divisor-query')
 add_plain_test(arb_instanced_arrays, 'instanced_arrays')
 add_single_param_test_set(arb_instanced_arrays, 'instanced_arrays', 'vbo')
 
diff --git a/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt b/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt
index 8f7498e..a4bdd45 100644
--- a/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt
+++ b/tests/spec/arb_instanced_arrays/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries (
 
 piglit_add_executable (instanced_arrays instanced_arrays.c)
 piglit_add_executable (vertex-attrib-divisor-index-error vertex-attrib-divisor-index-error.c)
+piglit_add_executable (vertex-attrib-divisor-query vertex-attrib-divisor-query.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-query.c b/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-query.c
new file mode 100644
index 0000000..9c47503
--- /dev/null
+++ b/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-query.c
@@ -0,0 +1,86 @@
+/**
+ * Copyright © 2013 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
+ * Test that VERTEX_ATTRIB_ARRAY_DIVISOR may be passed to GetVertexAttrib*
+ * functions.
+ *
+ * GL 3.3 core spec, section 6.1.11 (Shader and Program Queries) says:
+ * "The commands
+ *  	void GetVertexAttribdv( uint index, enum pname, double *params );
+ *  	void GetVertexAttribfv( uint index, enum pname, float *params );
+ *  	void GetVertexAttribiv( uint index, enum pname, int *params );
+ *  	void GetVertexAttribIiv( uint index, enum pname, int *params );
+ *  	void GetVertexAttribIuiv( uint index, enum pname, uint *params );
+ *  obtain the vertex attribute state named by pname for the generic vertex
+ *  attribute numbered index and places the information in the array params.
+ *  pname must be one of VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
+ *  VERTEX_ATTRIB_ARRAY_ENABLED, VERTEX_ATTRIB_ARRAY_SIZE,
+ *  VERTEX_ATTRIB_ARRAY_STRIDE, VERTEX_ATTRIB_ARRAY_TYPE,
+ *  VERTEX_ATTRIB_ARRAY_NORMALIZED, VERTEX_ATTRIB_ARRAY_INTEGER,
+ *  VERTEX_ATTRIB_ARRAY_DIVISOR, or CURRENT_VERTEX_ATTRIB."
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_core_version = 33;
+	config.supports_gl_compat_version = 33;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+	bool pass = true;
+	GLdouble dParam[] = {1.0};
+	GLfloat fParam[] = {1.0f};
+	GLint iParam[] = {-1};
+	GLuint uParam[] = {1};
+
+	glGetVertexAttribdv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, dParam);
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+	glGetVertexAttribfv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, fParam);
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+	glGetVertexAttribiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, iParam);
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+	glGetVertexAttribIiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, iParam);
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+	glGetVertexAttribIuiv(0, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, uParam);
+	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
-- 
1.8.3.1



More information about the Piglit mailing list