Merge branch '7.8'
[mesa.git] / src / mesa / state_tracker / st_cb_queryobj.c
index 2281d10e99960c5b4c3f9f9792dac628a151ffb0..1896663932c7a617ca9e1a156f768cc5dac67c90 100644 (file)
@@ -61,7 +61,7 @@ st_NewQueryObject(GLcontext *ctx, GLuint id)
 static void
 st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q)
 {
-   struct pipe_context *pipe = ctx->st->pipe;
+   struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_query_object *stq = st_query_object(q);
 
    if (stq->pq) {
@@ -69,14 +69,14 @@ st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q)
       stq->pq = NULL;
    }
 
-   _mesa_free(stq);
+   free(stq);
 }
 
 
 static void
 st_BeginQuery(GLcontext *ctx, struct gl_query_object *q)
 {
-   struct pipe_context *pipe = ctx->st->pipe;
+   struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_query_object *stq = st_query_object(q);
 
    switch (q->Target) {
@@ -96,7 +96,7 @@ st_BeginQuery(GLcontext *ctx, struct gl_query_object *q)
 static void
 st_EndQuery(GLcontext *ctx, struct gl_query_object *q)
 {
-   struct pipe_context *pipe = ctx->st->pipe;
+   struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_query_object *stq = st_query_object(q);
 
    pipe->end_query(pipe, stq->pq);
@@ -106,7 +106,7 @@ st_EndQuery(GLcontext *ctx, struct gl_query_object *q)
 static void
 st_WaitQuery(GLcontext *ctx, struct gl_query_object *q)
 {
-   struct pipe_context *pipe = ctx->st->pipe;
+   struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_query_object *stq = st_query_object(q);
 
    /* this function should only be called if we don't have a ready result */
@@ -128,15 +128,10 @@ st_WaitQuery(GLcontext *ctx, struct gl_query_object *q)
 static void
 st_CheckQuery(GLcontext *ctx, struct gl_query_object *q)
 {
-   struct pipe_context *pipe = ctx->st->pipe;
+   struct pipe_context *pipe = st_context(ctx)->pipe;
    struct st_query_object *stq = st_query_object(q);
-
-   if (!q->Ready) {
-      q->Ready = pipe->get_query_result(pipe, 
-                                       stq->pq,
-                                       FALSE,
-                                       &q->Result);
-   }
+   assert(!q->Ready);   /* we should not get called if Ready is TRUE */
+   q->Ready = pipe->get_query_result(pipe, stq->pq, FALSE, &q->Result);
 }