#include "pipe/p_defines.h"
#include "st_context.h"
#include "st_cb_queryobj.h"
-#include "st_public.h"
-
-
-struct st_query_object
-{
- struct gl_query_object base;
- struct pipe_query *pq;
-};
-
-
-/**
- * Cast wrapper
- */
-static struct st_query_object *
-st_query_object(struct gl_query_object *q)
-{
- return (struct st_query_object *) q;
-}
static struct gl_query_object *
st_NewQueryObject(GLcontext *ctx, GLuint id)
{
- struct st_query_object *stq = CALLOC_STRUCT(st_query_object);
+ struct st_query_object *stq = ST_CALLOC_STRUCT(st_query_object);
if (stq) {
stq->base.Id = id;
stq->base.Ready = GL_TRUE;
stq->pq = NULL;
}
- FREE(stq);
+ free(stq);
}
{
struct pipe_context *pipe = ctx->st->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);
}