perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / shaders / glsl-getactiveuniform-count.c
blob9d5adbb05ff6a53350e63782c293536f0aa381fe
1 /*
2 * Copyright © 2009 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
23 * Authors:
24 * Eric Anholt <eric@anholt.net>
28 /** @file glsl-getactiveuniform-count.c
30 * Tests that glGetActiveUniform's maximum index is correctly reflected in
31 * GL_ACTIVE_UNIFORMS.
34 #include "piglit-util-gl.h"
36 PIGLIT_GL_TEST_CONFIG_BEGIN
38 config.supports_gl_compat_version = 10;
40 config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
42 PIGLIT_GL_TEST_CONFIG_END
44 static GLint prog;
46 enum piglit_result
47 piglit_display(void)
49 /* unreached */
50 return PIGLIT_FAIL;
53 void
54 piglit_init(int argc, char **argv)
56 GLboolean pass = GL_TRUE;
57 GLint vs, fs, num;
58 GLint expect;
60 if (argc < 3) {
61 printf("Usage: %s <vertex shader file> "
62 "<expected uniform count>\n", argv[0]);
63 piglit_report_result(PIGLIT_FAIL);
66 expect = (int) strtol(argv[2], NULL, 0);
68 piglit_require_vertex_shader();
69 piglit_require_fragment_shader();
71 vs = piglit_compile_shader(GL_VERTEX_SHADER, argv[1]);
72 fs = piglit_compile_shader(GL_FRAGMENT_SHADER,
73 "shaders/glsl-color.frag");
75 prog = piglit_link_simple_program(vs, fs);
77 glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &num);
78 if (num != expect) {
79 printf("Unexpected active uniform count "
80 "(saw %d, expected %d)\n", num, expect);
81 pass = GL_FALSE;
84 if (pass)
85 piglit_report_result(PIGLIT_PASS);
86 else
87 piglit_report_result(PIGLIT_FAIL);