#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 *
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) {
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) {
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);
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 */
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);
}