<div dir="ltr"><div><div><div>Hello Brian,<br><br></div>I will fix these errors and submit a patch by tomorrow.<br><br></div>Thanks,<br></div>Juliet<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 11, 2015 at 10:35 PM, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 09/11/2015 12:44 PM, Juliet Fru wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This test replaces the original glean toccluqry.cpp test.<br>
---<br>
tests/all.py | 1 +<br>
tests/spec/arb_occlusion_query/CMakeLists.gl.txt | 1 +<br>
.../arb_occlusion_query/occlusion_query_conform.c | 587 +++++++++++++++++++++<br>
3 files changed, 589 insertions(+)<br>
create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c<br>
<br>
diff --git a/tests/all.py b/tests/all.py<br>
index fe088f5..748165f 100644<br>
--- a/tests/all.py<br>
+++ b/tests/all.py<br>
@@ -2115,6 +2115,7 @@ with profile.group_manager(<br>
PiglitGLTest,<br>
grouptools.join('spec', 'ARB_occlusion_query')) as g:<br>
g(['occlusion_query'])<br>
+ g(['occlusion_query_conformance'])<br>
g(['occlusion_query_lifetime'])<br>
g(['occlusion_query_meta_fragments'])<br>
g(['occlusion_query_meta_no_fragments'])<br>
diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt<br>
index 01a499d..23a19e4 100644<br>
--- a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt<br>
@@ -10,6 +10,7 @@ link_libraries (<br>
)<br>
<br>
piglit_add_executable (occlusion_query occlusion_query.c)<br>
+piglit_add_executable (occlusion_query_conformance occlusion_query_conform.c)<br>
piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c)<br>
piglit_add_executable (occlusion_query_meta_no_fragments occlusion_query_meta_no_fragments.c)<br>
piglit_add_executable (occlusion_query_meta_fragments occlusion_query_meta_fragments.c)<br>
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c b/tests/spec/arb_occlusion_query/occlusion_query_conform.c<br>
new file mode 100644<br>
index 0000000..d6d5ea4<br>
--- /dev/null<br>
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c<br>
@@ -0,0 +1,587 @@<br>
+/* BEGIN_COPYRIGHT -*- glean -*-<br>
+ *<br>
+ * Copyright (C) 1999 Allen Akin All Rights Reserved.<br>
+ * Copyright (C) 2015 Intel Corporation.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
+ * DEALINGS IN THE SOFTWARE.<br>
+ *<br>
+ * END_COPYRIGHT<br>
+ */<br>
+<br>
+/** @file occlusion_query_conform.c<br>
+ *<br>
+ * Conformance test on ARB_occlusion_query extension.<br>
+ *<br>
+ * Authors:<br>
+ * Wei Wang <<a href="mailto:wei.z.wang@intel.com" target="_blank">wei.z.wang@intel.com</a>><br>
+ * Adapted to Piglit by Juliet Fru <<a href="mailto:julietfru@gmail.com" target="_blank">julietfru@gmail.com</a>>, September 2015<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+#include <stdlib.h><br>
+#include <assert.h><br>
+#include <string.h><br>
+#include <stdio.h><br>
+#include <math.h><br>
+#include <time.h><br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;<br>
+<br>
+<br>
+config.window_width = 160;<br>
+config.window_height = 160;<br>
+config.window_visual =<br>
+ PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |<br>
+ PIGLIT_GL_VISUAL_DEPTH;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END static GLuint<br>
+find_unused_id(void)<br>
+{<br>
</blockquote>
<br></div></div>
Looks like the formatting got really messed up there. It should be something like:<br>
<br>
...<br>
PIGLIT_GL_TEST_CONFIG_END<br>
<br>
<br>
static GLuint<br>
find_unused_id(void)<br>
{<br>
...<div><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ GLuint id;<br>
+ glGenQueries(1, &id);<br>
+ return id;<br>
+<br>
+}<br>
+<br>
+/* If multiple queries are issued on the same target and id prior to calling<br>
+ * GetQueryObject[u]iVARB, the result returned will always be from the last<br>
+ * query issued. The results from any queries before the last one will be lost<br>
+ * if the results are not retrieved before starting a new query on the same<br>
+ * target and id.<br>
+ */<br>
+static bool<br>
+conformOQ_GetObjivAval_multi1(GLuint id)<br>
+{<br>
+ GLint ready;<br>
+ GLuint passed = 0;<br>
+<br>
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<br>
+<br>
+ glMatrixMode(GL_PROJECTION);<br>
+ glPushMatrix();<br>
+ glLoadIdentity();<br>
+ glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);<br>
+<br>
+ glMatrixMode(GL_MODELVIEW);<br>
+ glPushMatrix();<br>
+ glLoadIdentity();<br>
+ glTranslatef(0.0, 0.0, -10.0);<br>
+<br>
+ /* draw the occluder (red) */<br>
+ glColorMask(1, 1, 1, 1);<br>
+ glDepthMask(GL_TRUE);<br>
+ glColor3f(1, 0, 0);<br>
+ piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);<br>
+<br>
+ glPushMatrix();<br>
+ glTranslatef(0.0, 0.0, -5.0);<br>
+ glColorMask(0, 0, 0, 0);<br>
+ glDepthMask(GL_FALSE);<br>
+<br>
+ /* draw the 1st box (gren) which is occluded by the occluder partly */<br>
+ glColor3f(0, 1, 0);<br>
+ piglit_draw_rect(-0.51, 0.51, 0.51, -0.51);<br>
+<br>
+ /* draw the 2nd box (blue) which is occluded by the occluder throughly */<br>
+ glColor3f(0, 0, 1);<br>
+ piglit_draw_rect(-0.4, 0.4, 0.4, -0.4);<br>
+<br>
+ glPopMatrix();<br>
+<br>
+ glPopMatrix();<br>
+ glMatrixMode(GL_PROJECTION);<br>
+ glPopMatrix();<br>
+<br>
+ do {<br>
+ glGetQueryObjectivARB(id, GL_QUERY_RESULT_AVAILABLE_ARB,<br>
+ &ready);<br>
+ } while (!ready);<br>
+ glGetQueryObjectuivARB(id, GL_QUERY_RESULT_ARB, &passed);<br>
+<br>
+ /* 'passed' should be zero */<br>
+ return passed > 0 ? false : true;<br>
+}<br>
+<br>
+/* If mutiple queries are issued on the same target and diff ids prior<br>
+ * to calling GetQueryObject[u]iVARB, the results should be<br>
+ * corresponding to those queries (ids) respectively.<br>
+ */<br>
+static bool<br>
+conformOQ_GetObjivAval_multi2(void)<br>
+{<br>
+ GLuint passed1 = 0, passed2 = 0, passed3 = 0;<br>
+ GLuint id1, id2, id3;<br>
+<br>
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<br>
+<br>
+ glMatrixMode(GL_PROJECTION);<br>
+ glPushMatrix();<br>
+ glLoadIdentity();<br>
+ glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 25.0);<br>
+<br>
+ glMatrixMode(GL_MODELVIEW);<br>
+ glPushMatrix();<br>
+ glLoadIdentity();<br>
+ glTranslatef(0.0, 0.0, -10.0);<br>
+<br>
+<br>
+ /* draw the occluder (red) */<br>
+ glColorMask(1, 1, 1, 1);<br>
+ glDepthMask(GL_TRUE);<br>
+ glColor3f(1, 0, 0);<br>
+ piglit_draw_rect(-0.5, 0.5, 0.5, -0.5);<br>
+<br>
+ glPushMatrix();<br>
+ glTranslatef(0.0, 0.0, -5.0);<br>
+ glColorMask(0, 0, 0, 0);<br>
+ glDepthMask(GL_FALSE);<br>
+<br>
+ id1 = find_unused_id();<br>
</blockquote>
<br></div></div>
Here, you removed the START_QUERY(id1); macro call, but you forgot to replace it with the body of the macro:<br>
<br>
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id1);<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ /* draw green quad, much larger than occluder */<br>
+ glColor3f(0, 1, 0);<br>
+ piglit_draw_rect(-0.7, 0.7, 0.7, -0.7);<br>
</blockquote>
<br></span>
And here, you dropped TERM_QUERY(); and forgot to insert the code:<br>
<br>
glEndQueryARB(GL_SAMPLES_PASSED_ARB);<br>
<br>
Please compare your code to the original Glean test to be sure the same GL calls are being made to glBegin/EndQueryARB().<div><div class="h5"><br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+ id2 = find_unused_id();<br>
+ /* draw blue quad, slightly larger than occluder */<br>
+ glColor3f(0, 0, 1);<br>
+ piglit_draw_rect(-0.53, 0.53, 0.53, -0.53);<br>
+<br>
+<br>
+ id3 = find_unused_id();<br>
+ /* draw white quad, smaller than occluder (should not be visible) */<br>
+ glColor3f(1, 1, 1);<br>
+ piglit_draw_rect(-0.4, 0.4, 0.4, -0.4);<br>
+<br>
+<br>
+ glPopMatrix();<br>
+<br>
+ glGetQueryObjectuivARB(id1, GL_QUERY_RESULT_ARB, &passed1);<br>
+ glGetQueryObjectuivARB(id2, GL_QUERY_RESULT_ARB, &passed2);<br>
+ glGetQueryObjectuivARB(id3, GL_QUERY_RESULT_ARB, &passed3);<br>
+<br>
+ glDepthMask(GL_TRUE);<br>
+<br>
+<br>
+ glDeleteQueriesARB(1, &id1);<br>
+ glDeleteQueriesARB(1, &id2);<br>
+ glDeleteQueriesARB(1, &id3);<br>
+<br>
+ glPopMatrix();<br>
+ glMatrixMode(GL_PROJECTION);<br>
+ glPopMatrix();<br>
+<br>
+ if (passed1 > passed2 && passed2 > passed3 && passed3 == 0)<br>
+ return true;<br>
+ else<br>
+ return false;<br>
+}<br>
+<br>
+/*<br>
+ * void GetQueryivARB(enum target, enum pname, int *params);<br>
+ *<br>
+ * If <pname> is QUERY_COUNTER_BITS_ARB, the number of bits in the counter<br>
+ * for <target> will be placed in <params>. The minimum number of query<br>
+ * counter bits allowed is a function of the implementation's maximum<br>
+ * viewport dimensions (MAX_VIEWPORT_DIMS). If the counter is non-zero,<br>
+ * then the counter must be able to represent at least two overdraws for<br>
+ * every pixel in the viewport using only one sample buffer. The formula to<br>
+ * compute the allowable minimum value is below (where n is the minimum<br>
+ * number of bits):<br>
+ * n = (min (32, ceil (log2 (maxViewportWidth x maxViewportHeight x 2) ) ) ) or 0<br>
+ */<br>
+static bool<br>
+conformOQ_GetQry_CnterBit(void)<br>
+{<br>
+ int bit_num, dims[2];<br>
+ float min_impl, min_bit_num;<br>
+<br>
+ /* get the minimum bit number supported by the implementation,<br>
+ * and check the legality of result of GL_QUERY_COUNTER_BITS_ARB<br>
+ */<br>
+ glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB,<br>
+ &bit_num);<br>
+ glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);<br>
+ if ((!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ || (!piglit_check_gl_error(GL_INVALID_ENUM)))<br>
+ return false;<br>
+<br>
+ min_impl =<br>
+ ceil(logf((float) dims[0] * (float) dims[1] * 1.0 * 2.0) /<br>
+ logf(2.0));<br>
+ min_bit_num = 32.0 > min_impl ? min_impl : 32.0;<br>
+<br>
+ if ((float) bit_num < min_bit_num)<br>
+ return false;<br>
+<br>
+ return true;<br>
+}<br>
+<br>
+/* If BeginQueryARB is called with an unused <id>, that name is marked as used<br>
+ * and associated with a new query object.<br>
+ */<br>
+static bool<br>
+conformOQ_Begin_unused_id(void)<br>
+{<br>
+ unsigned int id;<br>
+ bool pass = true;<br>
+<br>
+ id = find_unused_id();<br>
+<br>
+ if (id == 0)<br>
+ return false;<br>
+<br>
+ glBeginQuery(GL_SAMPLES_PASSED_ARB, id);<br>
+<br>
+ if (glIsQueryARB(id) == GL_FALSE) {<br>
+ printf("Error : Begin with a unused id failed.");<br>
+ pass = false;<br>
+ }<br>
+<br>
+ glEndQuery(GL_SAMPLES_PASSED_ARB);<br>
+<br>
+ return pass;<br>
+}<br>
+<br>
+/* if EndQueryARB is called while no query with the same target is in progress,<br>
+ * an INVALID_OPERATION error is generated.<br>
+ */<br>
+static bool<br>
+conformOQ_EndAfter(GLuint id)<br>
+{<br>
+<br>
+ glEndQueryARB(GL_SAMPLES_PASSED_ARB);<br>
+<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ return false;<br>
+<br>
+ return true;<br>
+}<br>
+<br>
+/* Calling either GenQueriesARB while any query of any target is active<br>
+ * should not cause any error to be generated.<br>
+ */<br>
+static bool<br>
+conformOQ_GenIn(GLuint id)<br>
+{<br>
+ int pass = true;<br>
+<br>
+<br>
+ glGenQueriesARB(1, &id);<br>
+ if (glGetError() != GL_NO_ERROR) {<br>
</blockquote>
<br></div></div>
Let's replace that glGetError() test with a call to piglit_check_gl_error().<div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ printf(" Error: Error generated when GenQueries called "<br>
+ "in the progress of another.\n");<br>
+ pass = false;<br>
+ }<br>
+<br>
+<br>
+ return pass;<br>
+}<br>
+<br>
+/* Calling either DeleteQueriesARB while any query of any target is active<br>
+ * should not cause any error to be generated.<br>
+ */<br>
+static bool<br>
+conformOQ_DeleteIn(GLuint id)<br>
+{<br>
+ int pass = true;<br>
+ unsigned int another_id;<br>
+<br>
+<br>
+ if (id > 0) {<br>
+ glGenQueriesARB(1, &another_id);<br>
+ glDeleteQueriesARB(1, &another_id);<br>
+<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ pass = false;<br>
+ }<br>
+<br>
+<br>
+ return pass;<br>
+}<br>
+<br>
+/* If BeginQueryARB is called while another query is already in progress with<br>
+ * the same target, an INVALID_OPERATION error should be generated.<br>
+ */<br>
+static bool<br>
+conformOQ_BeginIn(GLuint id)<br>
+{<br>
+ int pass = true;<br>
+<br>
+<br>
+ /* Issue another BeginQueryARB while another query is already in progress */<br>
+ glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);<br>
+<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ pass = false;<br>
+<br>
+ return pass;<br>
+}<br>
+<br>
+/* if the query object named by <id> is currently active, then an<br>
+ * INVALID_OPERATION error is generated.<br>
+ */<br>
+static bool<br>
+conformOQ_GetObjAvalIn(GLuint id)<br>
+{<br>
+ int pass = true;<br>
+ GLint param;<br>
+<br>
+<br>
+ glGetQueryObjectivARB(id, GL_QUERY_RESULT_AVAILABLE_ARB, ¶m);<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ pass = false;<br>
+<br>
+ glGetQueryObjectuivARB(id, GL_QUERY_RESULT_AVAILABLE_ARB,<br>
+ (GLuint *) & param);<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ pass = false;<br>
+<br>
+ if (pass == false) {<br>
+ printf(" Error: No GL_INVALID_OPERATION generated if "<br>
+ "GetQueryObjectuiv with GL_QUERY_RESULT_AVAILABLE_ARB "<br>
+ "in the active progress.\n");<br>
+ }<br>
+<br>
+<br>
+ return pass;<br>
+}<br>
+<br>
+/* if the query object named by <id> is currently active, then an<br>
+ * INVALID_OPERATION error is generated. */<br>
+static bool<br>
+conformOQ_GetObjResultIn(GLuint id)<br>
+{<br>
+ int pass = true;<br>
+ GLint param;<br>
+<br>
+<br>
+ glGetQueryObjectivARB(id, GL_QUERY_RESULT_ARB, ¶m);<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ pass = false;<br>
+<br>
+ glGetQueryObjectuivARB(id, GL_QUERY_RESULT_ARB, (GLuint *) & param);<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ pass = false;<br>
+<br>
+ if (pass == false) {<br>
+ printf(" Error: No GL_INVALID_OPERATION generated if "<br>
+ "GetQueryObject[u]iv with GL_QUERY_RESULT_ARB "<br>
+ "in the active progress.\n");<br>
+ }<br>
+<br>
+ return pass;<br>
+}<br>
+<br>
+/* If <id> is not the name of a query object, then an INVALID_OPERATION error<br>
+ * is generated.<br>
+ */<br>
+static bool<br>
+conformOQ_GetObjivAval(GLuint id)<br>
+{<br>
+ GLuint id_tmp;<br>
+ GLint param;<br>
+<br>
+<br>
</blockquote>
<br></div></div>
Looks like glBegin/EndQuery calls were dropped here too.<div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ id_tmp = find_unused_id();<br>
+<br>
+ if (id_tmp == 0)<br>
+ return false;<br>
+<br>
+ glGetQueryObjectivARB(id_tmp, GL_QUERY_RESULT_AVAILABLE_ARB, ¶m);<br>
+<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ return false;<br>
+<br>
+ return true;<br>
+}<br>
+<br>
+/* Basic tests on query id generation and deletion */<br>
+static bool<br>
+conformOQ_Gen_Delete(unsigned int id_n)<br>
+{<br>
+ GLuint *ids1 = NULL, *ids2 = NULL;<br>
+ unsigned int i, j;<br>
+ bool pass = true;<br>
+<br>
+ ids1 = (GLuint *) malloc(id_n * sizeof(GLuint));<br>
+ ids2 = (GLuint *) malloc(id_n * sizeof(GLuint));<br>
+<br>
+ if (!ids1 || !ids2) {<br>
+ printf(" Error: Cannot alloc memory to pointer ids[12].\n");<br>
+ if (ids1)<br>
+ free(ids1);<br>
+ if (ids2)<br>
+ free(ids2);<br>
+ return false;<br>
+ }<br>
+<br>
+ glGenQueriesARB(id_n, ids1);<br>
+ glGenQueriesARB(id_n, ids2);<br>
+<br>
+ /* compare whether <id> generated during the previous 2 rounds are<br>
+ * duplicated */<br>
+ for (i = 0; i < id_n; i++) {<br>
+ for (j = 0; j < id_n; j++) {<br>
+ if (ids1[i] == ids2[j]) {<br>
+ char str[1000];<br>
+ sprintf(str, "ids1[%d] == ids2[%d] == %u.", i,<br>
+ j, ids1[i]);<br>
+ printf(" Error: %s\n", str);<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+ }<br>
+<br>
+ /* Note: the spec seems to indicate that glGenQueries reserves query<br>
+ * IDs but doesn't create query objects for those IDs. A query object<br>
+ * isn't created until they are used by glBeginQuery. So this part<br>
+ * of the test is invalid.<br>
+ */<br>
+#if 0<br>
+ /* Checkout whether the Query ID just generated is valid */<br>
+ for (i = 0; i < id_n; i++) {<br>
+ if (glIsQueryARB(ids1[i]) == GL_FALSE) {<br>
+ char str[1000];<br>
+ sprintf(str, "id [%d] just generated is not valid.",<br>
+ ids1[i]);<br>
+ printf(" Error: %s\n", str);<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+#endif<br>
+<br>
+ /* if <id> is a non-zero value that is not the name of a query object,<br>
+ * IsQueryARB returns FALSE.<br>
+ */<br>
+ glDeleteQueriesARB(id_n, ids1);<br>
+ for (i = 0; i < id_n; i++) {<br>
+ if (glIsQueryARB(ids1[i]) == GL_TRUE) {<br>
+ char str[1000];<br>
+ sprintf(str, "id [%d] just deleted is still valid.",<br>
+ ids1[i]);<br>
+ printf(" Error: %s\n", str);<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+<br>
+ /* Delete only for sanity purpose */<br>
+ glDeleteQueriesARB(id_n, ids2);<br>
+<br>
+ if (ids1)<br>
+ free(ids1);<br>
+ if (ids2)<br>
+ free(ids2);<br>
+<br>
+<br>
+ ids1 = (GLuint *) malloc(id_n * sizeof(GLuint));<br>
+ if (ids1 == NULL)<br>
+ return false;<br>
+<br>
+ for (i = 0; i < id_n; i++) {<br>
+ glGenQueriesARB(1, ids1 + i);<br>
+ for (j = 0; j < i; j++) {<br>
+ if (ids1[i] == ids1[j]) {<br>
+ char str[1000];<br>
+ sprintf(str, "duplicated id generated [%u]",<br>
+ ids1[i]);<br>
+ printf(" Error: %s\n", str);<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+ }<br>
+<br>
+ glDeleteQueriesARB(id_n, ids1);<br>
+ if (ids1)<br>
+ free(ids1);<br>
+<br>
+ return pass;<br>
+}<br>
+<br>
+/* If <id> is zero, IsQueryARB should return FALSE.*/<br>
+static bool<br>
+conformOQ_IsIdZero(void)<br>
+{<br>
+ if (glIsQueryARB(0) == GL_TRUE) {<br>
+ printf(" Error: zero is treated as a valid id by glIsQueryARB().\n");<br>
+ return false;<br>
+ }<br>
+<br>
+ return true;<br>
+}<br>
+<br>
+/* If BeginQueryARB is called with an <id> of zero, an INVALID_OPERATION error<br>
+ * should be generated.<br>
+ */<br>
+static bool<br>
+conformOQ_BeginIdZero(void)<br>
+{<br>
+ glBeginQueryARB(GL_SAMPLES_PASSED_ARB, 0);<br>
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION))<br>
+ return false;<br>
+<br>
+ return true;<br>
+}<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ glClearColor(0.0, 0.2, 0.3, 0.0);<br>
+ glClearDepth(1.0);<br>
+<br>
+ glEnable(GL_DEPTH_TEST);<br>
+ glDepthFunc(GL_LESS);<br>
+<br>
+ piglit_require_extension("GL_ARB_occlusion_query");<br>
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);<br>
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+ bool pass = true;<br>
+ GLuint queryId;<br>
+<br>
+ glEnable(GL_DEPTH_TEST);<br>
+ glGenQueriesARB(1, &queryId);<br>
+<br>
+ if (queryId == 0)<br>
+ return PIGLIT_FAIL;<br>
+<br>
+ pass = conformOQ_GetQry_CnterBit() && pass;<br>
</blockquote>
<br></div></div>
Again, all the following lines should follow the pattern:<br>
<br>
pass = test_somethin() && pass;<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ pass &= conformOQ_GetObjivAval_multi1(queryId);<br>
+ pass &= conformOQ_GetObjivAval_multi2();<br>
+ pass &= conformOQ_Begin_unused_id();<br>
+ pass &= conformOQ_EndAfter(queryId);<br>
+ pass &= conformOQ_GenIn(queryId);<br>
+ pass &= conformOQ_BeginIn(queryId);<br>
+ pass &= conformOQ_DeleteIn(queryId);<br>
+ pass &= conformOQ_GetObjAvalIn(queryId);<br>
+ pass &= conformOQ_GetObjResultIn(queryId);<br>
+ pass &= conformOQ_GetObjivAval(queryId);<br>
+ pass &= conformOQ_Gen_Delete(64);<br>
+ pass &= conformOQ_IsIdZero();<br>
+ pass &= conformOQ_BeginIdZero();<br>
+ glDeleteQueriesARB(1, &queryId);<br>
+<br>
+ piglit_present_results();<br>
+<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
<br>
</blockquote>
<br></div></div><span class="HOEnZb"><font color="#888888">
-Brian<br>
<br>
<br>
</font></span></blockquote></div><br></div>