[Piglit] [PATCH] oes_matrix_get: Add basic test for GL_OES_matrix_get

Ian Romanick idr at freedesktop.org
Tue Sep 10 13:46:30 PDT 2013


From: Ian Romanick <ian.d.romanick at intel.com>

This is an OpenGL ES 1.x extension that Mesa has advertised for quite
some time.  However, it appears that there is *no* code in Mesa to back
that up!

This test currently fails in all versions of Mesa.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/all.tests                                |  4 ++
 tests/spec/CMakeLists.txt                      |  1 +
 tests/spec/oes_matrix_get/CMakeLists.gles1.txt | 11 +++
 tests/spec/oes_matrix_get/CMakeLists.txt       |  1 +
 tests/spec/oes_matrix_get/api.c                | 92 ++++++++++++++++++++++++++
 5 files changed, 109 insertions(+)
 create mode 100644 tests/spec/oes_matrix_get/CMakeLists.gles1.txt
 create mode 100644 tests/spec/oes_matrix_get/CMakeLists.txt
 create mode 100644 tests/spec/oes_matrix_get/api.c

diff --git a/tests/all.tests b/tests/all.tests
index b848450..5a6f14e 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -2409,6 +2409,10 @@ spec['OES_compressed_paletted_texture'] = oes_compressed_paletted_texture
 oes_compressed_paletted_texture['invalid formats'] = PlainExecTest(['arb_texture_compression-invalid-formats', 'paletted'])
 oes_compressed_paletted_texture['invalid formats'].runConcurrent = True
 
+oes_matrix_get = Group()
+spec['OES_matrix_get'] = oes_matrix_get
+oes_matrix_get['All queries'] = concurrent_test('oes_matrix_get-api')
+
 oes_fixed_point = Group()
 spec['OES_fixed_point'] = oes_fixed_point
 oes_fixed_point['attribute-arrays'] = concurrent_test('oes_fixed_point-attribute-arrays')
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 373342e..fbd00cf 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -52,6 +52,7 @@ add_subdirectory (nv_conditional_render)
 add_subdirectory (nv_texture_barrier)
 add_subdirectory (oes_compressed_etc1_rgb8_texture)
 add_subdirectory (oes_compressed_paletted_texture)
+add_subdirectory (oes_matrix_get)
 add_subdirectory (arb_draw_elements_base_vertex)
 add_subdirectory (arb_fragment_program)
 add_subdirectory (arb_vertex_array_bgra)
diff --git a/tests/spec/oes_matrix_get/CMakeLists.gles1.txt b/tests/spec/oes_matrix_get/CMakeLists.gles1.txt
new file mode 100644
index 0000000..f9fd436
--- /dev/null
+++ b/tests/spec/oes_matrix_get/CMakeLists.gles1.txt
@@ -0,0 +1,11 @@
+include_directories(
+	${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries(
+	piglitutil_${piglit_target_api}
+	)
+
+piglit_add_executable(oes_matrix_get-api api.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/oes_matrix_get/CMakeLists.txt b/tests/spec/oes_matrix_get/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/oes_matrix_get/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/oes_matrix_get/api.c b/tests/spec/oes_matrix_get/api.c
new file mode 100644
index 0000000..2b537f6
--- /dev/null
+++ b/tests/spec/oes_matrix_get/api.c
@@ -0,0 +1,92 @@
+/*
+ * 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 oes_matrix_get-api.c
+ * Test the queries added by GL_OES_matrix_get.
+ */
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+	config.supports_gl_es_version = 11;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+	/* UNREACHED */
+	return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+	static const struct {
+		GLenum set;
+		GLenum get;
+	} test_vectors[] = {
+		{ GL_MODELVIEW, GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES },
+		{ GL_PROJECTION, GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES },
+		{ GL_TEXTURE, GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES },
+	};
+
+	static const float m[] = {
+		10., 11., 12., 13.,
+		14., 15., 16., 17.,
+		18., 19., 20., 21.,
+		22., 23., 24., 25.
+	};
+
+	float got[ARRAY_SIZE(m)];
+	unsigned i;
+	bool pass = true;
+
+	piglit_require_extension("GL_OES_matrix_get");
+
+	for (i = 0; i < ARRAY_SIZE(test_vectors); i++) {
+		glMatrixMode(test_vectors[i].set);
+		glLoadMatrixf(m);
+
+		memset(got, 0, sizeof(got));
+		glGetIntegerv(test_vectors[i].get, (GLint *) got);
+                pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+		if (memcmp(got, m, sizeof(m)) != 0) {
+			unsigned j;
+
+			fprintf(stderr, "Data mismatch for %s. Got:\n",
+				piglit_get_gl_enum_name(test_vectors[i].set));
+
+			for (j = 0; j < ARRAY_SIZE(got); j++) {
+				fprintf(stderr, "%f%s",
+					got[j], (j % 4) == 3 ? "\n" : ", ");
+			}
+			
+			pass = false;
+		}
+	}
+
+	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
-- 
1.8.1.4



More information about the Piglit mailing list