[Piglit] [PATCH 2/2] arb_occlusion_query2: Checks that query obj passed to glBeginQuery matches target
Ian Romanick
idr at freedesktop.org
Tue Feb 17 14:13:40 PST 2015
This patch is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
I did some spec archaeology. This error was added in OpenGL 3.0 when
the second (and third) query types were added. EXT_transform_feedback
(2008), ARB_occlusion_query2 (2010), and ARB_timer_query (2010) all add
this error. If you're feeling really bored, there is some value in
having a similar test for those other extensions.
On 02/16/2015 03:19 AM, Eduardo Lima Mitev wrote:
> From the OpenGL 3.3 spec, section "2.14. ASYNCHRONOUS QUERIES", page 94:
>
> "[...] if id is the name of an existing query object whose type does not
> match target, [...] the error INVALID_OPERATION is generated."
>
> Similar wording exists in the OpenGL ES 3.0.0 spec, section "2.13.
> ASYNCHRONOUS QUERIES", page 82.
>
> This patch adds a check for this situation.
> ---
> tests/spec/arb_occlusion_query2/api.c | 33 +++++++++++++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/tests/spec/arb_occlusion_query2/api.c b/tests/spec/arb_occlusion_query2/api.c
> index 271948e..463e1fa 100644
> --- a/tests/spec/arb_occlusion_query2/api.c
> +++ b/tests/spec/arb_occlusion_query2/api.c
> @@ -106,6 +106,38 @@ test_counter_bits(void)
> }
>
> static bool
> +test_error_begin_wrong_target(void)
> +{
> + bool pass = true;
> + GLuint oq;
> +
> + glGenQueries(1, &oq);
> +
> + glBeginQuery(GL_SAMPLES_PASSED, oq);
> + if (!piglit_check_gl_error(0))
> + pass = false;
> + glEndQuery(GL_SAMPLES_PASSED);
> +
> + /* From the OpenGL 3.3 spec, section "2.14. ASYNCHRONOUS QUERIES", page 94:
> + *
> + * "[...] if id is the name of an existing query object whose type does not
> + * match target, [...] the error INVALID_OPERATION is generated."
> + *
> + * Similar wording exists in the OpenGL ES 3.0.0 spec, section "2.13.
> + * ASYNCHRONOUS QUERIES", page 82.
> + */
> + glBeginQuery(GL_ANY_SAMPLES_PASSED, oq);
> + if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> + pass = false;
> + glEndQuery(GL_ANY_SAMPLES_PASSED);
> + piglit_reset_gl_error();
> +
> + glDeleteQueries(1, &oq);
> +
> + return pass;
> +}
> +
> +static bool
> test_error_end_wrong_target(void)
> {
> bool pass = true;
> @@ -237,6 +269,7 @@ piglit_display(void)
>
> pass = test_counter_bits() && pass;
> pass = test_current_query() && pass;
> + pass = test_error_begin_wrong_target() && pass;
> pass = test_error_end_wrong_target() && pass;
> pass = test_error_begin_while_other_active() && pass;
>
>
More information about the Piglit
mailing list