diff options
author | Keith Whitwell <[email protected]> | 2007-12-11 17:10:26 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2007-12-11 17:10:48 +0000 |
commit | 13699463a33c1adf44005125c488e886e074a05b (patch) | |
tree | cb9e0b85f96fd931f87d3b1fc813723013d2a2b7 /src/mesa/main | |
parent | b247ab036327d66b8b9b1aff2dbcf4520ed0284f (diff) |
Rework gallium and mesa queries a little.
Add a 'CheckQuery()' driver callback to mesa to check query completion.
Make pipe_query an opaque type.
Rework softpipe queries, support overlapping occlusion queries.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/dd.h | 2 | ||||
-rw-r--r-- | src/mesa/main/queryobj.c | 18 | ||||
-rw-r--r-- | src/mesa/main/queryobj.h | 3 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index f089fcb48f0..3bec3bd4331 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -811,8 +811,10 @@ struct dd_function_table { */ /*@{*/ struct gl_query_object * (*NewQueryObject)(GLcontext *ctx, GLuint id); + void (*DeleteQuery)(GLcontext *ctx, struct gl_query_object *q); void (*BeginQuery)(GLcontext *ctx, struct gl_query_object *q); void (*EndQuery)(GLcontext *ctx, struct gl_query_object *q); + void (*CheckQuery)(GLcontext *ctx, struct gl_query_object *q); void (*WaitQuery)(GLcontext *ctx, struct gl_query_object *q); /*@}*/ diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 688d0fc7bcd..e30f5480da3 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -94,8 +94,8 @@ _mesa_wait_query(GLcontext *ctx, struct gl_query_object *q) * Not removed from hash table here. * XXX maybe add Delete() method to gl_query_object class and call that instead */ -static void -delete_query_object(struct gl_query_object *q) +void +_mesa_delete_query(struct gl_query_object *q) { _mesa_free(q); } @@ -171,7 +171,7 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids) if (q) { ASSERT(!q->Active); /* should be caught earlier */ _mesa_HashRemove(ctx->Query.QueryObjects, ids[i]); - delete_query_object(q); + ctx->Driver.DeleteQuery(ctx, q); } } } @@ -386,6 +386,8 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params) } break; case GL_QUERY_RESULT_AVAILABLE_ARB: + if (!q->Ready) + ctx->Driver.CheckQuery( ctx, q ); *params = q->Ready; break; default: @@ -424,6 +426,8 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) } break; case GL_QUERY_RESULT_AVAILABLE_ARB: + if (!q->Ready) + ctx->Driver.CheckQuery( ctx, q ); *params = q->Ready; break; default: @@ -461,6 +465,8 @@ _mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params) *params = q->Result; break; case GL_QUERY_RESULT_AVAILABLE_ARB: + if (!q->Ready) + ctx->Driver.CheckQuery( ctx, q ); *params = q->Ready; break; default: @@ -496,6 +502,8 @@ _mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params) *params = q->Result; break; case GL_QUERY_RESULT_AVAILABLE_ARB: + if (!q->Ready) + ctx->Driver.CheckQuery( ctx, q ); *params = q->Ready; break; default: @@ -527,8 +535,8 @@ static void delete_queryobj_cb(GLuint id, void *data, void *userData) { struct gl_query_object *q= (struct gl_query_object *) data; - (void) userData; - delete_query_object(q); + GLcontext *ctx = (GLcontext *)userData; + ctx->Driver.DeleteQuery(ctx, q); } diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index d466aae6520..c05a1f3da82 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -37,6 +37,9 @@ extern void _mesa_free_query_data(GLcontext *ctx); extern void +_mesa_delete_query(struct gl_query_object *q); + +extern void _mesa_begin_query(GLcontext *ctx, struct gl_query_object *q); extern void |