aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe/sp_query.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2013-08-23 21:23:07 +0200
committerRoland Scheidegger <[email protected]>2013-08-27 16:58:20 +0200
commit4900e625bd195021ec5577ae625685307c408910 (patch)
tree12eb36566c0df807638878ae1f3aa10c4f40802e /src/gallium/drivers/softpipe/sp_query.c
parentd8ac987f6ab228df1a478b36c3d889992754374f (diff)
softpipe: 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/softpipe/sp_query.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_query.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index daeef53b86f..ca15f03464d 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -99,22 +99,17 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
sq->start = os_time_get_nano();
break;
case PIPE_QUERY_SO_STATISTICS:
- sq->so.primitives_storage_needed = 0;
- sq->num_primitives_generated = 0;
- softpipe->num_primitives_generated = 0;
- sq->so.num_primitives_written = 0;
- softpipe->so_stats.num_primitives_written = 0;
+ sq->so.num_primitives_written = softpipe->so_stats.num_primitives_written;
+ sq->so.primitives_storage_needed = softpipe->num_primitives_generated;
break;
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
sq->end = FALSE;
break;
case PIPE_QUERY_PRIMITIVES_EMITTED:
- sq->so.num_primitives_written = 0;
- softpipe->so_stats.num_primitives_written = 0;
+ sq->so.num_primitives_written = softpipe->so_stats.num_primitives_written;
break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
- sq->num_primitives_generated = 0;
- softpipe->num_primitives_generated = 0;
+ sq->num_primitives_generated = softpipe->num_primitives_generated;
break;
case PIPE_QUERY_TIMESTAMP:
case PIPE_QUERY_GPU_FINISHED:
@@ -158,21 +153,25 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
sq->end = os_time_get_nano();
break;
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
- sq->end = (softpipe->num_primitives_generated >
- softpipe->so_stats.num_primitives_written);
+ sq->so.num_primitives_written =
+ softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
+ sq->num_primitives_generated =
+ softpipe->num_primitives_generated - sq->num_primitives_generated;
+ sq->end = sq->num_primitives_generated > sq->so.num_primitives_written;
break;
case PIPE_QUERY_SO_STATISTICS:
- sq->num_primitives_generated =
- softpipe->num_primitives_generated;
sq->so.num_primitives_written =
- softpipe->so_stats.num_primitives_written;
+ softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
+ sq->so.primitives_storage_needed =
+ softpipe->num_primitives_generated - sq->so.primitives_storage_needed;
break;
case PIPE_QUERY_PRIMITIVES_EMITTED:
sq->so.num_primitives_written =
- softpipe->so_stats.num_primitives_written;
+ softpipe->so_stats.num_primitives_written - sq->so.num_primitives_written;
break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
- sq->num_primitives_generated = softpipe->num_primitives_generated;
+ sq->num_primitives_generated =
+ softpipe->num_primitives_generated - sq->num_primitives_generated;
break;
case PIPE_QUERY_GPU_FINISHED:
case PIPE_QUERY_TIMESTAMP_DISJOINT:
@@ -219,7 +218,7 @@ softpipe_get_query_result(struct pipe_context *pipe,
struct pipe_query_data_so_statistics *stats =
(struct pipe_query_data_so_statistics *)vresult;
stats->num_primitives_written = sq->so.num_primitives_written;
- stats->primitives_storage_needed = sq->num_primitives_generated;
+ stats->primitives_storage_needed = sq->so.primitives_storage_needed;
}
break;
case PIPE_QUERY_PIPELINE_STATISTICS: