framework/replay: disable AA accounting when comparing with no tolerance
[piglit.git] / tests / spec / arb_transform_feedback_overflow_query / errors.c
blob0ec4bb8267cc4869b21fa1da19747fc9fc8e21b1
1 /*
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
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.
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
34 /**
35 * Verify that glBeginQueryIndexed emits correct error when an invalid index is
36 * used.
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
41 * zero.
43 static enum piglit_result
44 test_begin_index_non_zero(void *test_data)
46 enum piglit_result pass = PIGLIT_PASS;
47 GLuint query;
49 glGenQueries(1, &query);
50 glBeginQueryIndexed(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 1, query);
52 if (!piglit_check_gl_error(GL_INVALID_VALUE))
53 pass = PIGLIT_FAIL;
55 glDeleteQueries(1, &query);
57 return pass;
60 /**
61 * Verify that glBeginQueryIndexed emits correct error when an invalid index is
62 * used.
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;
74 GLint max_stream;
75 GLuint query;
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");
80 pass = PIGLIT_FAIL;
81 goto err_del_query;
84 glGenQueries(1, &query);
85 glBeginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, max_stream, query);
86 if (!piglit_check_gl_error(GL_INVALID_VALUE))
87 pass = PIGLIT_FAIL;
89 err_del_query:
90 glDeleteQueries(1, &query);
92 return pass;
95 /**
96 * Verify that glEndQueryIndexed emits correct error when an invalid index is
97 * used.
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
102 * zero.
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))
112 pass = PIGLIT_FAIL;
114 return pass;
118 * Verify that glEndQueryIndexed emits correct error when an invalid index is
119 * used.
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;
131 GLint max_stream;
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");
136 pass = PIGLIT_FAIL;
137 goto end;
140 glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, max_stream);
141 if (!piglit_check_gl_error(GL_INVALID_VALUE))
142 pass = PIGLIT_FAIL;
144 end:
145 return pass;
149 * Verify that glGetQueryIndexediv emits correct error when an invalid index is
150 * used.
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;
160 GLint query;
162 glGetQueryIndexediv(GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB, 1,
163 GL_CURRENT_QUERY, &query);
164 if (!piglit_check_gl_error(GL_INVALID_VALUE))
165 pass = PIGLIT_FAIL;
167 return pass;
171 * Verify that glGetQueryIndexediv emits correct error when an invalid index is
172 * used.
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;
183 GLint max_stream;
184 GLint query;
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");
189 pass = PIGLIT_FAIL;
190 goto end;
193 glGetQueryIndexediv(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB,
194 max_stream, GL_CURRENT_QUERY, &query);
195 if (!piglit_check_gl_error(GL_INVALID_VALUE))
196 pass = PIGLIT_FAIL;
198 end:
199 return pass;
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,
233 {0},
236 void
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);
255 if (argc > 1) {
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);
265 enum piglit_result
266 piglit_display(void)
268 /* Should never be reached */
269 return PIGLIT_FAIL;