aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/queryobj.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-16 08:45:43 +0100
committermarha <marha@users.sourceforge.net>2013-01-16 08:45:43 +0100
commitb8219a4680768e14b7fe4930adf86e9be261b31f (patch)
tree193855ef8d48765d67cc11153a15e3c1e2568e50 /mesalib/src/mesa/main/queryobj.c
parent15cdb95b194cb051a5d469cc9eb73eb0eed4db41 (diff)
parent811d1bcf6d61ea49551abdd7f2294c5af2776913 (diff)
downloadvcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.tar.gz
vcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.tar.bz2
vcxsrv-b8219a4680768e14b7fe4930adf86e9be261b31f.zip
Merge remote-tracking branch 'origin/released'
* origin/released: Switched to xcalc-1.0.5 Switched to bdftopcf-1.0.4 libxtrans fontconfig glproto libX11 libXau libXext libXft libXinerama libXmu libfontenc mesa xkeyboard-config
Diffstat (limited to 'mesalib/src/mesa/main/queryobj.c')
-rw-r--r--mesalib/src/mesa/main/queryobj.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index 054dfbad7..bd7d0d297 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -50,7 +50,20 @@ _mesa_new_query_object(struct gl_context *ctx, GLuint id)
q->Id = id;
q->Result = 0;
q->Active = GL_FALSE;
- q->Ready = GL_TRUE; /* correct, see spec */
+
+ /* This is to satisfy the language of the specification: "In the initial
+ * state of a query object, the result is available" (OpenGL 3.1 §
+ * 2.13).
+ */
+ q->Ready = GL_TRUE;
+
+ /* OpenGL 3.1 § 2.13 says about GenQueries, "These names are marked as
+ * used, but no object is associated with them until the first time they
+ * are used by BeginQuery." Since our implementation actually does
+ * allocate an object at this point, use a flag to indicate that this
+ * object has not yet been bound so should not be considered a query.
+ */
+ q->EverBound = GL_FALSE;
}
return q;
}
@@ -252,16 +265,22 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids)
GLboolean GLAPIENTRY
_mesa_IsQuery(GLuint id)
{
+ struct gl_query_object *q;
+
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glIsQuery(%u)\n", id);
- if (id && _mesa_lookup_query_object(ctx, id))
- return GL_TRUE;
- else
+ if (id == 0)
return GL_FALSE;
+
+ q = _mesa_lookup_query_object(ctx, id);
+ if (q == NULL)
+ return GL_FALSE;
+
+ return q->EverBound;
}
static GLboolean
@@ -354,6 +373,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
q->Active = GL_TRUE;
q->Result = 0;
q->Ready = GL_FALSE;
+ q->EverBound = GL_TRUE;
/* XXX should probably refcount query objects */
*bindpt = q;