diff options
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_query.c')
-rw-r--r-- | src/gallium/drivers/softpipe/sp_query.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index c2c48e8ecb3..2e54e023091 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -42,6 +42,7 @@ struct softpipe_query { uint64_t start; uint64_t end; struct pipe_query_data_so_statistics so; + unsigned num_primitives_generated; }; @@ -59,6 +60,8 @@ softpipe_create_query(struct pipe_context *pipe, assert(type == PIPE_QUERY_OCCLUSION_COUNTER || type == PIPE_QUERY_TIME_ELAPSED || type == PIPE_QUERY_SO_STATISTICS || + type == PIPE_QUERY_PRIMITIVES_EMITTED || + type == PIPE_QUERY_PRIMITIVES_GENERATED || type == PIPE_QUERY_GPU_FINISHED || type == PIPE_QUERY_TIMESTAMP || type == PIPE_QUERY_TIMESTAMP_DISJOINT); @@ -91,8 +94,14 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) sq->start = 1000*os_time_get(); break; case PIPE_QUERY_SO_STATISTICS: - sq->so.num_primitives_written = 0; sq->so.primitives_storage_needed = 0; + case PIPE_QUERY_PRIMITIVES_EMITTED: + sq->so.num_primitives_written = 0; + softpipe->so_stats.num_primitives_written = 0; + break; + case PIPE_QUERY_PRIMITIVES_GENERATED: + sq->num_primitives_generated = 0; + softpipe->num_primitives_generated = 0; break; case PIPE_QUERY_TIMESTAMP: case PIPE_QUERY_GPU_FINISHED: @@ -125,10 +134,14 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) sq->end = 1000*os_time_get(); break; case PIPE_QUERY_SO_STATISTICS: - sq->so.num_primitives_written = - softpipe->so_stats.num_primitives_written; sq->so.primitives_storage_needed = softpipe->so_stats.primitives_storage_needed; + case PIPE_QUERY_PRIMITIVES_EMITTED: + sq->so.num_primitives_written = + softpipe->so_stats.num_primitives_written; + break; + case PIPE_QUERY_PRIMITIVES_GENERATED: + sq->num_primitives_generated = softpipe->num_primitives_generated; break; case PIPE_QUERY_GPU_FINISHED: break; @@ -166,6 +179,12 @@ softpipe_get_query_result(struct pipe_context *pipe, sizeof(struct pipe_query_data_timestamp_disjoint)); } break; + case PIPE_QUERY_PRIMITIVES_EMITTED: + *result = sq->so.num_primitives_written; + break; + case PIPE_QUERY_PRIMITIVES_GENERATED: + *result = sq->num_primitives_generated; + break; default: *result = sq->end - sq->start; break; |