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
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
24 * Eric Anholt <eric@anholt.net>
28 /** @file glsl-vs-sqrt-zero.c
30 * Tests that sqrt(0.0) in the VS produces 0.0.
33 #include "piglit-util-gl.h"
35 PIGLIT_GL_TEST_CONFIG_BEGIN
37 config
.supports_gl_compat_version
= 10;
39 config
.window_visual
= PIGLIT_GL_VISUAL_RGB
| PIGLIT_GL_VISUAL_DOUBLE
;
41 PIGLIT_GL_TEST_CONFIG_END
53 piglit_init(int argc
, char **argv
)
55 GLboolean pass
= GL_TRUE
;
61 piglit_require_gl_version(20);
63 vs
= piglit_compile_shader(GL_VERTEX_SHADER
,
64 "shaders/glsl-getactiveuniform-array-size.vert");
65 fs
= piglit_compile_shader(GL_FRAGMENT_SHADER
,
66 "shaders/glsl-color.frag");
68 prog
= piglit_link_simple_program(vs
, fs
);
70 glGetProgramiv(prog
, GL_ACTIVE_UNIFORM_MAX_LENGTH
, &len
);
71 name
= malloc(len
+ 20);
73 glGetActiveUniform(prog
, 0, len
+ 20, &len
, &size
, &type
, name
);
75 /* From page 81 (page 89 of the PDF) of the OpenGL 2.1 specification:
77 * If one or more elements of an array are active,
78 * GetActiveUniform will return the name of the array in
79 * name, subject to the restrictions listed above. The
80 * type of the array is returned in type. The size
81 * parameter contains the highest array element index
86 printf("Unexpected active uniform size "
87 "(saw %d, expected %d)\n", size
, 25);
92 piglit_report_result(PIGLIT_PASS
);
94 piglit_report_result(PIGLIT_FAIL
);