You should do failure-prone allocation in create_query, not begin, anyway.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4356>
fd_begin_query(struct pipe_context *pctx, struct pipe_query *pq)
{
struct fd_query *q = fd_query(pq);
- bool ret;
if (q->active)
return false;
- ret = q->funcs->begin_query(fd_context(pctx), q);
- q->active = ret;
+ q->funcs->begin_query(fd_context(pctx), q);
+ q->active = true;
- return ret;
+ return true;
}
static bool
struct fd_query_funcs {
void (*destroy_query)(struct fd_context *ctx,
struct fd_query *q);
- bool (*begin_query)(struct fd_context *ctx, struct fd_query *q);
+ void (*begin_query)(struct fd_context *ctx, struct fd_query *q);
void (*end_query)(struct fd_context *ctx, struct fd_query *q);
bool (*get_query_result)(struct fd_context *ctx,
struct fd_query *q, bool wait,
fd_bo_cpu_fini(rsc->bo);
}
-static bool
+static void
fd_acc_begin_query(struct fd_context *ctx, struct fd_query *q)
{
struct fd_batch *batch = fd_context_batch(ctx);
/* add to active list: */
assert(list_is_empty(&aq->node));
list_addtail(&aq->node, &ctx->acc_active_queries);
-
- return true;
}
static void
free(hq);
}
-static bool
+static void
fd_hw_begin_query(struct fd_context *ctx, struct fd_query *q)
{
struct fd_batch *batch = fd_context_batch(ctx);
/* add to active list: */
assert(list_is_empty(&hq->list));
list_addtail(&hq->list, &ctx->hw_active_queries);
-
- return true;
}
static void
}
}
-static bool
+static void
fd_sw_begin_query(struct fd_context *ctx, struct fd_query *q)
{
struct fd_sw_query *sq = fd_sw_query(q);
} else if (is_draw_rate_query(q)) {
sq->begin_time = ctx->stats.draw_calls;
}
- return true;
}
static void