<div dir="ltr"><div><div><div>Hello everyone,<br><br></div>Thanks for the suggestions, I will make the corrections and send in a new patch.<br><br></div>Regards,<br></div>Juliet<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 8, 2015 at 5:41 PM, Dylan Baker <span dir="ltr"><<a href="mailto:baker.dylan.c@gmail.com" target="_blank">baker.dylan.c@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">You'll need to add this to all.py as well</p>
<div class="gmail_quote"><div><div class="h5">On Sep 8, 2015 00:35, "Juliet Fru" <<a href="mailto:julietfru@gmail.com" target="_blank">julietfru@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">---<br>
 tests/spec/arb_occlusion_query/CMakeLists.gl.txt   |   1 +<br>
 .../arb_occlusion_query/occlusion_query_conform.c  | 676 +++++++++++++++++++++<br>
 2 files changed, 677 insertions(+)<br>
 create mode 100644 tests/spec/arb_occlusion_query/occlusion_query_conform.c<br>
<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..1d1f1e3<br>
--- /dev/null<br>
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c<br>
@@ -0,0 +1,676 @@<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>
+config.window_width = 180;<br>
+config.window_height = 100;<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<br>
+#define GL_GLEXT_PROTOTYPES<br>
+#define START_QUERY(id)\<br>
+       glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);<br>
+#define TERM_QUERY()\<br>
+       glEndQueryARB(GL_SAMPLES_PASSED_ARB);<br>
+/* Generate a box which will be occluded by the occluder */<br>
+       void<br>
+gen_box(GLfloat left, GLfloat right, GLfloat top, GLfloat btm)<br>
+{<br>
+       glBegin(GL_POLYGON);<br>
+       glVertex3f(left, top, 0);<br>
+       glVertex3f(right, top, 0);<br>
+       glVertex3f(right, btm, 0);<br>
+       glVertex3f(left, btm, 0);<br>
+       glEnd();<br>
+}<br>
+<br>
+bool<br>
+chk_ext()<br>
+{<br>
+       const char *ext = (const char *) glGetString(GL_EXTENSIONS);<br>
+<br>
+       if (!strstr(ext, "GL_ARB _occlusion_query")) {<br>
+               printf(" %s Warning: Extension GL_ARB_occlusion_query is missing.\n", ext);<br>
+               return false;<br>
+       }<br>
+<br>
+       return true;<br>
+}<br>
+<br>
+GLuint<br>
+find_unused_id()<br>
+{<br>
+       /* used the regular random number generator. */<br>
+       srand((unsigned) time(NULL));<br>
+       unsigned int id;<br>
+       int counter = 0;<br>
+<br>
+#define MAX_FIND_ID_ROUND 256<br>
+<br>
+       while (1) {<br>
+               /* assuming that at least 2^32-1 <id> can be generated */<br>
+               id = rand();<br>
+               if (id != 0 && glIsQueryARB(id) == GL_FALSE)<br>
+                       return id;<br>
+               if (++counter >= MAX_FIND_ID_ROUND) {<br>
+                       char str[1000];<br>
+                       sprintf(str,<br>
+                               "Cannot find the unused id after [%d] tries.",<br>
+                               MAX_FIND_ID_ROUND);<br>
+                       printf("Warning: %s\n", str);<br>
+                       return 0;<br>
+               }<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>
+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>
+       gen_box(-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>
+       START_QUERY(id);<br>
+       glColor3f(0, 1, 0);<br>
+       gen_box(-0.51, 0.51, 0.51, -0.51);<br>
+       TERM_QUERY();<br>
+<br>
+       /* draw the 2nd box (blue) which is occluded by the occluder throughly */<br>
+       START_QUERY(id);<br>
+       glColor3f(0, 0, 1);<br>
+       gen_box(-0.4, 0.4, 0.4, -0.4);<br>
+       TERM_QUERY();<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>
+bool<br>
+conformOQ_GetObjivAval_multi2()<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>
+       gen_box(-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>
+       START_QUERY(id1);<br>
+       /* draw green quad, much larger than occluder */<br>
+       glColor3f(0, 1, 0);<br>
+       gen_box(-0.7, 0.7, 0.7, -0.7);<br>
+       TERM_QUERY();<br>
+<br>
+       id2 = find_unused_id();<br>
+       START_QUERY(id2);<br>
+       /* draw blue quad, slightly larger than occluder */<br>
+       glColor3f(0, 0, 1);<br>
+       gen_box(-0.53, 0.53, 0.53, -0.53);<br>
+       TERM_QUERY();<br>
+<br>
+       id3 = find_unused_id();<br>
+       START_QUERY(id3);<br>
+       /* draw white quad, smaller than occluder (should not be visible) */<br>
+       glColor3f(1, 1, 1);<br>
+       gen_box(-0.4, 0.4, 0.4, -0.4);<br>
+       TERM_QUERY();<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>
+bool<br>
+conformOQ_GetQry_CnterBit()<br>
+{<br>
+       int bit_num, dims[2];<br>
+       GLenum err;<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>
+       err = glGetError();<br>
+       if (err == GL_INVALID_OPERATION || err == 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>
+bool<br>
+conformOQ_Begin_unused_id()<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>
+bool<br>
+conformOQ_EndAfter(GLuint id)<br>
+{<br>
+       START_QUERY(id);<br>
+       TERM_QUERY();<br>
+<br>
+       glEndQueryARB(GL_SAMPLES_PASSED_ARB);<br>
+<br>
+       if (glGetError() != GL_INVALID_OPERATION) {<br>
+               printf(" Error: No GL_INVALID_OPERATION generated if "<br>
+                      "EndQuery when there is no queries.\n");<br>
+               return false;<br>
+       }<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>
+bool<br>
+conformOQ_GenIn(GLuint id)<br>
+{<br>
+       int pass = true;<br>
+<br>
+       START_QUERY(id);<br>
+<br>
+       glGenQueriesARB(1, &id);<br>
+       if (glGetError() != GL_NO_ERROR) {<br>
+               printf(" Error: Error generated when GenQueries called "<br>
+                      "in the progress of another.\n");<br>
+               pass = false;<br>
+       }<br>
+<br>
+       TERM_QUERY();<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>
+bool<br>
+conformOQ_DeleteIn(GLuint id)<br>
+{<br>
+       int pass = true;<br>
+       unsigned int another_id;<br>
+<br>
+       START_QUERY(id);<br>
+<br>
+       if (id > 0) {<br>
+               glGenQueriesARB(1, &another_id);<br>
+               glDeleteQueriesARB(1, &another_id);<br>
+<br>
+               if (glGetError() != GL_NO_ERROR) {<br>
+                       printf(" Error: Error generated when DeleteQueries called " "in the progress of another.\n");<br>
+                       pass = false;<br>
+               }<br>
+       }<br>
+<br>
+       TERM_QUERY();<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>
+bool<br>
+conformOQ_BeginIn(GLuint id)<br>
+{<br>
+       int pass = true;<br>
+<br>
+       START_QUERY(id);<br>
+<br>
+       /* Issue another BeginQueryARB while another query is already in progress */<br>
+       glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);<br>
+<br>
+       if (glGetError() != GL_INVALID_OPERATION) {<br>
+               printf(" Error: No GL_INVALID_OPERATION generated if "<br>
+                      "BeginQuery in the progress of another.\n");<br>
+               pass = false;<br>
+       }<br>
+<br>
+       TERM_QUERY();<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>
+bool<br>
+conformOQ_GetObjAvalIn(GLuint id)<br>
+{<br>
+       int pass = true;<br>
+       GLint param;<br>
+<br>
+       START_QUERY(id);<br>
+<br>
+       glGetQueryObjectivARB(id, GL_QUERY_RESULT_AVAILABLE_ARB, &param);<br>
+       if (glGetError() != GL_INVALID_OPERATION)<br>
+               pass = false;<br>
+<br>
+       glGetQueryObjectuivARB(id, GL_QUERY_RESULT_AVAILABLE_ARB,<br>
+                              (GLuint *) & param);<br>
+       if (glGetError() != 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>
+       TERM_QUERY();<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>
+bool<br>
+conformOQ_GetObjResultIn(GLuint id)<br>
+{<br>
+       int pass = true;<br>
+       GLint param;<br>
+<br>
+       START_QUERY(id);<br>
+<br>
+       glGetQueryObjectivARB(id, GL_QUERY_RESULT_ARB, &param);<br>
+       if (glGetError() != GL_INVALID_OPERATION)<br>
+               pass = false;<br>
+<br>
+       glGetQueryObjectuivARB(id, GL_QUERY_RESULT_ARB, (GLuint *) & param);<br>
+       if (glGetError() != 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>
+       TERM_QUERY();<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>
+bool<br>
+conformOQ_GetObjivAval(GLuint id)<br>
+{<br>
+       GLuint id_tmp;<br>
+       GLint param;<br>
+<br>
+       START_QUERY(id);<br>
+       TERM_QUERY();<br>
+<br>
+       id_tmp = find_unused_id();<br>
+<br>
+       if (id_tmp == 0)<br>
+               return false;<br>
+<br>
+       glGetQueryObjectivARB(id_tmp, GL_QUERY_RESULT_AVAILABLE_ARB, &param);<br>
+<br>
+       if (glGetError() != GL_INVALID_OPERATION) {<br>
+               printf(" Error: No GL_INVALID_OPERATION generated if "<br>
+                      "GetQueryObjectuiv can still query the result"<br>
+                      "by an unused query id. \n");<br>
+               return false;<br>
+       }<br>
+<br>
+       return true;<br>
+}<br>
+<br>
+/* Basic tests on query id generation and deletion */<br>
+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>
+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>
+bool<br>
+conformOQ_BeginIdZero(void)<br>
+{<br>
+       glBeginQueryARB(GL_SAMPLES_PASSED_ARB, 0);<br>
+       if (glGetError() != GL_INVALID_OPERATION) {<br>
+               printf(" Error: No GL_INVALID_OPERATION generated if "<br>
+                      "BeginQuery with zero ID.");<br>
+               return false;<br>
+       }<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>
+       if (!chk_ext())<br>
+               return PIGLIT_FAIL;<br>
+       glEnable(GL_DEPTH_TEST);<br>
+       glGenQueriesARB(1, &queryId);<br>
+<br>
+       if (queryId == 0)<br>
+               return PIGLIT_FAIL;<br>
+<br>
+#if defined(GL_ARB_occlusion_query)<br>
+       pass &= conformOQ_GetQry_CnterBit();<br>
+       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>
+#endif<br>
+<br>
+       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
--<br>
2.4.3<br>
<br></div></div>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</blockquote></div>
</blockquote></div><br></div>