diff options
author | Roland Scheidegger <[email protected]> | 2013-08-23 21:25:01 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-08-27 16:59:01 +0200 |
commit | aff2ecf09a92eb79eef560f17d77badf69782e7c (patch) | |
tree | 4b2c089ad74bd5151a3a6090ef56edd32fa68ed4 /src | |
parent | 4900e625bd195021ec5577ae625685307c408910 (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_query.c | 35 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_query.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup_vbuf.c | 2 |
3 files changed, 20 insertions, 18 deletions
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; } |