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 get-tes-params.c
27 * Test tessellation evaluation shader layout getters.
30 #include "piglit-util-gl.h"
32 PIGLIT_GL_TEST_CONFIG_BEGIN
34 config
.supports_gl_compat_version
= 32;
35 config
.supports_gl_core_version
= 32;
36 config
.khr_no_error_support
= PIGLIT_NO_ERRORS
;
38 PIGLIT_GL_TEST_CONFIG_END
44 static const char *const vs_source
=
46 "void main() { gl_Position = vec4(0.0); }\n";
51 GLenum vertex_spacing
;
56 {GL_QUADS
, GL_EQUAL
, GL_CCW
, GL_FALSE
,
58 "#extension GL_ARB_tessellation_shader: require\n"
60 "void main() { gl_Position = vec4(0.0); }\n"},
62 {GL_TRIANGLES
, GL_EQUAL
, GL_CCW
, GL_FALSE
,
64 "#extension GL_ARB_tessellation_shader: require\n"
65 "layout(triangles) in;\n"
66 "void main() { gl_Position = vec4(0.0); }\n"},
68 {GL_ISOLINES
, GL_EQUAL
, GL_CCW
, GL_FALSE
,
70 "#extension GL_ARB_tessellation_shader: require\n"
71 "layout(isolines) in;\n"
72 "void main() { gl_Position = vec4(0.0); }\n"},
74 {GL_QUADS
, GL_FRACTIONAL_ODD
, GL_CCW
, GL_FALSE
,
76 "#extension GL_ARB_tessellation_shader: require\n"
77 "layout(quads, fractional_odd_spacing) in;\n"
78 "void main() { gl_Position = vec4(0.0); }\n"},
80 {GL_QUADS
, GL_FRACTIONAL_EVEN
, GL_CCW
, GL_FALSE
,
82 "#extension GL_ARB_tessellation_shader: require\n"
83 "layout(quads, fractional_even_spacing) in;\n"
84 "void main() { gl_Position = vec4(0.0); }\n"},
86 {GL_QUADS
, GL_EQUAL
, GL_CW
, GL_FALSE
,
88 "#extension GL_ARB_tessellation_shader: require\n"
89 "layout(quads, cw) in;\n"
90 "void main() { gl_Position = vec4(0.0); }\n"},
92 {GL_QUADS
, GL_EQUAL
, GL_CCW
, GL_TRUE
,
94 "#extension GL_ARB_tessellation_shader: require\n"
95 "layout(quads, point_mode) in;\n"
96 "void main() { gl_Position = vec4(0.0); }\n"},
101 test_param(GLenum pname
, GLenum expected_value
, const char *const source
)
105 glGetProgramiv(prog
, pname
, &v
);
106 if (v
== expected_value
)
109 fprintf(stderr
, "%s is %s, expected %s for program \n%s\n",
110 piglit_get_gl_enum_name(pname
),
111 piglit_get_gl_enum_name(v
),
112 piglit_get_gl_enum_name(expected_value
), source
);
118 test_tes_params(void)
123 for (i
= 0; i
< ARRAY_SIZE(tes_params
); ++i
) {
124 prog
= piglit_build_simple_program_multiple_shaders(
125 GL_VERTEX_SHADER
, vs_source
,
126 GL_TESS_EVALUATION_SHADER
, tes_params
[i
].source
,
129 pass
= test_param(GL_TESS_GEN_MODE
,
130 tes_params
[i
].prim_mode
,
131 tes_params
[i
].source
) && pass
;
132 pass
= test_param(GL_TESS_GEN_SPACING
,
133 tes_params
[i
].vertex_spacing
,
134 tes_params
[i
].source
) && pass
;
135 pass
= test_param(GL_TESS_GEN_VERTEX_ORDER
,
136 tes_params
[i
].ordering
,
137 tes_params
[i
].source
) && pass
;
138 pass
= test_param(GL_TESS_GEN_POINT_MODE
,
139 tes_params
[i
].point_mode
,
140 tes_params
[i
].source
) && pass
;
142 glDeleteProgram(prog
);
149 piglit_init(int argc
, char **argv
)
153 piglit_require_extension("GL_ARB_tessellation_shader");
155 pass
= test_tes_params() && pass
;
157 pass
= piglit_check_gl_error(GL_NO_ERROR
) && pass
;
159 piglit_report_result(pass
? PIGLIT_PASS
: PIGLIT_FAIL
);