2 * Copyright © 2011 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"
27 * @file begin-while-active.c
29 * Tests that starting conditional rendering on a query object that is
30 * active results in INVALID_OPERATION.
32 * From the NV_conditional_render spec:
34 * "BeginQuery sets the active query object name for the query
35 * type given by <target> to <id>. If BeginQuery is called with
36 * an <id> of zero, if the active query object name for <target>
37 * is non-zero, if <id> is the active query object name for any
38 * query type, or if <id> is the active query object for
39 * condtional rendering (Section 2.X), the error INVALID
40 * OPERATION is generated."
43 PIGLIT_GL_TEST_CONFIG_BEGIN
45 config
.supports_gl_compat_version
= 10;
47 config
.window_visual
= PIGLIT_GL_VISUAL_RGBA
;
48 config
.khr_no_error_support
= PIGLIT_HAS_ERRORS
;
50 PIGLIT_GL_TEST_CONFIG_END
59 piglit_init(int argc
, char **argv
)
63 piglit_require_gl_version(20);
65 piglit_require_extension("GL_NV_conditional_render");
68 glBeginQuery(GL_SAMPLES_PASSED
, q
);
69 glBeginConditionalRenderNV(q
, GL_QUERY_WAIT_NV
);
70 if (!piglit_check_gl_error(GL_INVALID_OPERATION
))
71 piglit_report_result(PIGLIT_FAIL
);
72 glEndQuery(GL_SAMPLES_PASSED
);
73 glDeleteQueries(1, &q
);
75 piglit_report_result(PIGLIT_PASS
);