diff options
author | Brian Paul <[email protected]> | 2005-08-27 14:04:37 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-08-27 14:04:37 +0000 |
commit | 082501a74c16d7b16ea4fb17b3d47aa24d05f4e3 (patch) | |
tree | 592ca9c2a06c463b121bfe159f634b797e58a4f7 /src/mesa/main/occlude.c | |
parent | 23ffc3a85d6172f8a98d17d7f23610bab808d84e (diff) |
check the Ready flag when getting GL_QUERY_RESULT_ARB
Diffstat (limited to 'src/mesa/main/occlude.c')
-rw-r--r-- | src/mesa/main/occlude.c | 15 |
1 files changed, 15 insertions, 0 deletions
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: |