ARB_ubo/referenced-by-shader: pass if shader compiler moves UBOs between shaders
[piglit.git] / tests / spec / arb_vertex_program / minmax.c
blob5fbd6ab32960ad885e44655eba56f3fcdbf581d6
1 /* Copyright © 2011 Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
12 * Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
23 /** @file minmax.c
25 * Test for the minimum maximum values in GL_ARB_vertex_program.
28 #include "piglit-util-gl.h"
30 PIGLIT_GL_TEST_CONFIG_BEGIN
32 config.supports_gl_compat_version = 10;
34 config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
36 PIGLIT_GL_TEST_CONFIG_END
38 enum piglit_result
39 piglit_display(void)
41 /* UNREACHED */
42 return PIGLIT_FAIL;
45 static bool pass = true;
46 static GLenum target;
48 static void
49 min_test_i(GLenum token, GLint min)
51 GLint val;
52 const char *name = piglit_get_gl_enum_name(token);
54 glGetIntegerv(token, &val);
56 if (val < min) {
57 fprintf(stderr, "%-50s %8d %8d (ERROR)\n", name, min, val);
58 pass = false;
59 } else {
60 printf("%-50s %8d %8d\n", name, min, val);
64 static void
65 min_test_program(GLenum token, GLint min)
67 GLint val;
68 const char *name = piglit_get_gl_enum_name(token);
70 glGetProgramivARB(target, token, &val);
72 if (val < min) {
73 fprintf(stderr, "%-50s %8d %8d (ERROR)\n", name, min, val);
74 pass = false;
75 } else {
76 printf("%-50s %8d %8d\n", name, min, val);
80 void
81 piglit_init(int argc, char **argv)
83 piglit_require_extension("GL_ARB_vertex_program");
85 printf("%-50s %8s %8s\n", "token", "minimum", "value");
87 target = GL_VERTEX_PROGRAM_ARB;
88 min_test_program(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, 96);
89 min_test_program(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, 96);
90 min_test_i(GL_MAX_PROGRAM_MATRICES_ARB, 8);
91 min_test_i(GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB, 1);
92 min_test_program(GL_MAX_PROGRAM_INSTRUCTIONS_ARB, 128);
93 min_test_program(GL_MAX_PROGRAM_TEMPORARIES_ARB, 12);
94 min_test_program(GL_MAX_PROGRAM_PARAMETERS_ARB, 96);
95 min_test_program(GL_MAX_PROGRAM_ATTRIBS_ARB, 16);
96 min_test_program(GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, 1);
97 /* No specified minimum, but test that we can query them anyway. */
98 min_test_program(GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, 0);
99 min_test_program(GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, 0);
100 min_test_program(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, 0);
101 min_test_program(GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, 0);
102 min_test_program(GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB, 0);
104 /* See the GL_ARB_fragment_program specification for this
105 * consistency requirement.
107 if (piglit_is_extension_supported("GL_ARB_fragment_program")) {
108 target = GL_FRAGMENT_PROGRAM_ARB;
109 min_test_program(GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB, 0);
110 min_test_program(GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB, 0);
111 min_test_program(GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB, 0);
112 min_test_program(GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, 0);
113 min_test_program(GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB, 0);
114 min_test_program(GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB, 0);
117 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);