[Mesa-dev] arb_occlusion_query2: expect an error when target mismatch in glBeginQuery()

Submitted by Eduardo Lima Mitev on Feb. 10, 2015, 7:48 a.m.

Details

Message ID 1423554531-15978-1-git-send-email-elima@igalia.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Eduardo Lima Mitev Feb. 10, 2015, 7:48 a.m.
From the OpenGL ES 3.0.0 spec, section "2.13. ASYNCHRONOUS QUERIES",
page 82:

    "BeginQuery generates an INVALID_OPERATION error if any of the
     following conditions hold: [...]; id is the name of an existing
     query object whose type does not match target; [...]

OpenGL 3.3 spec has similar wording at section "2.14. ASYNCHRONOUS
QUERIES", page 94.

Hence, trying to call BeginQuery on a query object which has already
been bound to a different target should return GL_INVALID_OPERATION.
---
 tests/spec/arb_occlusion_query2/api.c | 49 +++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_occlusion_query2/api.c b/tests/spec/arb_occlusion_query2/api.c
index f4d46e3..6d48b96 100644
--- a/tests/spec/arb_occlusion_query2/api.c
+++ b/tests/spec/arb_occlusion_query2/api.c
@@ -59,6 +59,10 @@  test_error_begin_while_other_active(void)
 	glEndQuery(GL_SAMPLES_PASSED);
 	piglit_reset_gl_error();
 
+	glDeleteQueries(2, oq);
+
+	glGenQueries(2, oq);
+
 	glBeginQuery(GL_ANY_SAMPLES_PASSED, oq[0]);
 	if (!piglit_check_gl_error(0))
 		pass = false;
@@ -102,6 +106,43 @@  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 ES 3.0.0 spec, section "2.13. ASYNCHRONOUS QUERIES",
+         * page 82:
+         *
+         *     "BeginQuery generates an INVALID_OPERATION error if any of the
+         *      following conditions hold: [...]; id is the name of an existing
+         *      query object whose type does not match target; [...]
+         *
+         * OpenGL 3.3 spec has similar wording at section "2.14. ASYNCHRONOUS
+         * QUERIES", page 94.
+         *
+         * Hence, trying to call BeginQuery on a query object which has already
+         * been bound to a different target should return GL_INVALID_OPERATION.
+         */
+	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;
@@ -124,6 +165,10 @@  test_error_end_wrong_target(void)
 	glEndQuery(GL_SAMPLES_PASSED);
 	piglit_reset_gl_error();
 
+	glDeleteQueries(1, &oq);
+
+	glGenQueries(1, &oq);
+
 	glBeginQuery(GL_ANY_SAMPLES_PASSED, oq);
 	if (!piglit_check_gl_error(0))
 		pass = false;
@@ -191,6 +236,9 @@  test_current_query(void)
 		pass = false;
 	}
 	glEndQuery(GL_ANY_SAMPLES_PASSED);
+	glDeleteQueries(1, &oq);
+
+	glGenQueries(1, &oq);
 
 	/* Test the result for GL_SAMPLES_PASSED active */
 	glBeginQuery(GL_SAMPLES_PASSED, oq);
@@ -226,6 +274,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;
 

Comments

As a heads-up, with this patch piglit fails the test for current Mesa.
But I'm about to send another series of patches for dEQP tests which
include a fix in Mesa for this issue.

The piglit test in question is:

bin/arb_occlusion_query2-api -auto -fbo

Eduardo

On 02/10/2015 08:48 AM, Eduardo Lima Mitev wrote:
> From the OpenGL ES 3.0.0 spec, section "2.13. ASYNCHRONOUS QUERIES",
> page 82:
>
>     "BeginQuery generates an INVALID_OPERATION error if any of the
>      following conditions hold: [...]; id is the name of an existing
>      query object whose type does not match target; [...]
>
> OpenGL 3.3 spec has similar wording at section "2.14. ASYNCHRONOUS
> QUERIES", page 94.
>
> Hence, trying to call BeginQuery on a query object which has already
> been bound to a different target should return GL_INVALID_OPERATION.
> ---
>  tests/spec/arb_occlusion_query2/api.c | 49
+++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>
I'm guessing that this was meant for the piglit ML - Cc-ing it :)

-Emil

On 10/02/15 07:48, Eduardo Lima Mitev wrote:
> From the OpenGL ES 3.0.0 spec, section "2.13. ASYNCHRONOUS QUERIES",
> page 82:
> 
>     "BeginQuery generates an INVALID_OPERATION error if any of the
>      following conditions hold: [...]; id is the name of an existing
>      query object whose type does not match target; [...]
> 
> OpenGL 3.3 spec has similar wording at section "2.14. ASYNCHRONOUS
> QUERIES", page 94.
> 
> Hence, trying to call BeginQuery on a query object which has already
> been bound to a different target should return GL_INVALID_OPERATION.
> ---
>  tests/spec/arb_occlusion_query2/api.c | 49 +++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
> 
> diff --git a/tests/spec/arb_occlusion_query2/api.c b/tests/spec/arb_occlusion_query2/api.c
> index f4d46e3..6d48b96 100644
> --- a/tests/spec/arb_occlusion_query2/api.c
> +++ b/tests/spec/arb_occlusion_query2/api.c
> @@ -59,6 +59,10 @@ test_error_begin_while_other_active(void)
>  	glEndQuery(GL_SAMPLES_PASSED);
>  	piglit_reset_gl_error();
>  
> +	glDeleteQueries(2, oq);
> +
> +	glGenQueries(2, oq);
> +
>  	glBeginQuery(GL_ANY_SAMPLES_PASSED, oq[0]);
>  	if (!piglit_check_gl_error(0))
>  		pass = false;
> @@ -102,6 +106,43 @@ 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 ES 3.0.0 spec, section "2.13. ASYNCHRONOUS QUERIES",
> +         * page 82:
> +         *
> +         *     "BeginQuery generates an INVALID_OPERATION error if any of the
> +         *      following conditions hold: [...]; id is the name of an existing
> +         *      query object whose type does not match target; [...]
> +         *
> +         * OpenGL 3.3 spec has similar wording at section "2.14. ASYNCHRONOUS
> +         * QUERIES", page 94.
> +         *
> +         * Hence, trying to call BeginQuery on a query object which has already
> +         * been bound to a different target should return GL_INVALID_OPERATION.
> +         */
> +	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;
> @@ -124,6 +165,10 @@ test_error_end_wrong_target(void)
>  	glEndQuery(GL_SAMPLES_PASSED);
>  	piglit_reset_gl_error();
>  
> +	glDeleteQueries(1, &oq);
> +
> +	glGenQueries(1, &oq);
> +
>  	glBeginQuery(GL_ANY_SAMPLES_PASSED, oq);
>  	if (!piglit_check_gl_error(0))
>  		pass = false;
> @@ -191,6 +236,9 @@ test_current_query(void)
>  		pass = false;
>  	}
>  	glEndQuery(GL_ANY_SAMPLES_PASSED);
> +	glDeleteQueries(1, &oq);
> +
> +	glGenQueries(1, &oq);
>  
>  	/* Test the result for GL_SAMPLES_PASSED active */
>  	glBeginQuery(GL_SAMPLES_PASSED, oq);
> @@ -226,6 +274,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;
>  
>
On 02/11/2015 12:28 AM, Emil Velikov wrote:
> I'm guessing that this was meant for the piglit ML - Cc-ing it :)
> 

Oh, sorry for the mistake and thank you Emil!

cheers,
Eduardo