diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index da460ecb172..c2bb9a396a0 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -33,121 +33,6 @@ #include "mtypes.h" #include "util/u_memory.h" - -/** - * Allocate a new query object. This is a fallback routine called via - * ctx->Driver.NewQueryObject(). - * \param ctx - rendering context - * \param id - the new object's ID - * \return pointer to new query_object object or NULL if out of memory. - */ -static struct gl_query_object * -_mesa_new_query_object(struct gl_context *ctx, GLuint id) -{ - struct gl_query_object *q = CALLOC_STRUCT(gl_query_object); - (void) ctx; - if (q) { - q->Id = id; - q->Result = 0; - q->Active = GL_FALSE; - - /* 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; -} - - -/** - * Begin a query. Software driver fallback. - * Called via ctx->Driver.BeginQuery(). - */ -static void -_mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q) -{ - ctx->NewState |= _NEW_DEPTH; /* for swrast */ -} - - -/** - * End a query. Software driver fallback. - * Called via ctx->Driver.EndQuery(). - */ -static void -_mesa_end_query(struct gl_context *ctx, struct gl_query_object *q) -{ - ctx->NewState |= _NEW_DEPTH; /* for swrast */ - q->Ready = GL_TRUE; -} - - -/** - * Wait for query to complete. Software driver fallback. - * Called via ctx->Driver.WaitQuery(). - */ -static void -_mesa_wait_query(struct gl_context *ctx, struct gl_query_object *q) -{ - /* For software drivers, _mesa_end_query() should have completed the query. - * For real hardware, implement a proper WaitQuery() driver function, - * which may require issuing a flush. - */ - assert(q->Ready); -} - - -/** - * Check if a query results are ready. Software driver fallback. - * Called via ctx->Driver.CheckQuery(). - */ -static void -_mesa_check_query(struct gl_context *ctx, struct gl_query_object *q) -{ - /* No-op for sw rendering. - * HW drivers may need to flush at this time. - */ -} - - -/** - * Delete a query object. Called via ctx->Driver.DeleteQuery(), if not - * overwritten by driver. In the latter case, called from the driver - * after all driver-specific clean-up has been done. - * Not removed from hash table here. - * - * \param ctx GL context to wich query object belongs. - * \param q query object due to be deleted. - */ -void -_mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q) -{ - free(q->Label); - free(q); -} - - -void -_mesa_init_query_object_functions(struct dd_function_table *driver) -{ - driver->NewQueryObject = _mesa_new_query_object; - driver->DeleteQuery = _mesa_delete_query; - driver->BeginQuery = _mesa_begin_query; - driver->EndQuery = _mesa_end_query; - driver->WaitQuery = _mesa_wait_query; - driver->CheckQuery = _mesa_check_query; -} - static struct gl_query_object ** get_pipe_stats_binding_point(struct gl_context *ctx, GLenum target) diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index ba8336b525a..92426a01b02 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -38,19 +38,12 @@ _mesa_lookup_query_object(struct gl_context *ctx, GLuint id) _mesa_HashLookupLocked(ctx->Query.QueryObjects, id); } - -extern void -_mesa_init_query_object_functions(struct dd_function_table *driver); - extern void _mesa_init_queryobj(struct gl_context *ctx); extern void _mesa_free_queryobj_data(struct gl_context *ctx); -extern void -_mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q); - void GLAPIENTRY _mesa_GenQueries(GLsizei n, GLuint *ids); void GLAPIENTRY diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index 2caca55fe7a..3ef17636923 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -85,8 +85,8 @@ st_DeleteQuery(struct gl_context *ctx, struct gl_query_object *q) struct st_query_object *stq = st_query_object(q); free_queries(pipe, stq); - - _mesa_delete_query(ctx, q); + free(stq->base.Label); + free(stq); } static int