[Piglit] [PATCH 4/4] ARB_fragment_program/minmax: New test for minimum maximums.
Eric Anholt
eric at anholt.net
Fri Dec 2 15:21:10 PST 2011
---
tests/all.tests | 1 +
tests/spec/CMakeLists.txt | 1 +
tests/spec/arb_fragment_program/CMakeLists.gl.txt | 16 +++
tests/spec/arb_fragment_program/CMakeLists.txt | 1 +
tests/spec/arb_fragment_program/minmax.c | 111 +++++++++++++++++++++
5 files changed, 130 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/arb_fragment_program/CMakeLists.gl.txt
create mode 100644 tests/spec/arb_fragment_program/CMakeLists.txt
create mode 100644 tests/spec/arb_fragment_program/minmax.c
diff --git a/tests/all.tests b/tests/all.tests
index e669b9b..d95975c 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -961,6 +961,7 @@ spec['ARB_fragment_program'] = arb_fragment_program
add_shader_test_dir(spec['ARB_fragment_program'],
os.path.join(os.path.dirname(__file__), 'spec', 'arb_fragment_program'),
recursive=True)
+arb_fragment_program['minmax'] = concurrent_test('arb_fragment_program-minmax')
# Group ARB_fragment_program_shadow
arb_fragment_program_shadow = Group()
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 96b6eda..fa3f398 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -24,6 +24,7 @@ add_subdirectory (nv_conditional_render)
add_subdirectory (nv_texture_barrier)
add_subdirectory (oes_compressed_paletted_texture)
add_subdirectory (arb_draw_elements_base_vertex)
+add_subdirectory (arb_fragment_program)
add_subdirectory (arb_vertex_buffer_object)
add_subdirectory (arb_vertex_program)
add_subdirectory (arb_copy_buffer)
diff --git a/tests/spec/arb_fragment_program/CMakeLists.gl.txt b/tests/spec/arb_fragment_program/CMakeLists.gl.txt
new file mode 100644
index 0000000..9fa4a2f
--- /dev/null
+++ b/tests/spec/arb_fragment_program/CMakeLists.gl.txt
@@ -0,0 +1,16 @@
+include_directories(
+ ${OPENGL_INCLUDE_PATH}
+ ${GLUT_INCLUDE_DIR}
+ ${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+ piglitutil
+ ${OPENGL_gl_LIBRARY}
+ ${OPENGL_glu_LIBRARY}
+ ${GLUT_glut_LIBRARY}
+)
+
+add_executable (arb_fragment_program-minmax minmax.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/arb_fragment_program/CMakeLists.txt b/tests/spec/arb_fragment_program/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/arb_fragment_program/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_fragment_program/minmax.c b/tests/spec/arb_fragment_program/minmax.c
new file mode 100644
index 0000000..74ab326
--- /dev/null
+++ b/tests/spec/arb_fragment_program/minmax.c
@@ -0,0 +1,111 @@
+/* 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_fragment_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_INTEGER_TEST(GL_MAX_TEXTURE_COORDS_ARB, 2);
+ MIN_INTEGER_TEST(GL_MAX_TEXTURE_UNITS_ARB, 2);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, 24);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, 24);
+ MIN_INTEGER_TEST(GL_MAX_PROGRAM_MATRICES_ARB, 8); /* FINISHME: < 32 */
+ MIN_INTEGER_TEST(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_INSTRUCTIONS_ARB, 72);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, 48);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, 24);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, 4);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_TEMPORARIES_ARB, 16);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_PARAMETERS_ARB, 24);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ATTRIBS_ARB, 10);
+ /* 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_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);
+ 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);
+
+ if (piglit_is_extension_supported("GL_ARB_vertex_program")) {
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, 1);
+ MIN_PROGRAM_TEST(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, 0);
+ }
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
--
1.7.7.3
More information about the Piglit
mailing list