2 * Copyright © 2014 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
25 * \file invalid-get-program-params.c
27 * From the ARB_tessellation_shader spec (Errors section):
29 * "The error INVALID_OPERATION is generated by GetProgramiv if <pname>
30 * identifies a tessellation control or evaluation shader-specific property
31 * and <program> has not been linked successfully, or does not contain
32 * objects to form a shader whose type corresponds to <pname>."
34 * Test to get parameters from programs that lack the required shader type.
37 #include "piglit-util-gl.h"
39 PIGLIT_GL_TEST_CONFIG_BEGIN
41 config
.supports_gl_compat_version
= 32;
42 config
.supports_gl_core_version
= 32;
43 config
.khr_no_error_support
= PIGLIT_HAS_ERRORS
;
45 PIGLIT_GL_TEST_CONFIG_END
48 static const char *const tcs_source
=
50 "#extension GL_ARB_tessellation_shader: require\n"
51 "layout(vertices = 3) out;\n"
53 " gl_out[gl_InvocationID].gl_Position = vec4(0.0);\n"
54 " gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0);\n"
55 " gl_TessLevelInner = float[2](1.0, 1.0);\n"
58 static const char *const tes_source
=
60 "#extension GL_ARB_tessellation_shader: require\n"
61 "layout(triangles) in;\n"
62 "void main() { gl_Position = vec4(0.0); }\n";
66 piglit_init(int argc
, char **argv
)
69 unsigned int tcs_prog
, tes_prog
;
71 static const GLenum tes_params
[] = {
74 GL_TESS_GEN_VERTEX_ORDER
,
75 GL_TESS_GEN_POINT_MODE
,
78 piglit_require_extension("GL_ARB_tessellation_shader");
80 tcs_prog
= glCreateShaderProgramv(GL_TESS_CONTROL_SHADER
, 1,
81 (const GLchar
*const*)&tcs_source
);
82 pass
= piglit_link_check_status(tcs_prog
) && pass
;
84 tes_prog
= glCreateShaderProgramv(GL_TESS_EVALUATION_SHADER
, 1,
85 (const GLchar
*const*)&tes_source
);
86 pass
= piglit_link_check_status(tes_prog
) && pass
;
88 for (i
= 0; i
< ARRAY_SIZE(tes_params
); ++i
) {
89 pass
= piglit_check_gl_error(GL_NO_ERROR
) && pass
;
90 glGetProgramiv(tcs_prog
, tes_params
[i
], &v
);
91 pass
= piglit_check_gl_error(GL_INVALID_OPERATION
) && pass
;
94 pass
= piglit_check_gl_error(GL_NO_ERROR
) && pass
;
95 glGetProgramiv(tes_prog
, GL_TESS_CONTROL_OUTPUT_VERTICES
, &v
);
96 pass
= piglit_check_gl_error(GL_INVALID_OPERATION
) && pass
;
98 glDeleteProgram(tcs_prog
);
99 glDeleteProgram(tes_prog
);
101 pass
= piglit_check_gl_error(GL_NO_ERROR
) && pass
;
103 piglit_report_result(pass
? PIGLIT_PASS
: PIGLIT_FAIL
);