stq->pq = pipe->create_query(pipe, type);
stq->type = type;
}
- pipe->begin_query(pipe, stq->pq);
+ if (stq->pq) {
+ pipe->begin_query(pipe, stq->pq);
+ }
+ else {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery");
+ return;
+ }
}
assert(stq->type == type);
}
stq->type = PIPE_QUERY_TIMESTAMP;
}
- pipe->end_query(pipe, stq->pq);
+ if (stq->pq)
+ pipe->end_query(pipe, stq->pq);
}
struct st_query_object *stq,
boolean wait)
{
+ if (!stq->pq) {
+ /* Only needed in case we failed to allocate the gallium query earlier.
+ * Return TRUE so we don't spin on this forever.
+ */
+ return TRUE;
+ }
+
if (!pipe->get_query_result(pipe,
stq->pq,
wait,