From: Brian Paul Date: Sat, 27 Aug 2005 14:04:37 +0000 (+0000) Subject: check the Ready flag when getting GL_QUERY_RESULT_ARB X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=082501a74c16d7b16ea4fb17b3d47aa24d05f4e3;p=mesa.git check the Ready flag when getting GL_QUERY_RESULT_ARB --- diff --git a/src/mesa/main/occlude.c b/src/mesa/main/occlude.c index 2f57a3cfe2e..e3c591defdd 100644 --- a/src/mesa/main/occlude.c +++ b/src/mesa/main/occlude.c @@ -51,6 +51,7 @@ new_query_object(GLenum target, GLuint id) q->Id = id; q->Result = 0; q->Active = GL_FALSE; + q->Ready = GL_TRUE; /* correct, see spec */ } return q; } @@ -297,6 +298,13 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) switch (pname) { case GL_QUERY_RESULT_ARB: + while (!q->Ready) { + /* Wait for the query to finish! */ + /* If using software rendering, the result will always be ready + * by time we get here. Otherwise, we must be using hardware! + */ + ASSERT(ctx->Driver.EndQuery); + } *params = q->Result; break; case GL_QUERY_RESULT_AVAILABLE_ARB: @@ -328,6 +336,13 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) switch (pname) { case GL_QUERY_RESULT_ARB: + while (!q->Ready) { + /* Wait for the query to finish! */ + /* If using software rendering, the result will always be ready + * by time we get here. Otherwise, we must be using hardware! + */ + ASSERT(ctx->Driver.EndQuery); + } *params = q->Result; break; case GL_QUERY_RESULT_AVAILABLE_ARB: