2 * Copyright (c) 2016 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 #include "piglit-util-gl.h"
26 PIGLIT_GL_TEST_CONFIG_BEGIN
28 config
.supports_gl_compat_version
= 32;
29 config
.supports_gl_core_version
= 32;
30 config
.khr_no_error_support
= PIGLIT_HAS_ERRORS
;
32 PIGLIT_GL_TEST_CONFIG_END
35 * Verify that glBeginQueryIndexed emits correct error when an invalid index is
38 * From the ARB_transform_feedback_overflow_query spec:
39 * An INVALID_VALUE error is generated if <target> is SAMPLES_PASSED ...
40 * TIME_ELAPSED, or TRANSFORM_FEEDBACK_OVERFLOW_ARB, and <index> is not
43 static enum piglit_result
44 test_begin_index_non_zero(void *test_data
)
46 enum piglit_result pass
= PIGLIT_PASS
;
49 glGenQueries(1, &query
);
50 glBeginQueryIndexed(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB
, 1, query
);
52 if (!piglit_check_gl_error(GL_INVALID_VALUE
))
55 glDeleteQueries(1, &query
);
61 * Verify that glBeginQueryIndexed emits correct error when an invalid index is
64 * From the ARB_transform_feedback_overflow_query spec:
65 * An INVALID_VALUE error is generated if <target> is PRIMITIVES_GENERATED,
66 * TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or
67 * TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, and <index> is not in the range
68 * zero to the value of MAX_VERTEX_STREAMS minus one.
70 static enum piglit_result
71 test_begin_index_invalid(void *test_data
)
73 enum piglit_result pass
= PIGLIT_PASS
;
77 glGetIntegerv(GL_MAX_VERTEX_STREAMS
, &max_stream
);
78 if (!piglit_check_gl_error(GL_NO_ERROR
)) {
79 printf("failed to resolve the maximum number of streams\n");
84 glGenQueries(1, &query
);
85 glBeginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
, max_stream
, query
);
86 if (!piglit_check_gl_error(GL_INVALID_VALUE
))
90 glDeleteQueries(1, &query
);
96 * Verify that glEndQueryIndexed emits correct error when an invalid index is
99 * From the ARB_transform_feedback_overflow_query spec:
100 * An INVALID_VALUE error is generated if <target> is SAMPLES_PASSED, ...
101 * TIME_ELAPSED, or TRANSFORM_FEEDBACK_OVERFLOW_ARB, and <index> is not
104 static enum piglit_result
105 test_end_index_non_zero(void *test_data
)
107 enum piglit_result pass
= PIGLIT_PASS
;
109 glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB
, 1);
111 if (!piglit_check_gl_error(GL_INVALID_VALUE
))
118 * Verify that glEndQueryIndexed emits correct error when an invalid index is
121 * From the ARB_transform_feedback_overflow_query spec:
122 * An INVALID_VALUE error is generated if <target> is PRIMITIVES_GENERATED,
123 * TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, or
124 * TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, and <index> is not in the range
125 * zero to the value of MAX_VERTEX_STREAMS minus one.
127 static enum piglit_result
128 test_end_index_invalid(void *test_data
)
130 enum piglit_result pass
= PIGLIT_PASS
;
133 glGetIntegerv(GL_MAX_VERTEX_STREAMS
, &max_stream
);
134 if (!piglit_check_gl_error(GL_NO_ERROR
)) {
135 printf("failed to resolve the maximum number of streams\n");
140 glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
, max_stream
);
141 if (!piglit_check_gl_error(GL_INVALID_VALUE
))
149 * Verify that glGetQueryIndexediv emits correct error when an invalid index is
152 * From the ARB_transform_feedback_overflow_query spec:
153 * An INVALID_VALUE error is generated if <target> is ..., or
154 * TRANSFORM_FEEDBACK_OVERFLOW_ARB, and <index> is not zero.
156 static enum piglit_result
157 test_get_query_index_non_zero(void *test_data
)
159 enum piglit_result pass
= PIGLIT_PASS
;
162 glGetQueryIndexediv(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB
, 1,
163 GL_CURRENT_QUERY
, &query
);
164 if (!piglit_check_gl_error(GL_INVALID_VALUE
))
171 * Verify that glGetQueryIndexediv emits correct error when an invalid index is
174 * From the ARB_transform_feedback_overflow_query spec:
175 * An INVALID_VALUE error is generated if <target> is ..., or
176 * TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, and <index> is not in the range
177 * zero to the value of MAX_VERTEX_STREAMS minus one.
179 static enum piglit_result
180 test_get_query_index_invalid(void *test_data
)
182 enum piglit_result pass
= PIGLIT_PASS
;
186 glGetIntegerv(GL_MAX_VERTEX_STREAMS
, &max_stream
);
187 if (!piglit_check_gl_error(GL_NO_ERROR
)) {
188 printf("failed to resolve the maximum number of streams\n");
193 glGetQueryIndexediv(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB
,
194 max_stream
, GL_CURRENT_QUERY
, &query
);
195 if (!piglit_check_gl_error(GL_INVALID_VALUE
))
202 const struct piglit_subtest overflow_query_subtests
[] = {
204 "arb_transform_feedback_overflow_query-begin_index_non_zero",
205 "arb_transform_feedback_overflow_query-begin_index_non_zero",
206 test_begin_index_non_zero
,
209 "arb_transform_feedback_overflow_query-begin_index_invalid",
210 "arb_transform_feedback_overflow_query-begin_index_invalid",
211 test_begin_index_invalid
,
214 "arb_transform_feedback_overflow_query-end_index_non_zero",
215 "arb_transform_feedback_overflow_query-end_index_non_zero",
216 test_end_index_non_zero
,
219 "arb_transform_feedback_overflow_query-end_index_invalid",
220 "arb_transform_feedback_overflow_query-end_index_invalid",
221 test_end_index_invalid
,
224 "arb_transform_feedback_overflow_query-get_query_index_non_zero",
225 "arb_transform_feedback_overflow_query-get_query_index_non_zero",
226 test_get_query_index_non_zero
,
229 "arb_transform_feedback_overflow_query-get_query_index_invalid",
230 "arb_transform_feedback_overflow_query-get_query_index_invalid",
231 test_get_query_index_invalid
,
237 piglit_init(int argc
, char **argv
)
240 enum piglit_result result
= PIGLIT_SKIP
;
241 const char **selected_subtests
= NULL
;
242 size_t num_selected_subtests
= 0;
243 const struct piglit_subtest
*subtests
= overflow_query_subtests
;
245 piglit_require_extension("GL_ARB_gpu_shader5");
246 piglit_require_extension("GL_ARB_transform_feedback3");
247 piglit_require_extension("GL_ARB_transform_feedback_overflow_query");
249 /* Strip common piglit args. */
250 piglit_strip_arg(&argc
, argv
, "-fbo");
251 piglit_strip_arg(&argc
, argv
, "-auto");
252 piglit_parse_subtest_args(&argc
, argv
, subtests
, &selected_subtests
,
253 &num_selected_subtests
);
256 fprintf(stderr
, "usage error\n");
257 piglit_report_result(PIGLIT_FAIL
);
260 result
= piglit_run_selected_subtests(subtests
, selected_subtests
,
261 num_selected_subtests
, result
);
262 piglit_report_result(result
);
268 /* Should never be reached */