diff options
author | Roland Scheidegger <[email protected]> | 2013-06-18 23:27:31 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-06-19 23:47:36 +0200 |
commit | bf5096303f1696dcfe07cebf169f66daa8af2645 (patch) | |
tree | eb5d1a452f433dba3567f88ec611ea6a1d217d6a | |
parent | cdf89d0b5c3fccefe573d5adf731dd8fb900b74e (diff) |
softpipe: handle all queries, and change for the new disjoint semantics
The driver can do render_condition but wasn't handling the occlusion
and so_overflow predicates (though the latter might not work yet due
to gs support).
Reviewed-by: Jose Fonseca <[email protected]>
-rw-r--r-- | src/gallium/drivers/softpipe/sp_query.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index b5bc0db4490..daeef53b86f 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -60,8 +60,10 @@ softpipe_create_query(struct pipe_context *pipe, struct softpipe_query* sq; assert(type == PIPE_QUERY_OCCLUSION_COUNTER || + type == PIPE_QUERY_OCCLUSION_PREDICATE || type == PIPE_QUERY_TIME_ELAPSED || type == PIPE_QUERY_SO_STATISTICS || + type == PIPE_QUERY_SO_OVERFLOW_PREDICATE || type == PIPE_QUERY_PRIMITIVES_EMITTED || type == PIPE_QUERY_PRIMITIVES_GENERATED || type == PIPE_QUERY_PIPELINE_STATISTICS || @@ -90,9 +92,9 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) switch (sq->type) { case PIPE_QUERY_OCCLUSION_COUNTER: + case PIPE_QUERY_OCCLUSION_PREDICATE: sq->start = softpipe->occlusion_count; break; - case PIPE_QUERY_TIMESTAMP_DISJOINT: case PIPE_QUERY_TIME_ELAPSED: sq->start = os_time_get_nano(); break; @@ -102,6 +104,10 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) softpipe->num_primitives_generated = 0; sq->so.num_primitives_written = 0; softpipe->so_stats.num_primitives_written = 0; + 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; @@ -112,6 +118,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) break; case PIPE_QUERY_TIMESTAMP: case PIPE_QUERY_GPU_FINISHED: + case PIPE_QUERY_TIMESTAMP_DISJOINT: break; case PIPE_QUERY_PIPELINE_STATISTICS: /* reset our cache */ @@ -141,15 +148,19 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) softpipe->active_query_count--; switch (sq->type) { case PIPE_QUERY_OCCLUSION_COUNTER: + case PIPE_QUERY_OCCLUSION_PREDICATE: sq->end = softpipe->occlusion_count; break; case PIPE_QUERY_TIMESTAMP: sq->start = 0; /* fall through */ - case PIPE_QUERY_TIMESTAMP_DISJOINT: case PIPE_QUERY_TIME_ELAPSED: 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); + break; case PIPE_QUERY_SO_STATISTICS: sq->num_primitives_generated = softpipe->num_primitives_generated; @@ -164,6 +175,7 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) sq->num_primitives_generated = softpipe->num_primitives_generated; break; case PIPE_QUERY_GPU_FINISHED: + case PIPE_QUERY_TIMESTAMP_DISJOINT: break; case PIPE_QUERY_PIPELINE_STATISTICS: sq->stats.ia_vertices = @@ -195,9 +207,9 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) static boolean softpipe_get_query_result(struct pipe_context *pipe, - struct pipe_query *q, - boolean wait, - union pipe_query_result *vresult) + struct pipe_query *q, + boolean wait, + union pipe_query_result *vresult) { struct softpipe_query *sq = softpipe_query(q); uint64_t *result = (uint64_t*)vresult; @@ -215,15 +227,17 @@ softpipe_get_query_result(struct pipe_context *pipe, sizeof(struct pipe_query_data_pipeline_statistics));; break; case PIPE_QUERY_GPU_FINISHED: - *result = TRUE; + vresult->b = TRUE; + break; + case PIPE_QUERY_SO_OVERFLOW_PREDICATE: + vresult->b = sq->end != 0; break; case PIPE_QUERY_TIMESTAMP_DISJOINT: { - struct pipe_query_data_timestamp_disjoint td; + struct pipe_query_data_timestamp_disjoint *td = + (struct pipe_query_data_timestamp_disjoint *)vresult; /* os_get_time_nano return nanoseconds */ - td.frequency = UINT64_C(1000000000); - td.disjoint = sq->end != sq->start; - memcpy(vresult, &td, - sizeof(struct pipe_query_data_timestamp_disjoint)); + td->frequency = UINT64_C(1000000000); + td->disjoint = FALSE; } break; case PIPE_QUERY_PRIMITIVES_EMITTED: @@ -232,6 +246,9 @@ softpipe_get_query_result(struct pipe_context *pipe, case PIPE_QUERY_PRIMITIVES_GENERATED: *result = sq->num_primitives_generated; break; + case PIPE_QUERY_OCCLUSION_PREDICATE: + vresult->b = sq->end - sq->start != 0; + break; default: *result = sq->end - sq->start; break; |