From: Roland Scheidegger Date: Fri, 23 Aug 2013 19:25:01 +0000 (+0200) Subject: llvmpipe: support nested/overlapping queries for all query types X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aff2ecf09a92eb79eef560f17d77badf69782e7c;p=mesa.git llvmpipe: support nested/overlapping queries for all query types There's just no way resetting the counters is working with nested/overlapping queries. Reviewed-by: Brian Paul --- diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index cea2d07394e..4fb707b0233 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -154,7 +154,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe, *result = pq->num_primitives_written; break; case PIPE_QUERY_SO_OVERFLOW_PREDICATE: - vresult->b = pq->so_has_overflown; + vresult->b = pq->num_primitives_generated > pq->num_primitives_written; break; case PIPE_QUERY_SO_STATISTICS: { struct pipe_query_data_so_statistics *stats = @@ -204,21 +204,18 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) switch (pq->type) { case PIPE_QUERY_PRIMITIVES_EMITTED: - pq->num_primitives_written = 0; - llvmpipe->so_stats.num_primitives_written = 0; + pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; break; case PIPE_QUERY_PRIMITIVES_GENERATED: - pq->num_primitives_generated = 0; - llvmpipe->num_primitives_generated = 0; + pq->num_primitives_generated = llvmpipe->num_primitives_generated; break; case PIPE_QUERY_SO_STATISTICS: - pq->num_primitives_written = 0; - llvmpipe->so_stats.num_primitives_written = 0; - pq->num_primitives_generated = 0; - llvmpipe->num_primitives_generated = 0; + pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; + pq->num_primitives_generated = llvmpipe->num_primitives_generated; break; case PIPE_QUERY_SO_OVERFLOW_PREDICATE: - pq->so_has_overflown = FALSE; + pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; + pq->num_primitives_generated = llvmpipe->num_primitives_generated; break; case PIPE_QUERY_PIPELINE_STATISTICS: /* reset our cache */ @@ -251,18 +248,24 @@ llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) switch (pq->type) { case PIPE_QUERY_PRIMITIVES_EMITTED: - pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; + pq->num_primitives_written = + llvmpipe->so_stats.num_primitives_written - pq->num_primitives_written; break; case PIPE_QUERY_PRIMITIVES_GENERATED: - pq->num_primitives_generated = llvmpipe->num_primitives_generated; + pq->num_primitives_generated = + llvmpipe->num_primitives_generated - pq->num_primitives_generated; break; case PIPE_QUERY_SO_STATISTICS: - pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; - pq->num_primitives_generated = llvmpipe->num_primitives_generated; + pq->num_primitives_written = + llvmpipe->so_stats.num_primitives_written - pq->num_primitives_written; + pq->num_primitives_generated = + llvmpipe->num_primitives_generated - pq->num_primitives_generated; break; case PIPE_QUERY_SO_OVERFLOW_PREDICATE: - pq->so_has_overflown = (llvmpipe->num_primitives_generated > - llvmpipe->so_stats.num_primitives_written); + pq->num_primitives_written = + llvmpipe->so_stats.num_primitives_written - pq->num_primitives_written; + pq->num_primitives_generated = + llvmpipe->num_primitives_generated - pq->num_primitives_generated; break; case PIPE_QUERY_PIPELINE_STATISTICS: pq->stats.ia_vertices = diff --git a/src/gallium/drivers/llvmpipe/lp_query.h b/src/gallium/drivers/llvmpipe/lp_query.h index 62ad5fde188..cd47fb0f4cf 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.h +++ b/src/gallium/drivers/llvmpipe/lp_query.h @@ -48,7 +48,6 @@ struct llvmpipe_query { unsigned type; /* PIPE_QUERY_* */ unsigned num_primitives_generated; unsigned num_primitives_written; - boolean so_has_overflown; struct pipe_query_data_pipeline_statistics stats; }; diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c index 1ea6bcf5b00..9e69591116a 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c @@ -542,7 +542,7 @@ lp_setup_so_info(struct vbuf_render *vbr, uint primitives, uint vertices, struct llvmpipe_context *lp = llvmpipe_context(setup->pipe); lp->so_stats.num_primitives_written += primitives; - lp->so_stats.primitives_storage_needed = + lp->so_stats.primitives_storage_needed += vertices * 4 /*sizeof(float|int32)*/ * 4 /*x,y,z,w*/; lp->num_primitives_generated += prim_generated; }