[Piglit] [PATCH 3/4] ARB_vertex_program/minmax: New test for minimum maximums.
Eric Anholt
eric at anholt.net
Fri Dec 2 15:21:09 PST 2011
---
tests/all.tests | 1 +
tests/spec/arb_vertex_program/CMakeLists.gl.txt | 1 +
tests/spec/arb_vertex_program/minmax.c | 112 +++++++++++++++++++++++
3 files changed, 114 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/arb_vertex_program/minmax.c
diff --git a/tests/all.tests b/tests/all.tests
index 782ae33..e669b9b 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1149,6 +1149,7 @@ spec['ARB_vertex_program'] = arb_vertex_program
arb_vertex_program['getenv4d-with-error'] = PlainExecTest(['arb_vertex_program-getenv4d-with-error', '-auto'])
arb_vertex_program['getlocal4d-with-error'] = PlainExecTest(['arb_vertex_program-getlocal4d-with-error', '-auto'])
arb_vertex_program['clip-plane-transformation arb'] = concurrent_test('clip-plane-transformation arb')
+arb_vertex_program['minmax'] = concurrent_test('arb_vertex_program-minmax')
ext_framebuffer_object = Group()
spec['EXT_framebuffer_object'] = ext_framebuffer_object
diff --git a/tests/spec/arb_vertex_program/CMakeLists.gl.txt b/tests/spec/arb_vertex_program/CMakeLists.gl.txt
index 5f12f96..2b265c3 100644
--- a/tests/spec/arb_vertex_program/CMakeLists.gl.txt
+++ b/tests/spec/arb_vertex_program/CMakeLists.gl.txt
@@ -13,5 +13,6 @@ link_libraries (
add_executable (arb_vertex_program-getenv4d-with-error getenv4d-with-error.c)
add_executable (arb_vertex_program-getlocal4d-with-error getlocal4d-with-error.c)
+add_executable (arb_vertex_program-minmax minmax.c)
# vim: ft=cmake:
diff --git a/tests/spec/arb_vertex_program/minmax.c b/tests/spec/arb_vertex_program/minmax.c
new file mode 100644
index 0000000..429d09f
--- /dev/null
+++ b/tests/spec/arb_vertex_program/minmax.c
@@ -0,0 +1,112 @@
+/* Copyright © 2011 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 minmax.c
+ *
+ * Test for the minimum maximum values in GL_ARB_vertex_program.
+ */
+
+#include "piglit-util.h"
+#include "sized-internalformats.h"
+
+int piglit_width = 32;
+int piglit_height = 32;
+int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+static bool pass = true;
+
+static void
+min_test_i(GLenum token, GLint min, const char *name)
+{
+ GLint val;
+
+ glGetIntegerv(token, &val);
+
+ if (val < min) {
+ fprintf(stderr, "%-50s %8d %8d (ERROR)\n", name, min, val);
+ pass = false;
+ } else {
+ printf("%-50s %8d %8d\n", name, min, val);
+ }
+}
+
+static void
+min_test_program(GLenum token, GLint min, const char *name)
+{
+ GLint val;
+
+ glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, token, &val);
+
+ if (val < min) {
+ fprintf(stderr, "%-50s %8d %8d (ERROR)\n", name, min, val);
+ pass = false;
+ } else {
+ printf("%-50s %8d %8d\n", name, min, val);
+ }
+}
+#define MIN_INTEGER_TEST(token, min) min_test_i(token, min, #token)
+#define MIN_PROGRAM_TEST(token, min) min_test_program(token, min, #token)
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_ARB_vertex_program");
+
+ printf("%-50s %8s %8s\n", "token", "minimum", "value");
+
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, 96);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, 96);
+ MIN_INTEGER_TEST(GL_MAX_PROGRAM_MATRICES_ARB, 8);
+ MIN_INTEGER_TEST(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_INSTRUCTIONS_ARB, 128);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEMPORARIES_ARB, 12);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_PARAMETERS_ARB, 96);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ATTRIBS_ARB, 16);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, 1);
+ /* No specified minimum, but test that we can query them anyway. */
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, 0);
+
+ /* See the GL_ARB_fragment_program specification for this
+ * consistency requirement.
+ */
+ if (piglit_is_extension_supported("GL_ARB_fragment_program")) {
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, 0);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, 0);
+ }
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
--
1.7.7.3
More information about the Piglit
mailing list