summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_query.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2013-08-23 21:25:01 +0200
committerRoland Scheidegger <[email protected]>2013-08-27 16:59:01 +0200
commitaff2ecf09a92eb79eef560f17d77badf69782e7c (patch)
tree4b2c089ad74bd5151a3a6090ef56edd32fa68ed4 /src/gallium/drivers/llvmpipe/lp_query.c
parent4900e625bd195021ec5577ae625685307c408910 (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/gallium/drivers/llvmpipe/lp_query.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.c35
1 files changed, 19 insertions, 16 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 =