diff options
author | Dave Airlie <[email protected]> | 2020-03-27 13:29:59 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2020-04-15 14:26:03 +1000 |
commit | 7690606bf784c35c5318ebfe0f5162eec9b19b82 (patch) | |
tree | 8c7ce3b07b4acd80a142ea6b156742b4439cdd35 /src/gallium/drivers/llvmpipe | |
parent | 96e12ca7d77df365a96336561e32813818268c19 (diff) |
llvmpipe/query: fix transform feedback overflow any queries.
The any queries need to signal if any stream has overflowed,
so we have to track all the streams.
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4560>
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_query.c | 80 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_query.h | 4 |
2 files changed, 52 insertions, 32 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index c922caa8490..6fac76b94fb 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -151,20 +151,24 @@ llvmpipe_get_query_result(struct pipe_context *pipe, vresult->b = true; break; case PIPE_QUERY_PRIMITIVES_GENERATED: - *result = pq->num_primitives_generated; + *result = pq->num_primitives_generated[0]; break; case PIPE_QUERY_PRIMITIVES_EMITTED: - *result = pq->num_primitives_written; + *result = pq->num_primitives_written[0]; break; - case PIPE_QUERY_SO_OVERFLOW_PREDICATE: case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE: - vresult->b = pq->num_primitives_generated > pq->num_primitives_written; + vresult->b = false; + for (unsigned s = 0; s < PIPE_MAX_VERTEX_STREAMS; s++) + vresult->b |= pq->num_primitives_generated[s] > pq->num_primitives_written[s]; + break; + case PIPE_QUERY_SO_OVERFLOW_PREDICATE: + vresult->b = pq->num_primitives_generated[0] > pq->num_primitives_written[0]; break; case PIPE_QUERY_SO_STATISTICS: { struct pipe_query_data_so_statistics *stats = (struct pipe_query_data_so_statistics *)vresult; - stats->num_primitives_written = pq->num_primitives_written; - stats->primitives_storage_needed = pq->num_primitives_generated; + stats->num_primitives_written = pq->num_primitives_written[0]; + stats->primitives_storage_needed = pq->num_primitives_generated[0]; } break; case PIPE_QUERY_PIPELINE_STATISTICS: { @@ -243,10 +247,10 @@ llvmpipe_get_query_result_resource(struct pipe_context *pipe, } break; case PIPE_QUERY_PRIMITIVES_GENERATED: - value = pq->num_primitives_generated; + value = pq->num_primitives_generated[0]; break; case PIPE_QUERY_PRIMITIVES_EMITTED: - value = pq->num_primitives_written; + value = pq->num_primitives_written[0]; break; case PIPE_QUERY_TIMESTAMP: for (i = 0; i < num_threads; i++) { @@ -255,9 +259,13 @@ llvmpipe_get_query_result_resource(struct pipe_context *pipe, } } break; - case PIPE_QUERY_SO_OVERFLOW_PREDICATE: case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE: - value = !!(pq->num_primitives_generated > pq->num_primitives_written); + value = 0; + for (unsigned s = 0; s < PIPE_MAX_VERTEX_STREAMS; s++) + value |= !!(pq->num_primitives_generated[s] > pq->num_primitives_written[s]); + break; + case PIPE_QUERY_SO_OVERFLOW_PREDICATE: + value = !!(pq->num_primitives_generated[0] > pq->num_primitives_written[0]); break; case PIPE_QUERY_PIPELINE_STATISTICS: switch ((enum pipe_statistics_query_index)index) { @@ -358,20 +366,25 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) switch (pq->type) { case PIPE_QUERY_PRIMITIVES_EMITTED: - pq->num_primitives_written = llvmpipe->so_stats[pq->index].num_primitives_written; + pq->num_primitives_written[0] = llvmpipe->so_stats[pq->index].num_primitives_written; break; case PIPE_QUERY_PRIMITIVES_GENERATED: - pq->num_primitives_generated = llvmpipe->so_stats[pq->index].primitives_storage_needed; + pq->num_primitives_generated[0] = llvmpipe->so_stats[pq->index].primitives_storage_needed; llvmpipe->active_primgen_queries++; break; case PIPE_QUERY_SO_STATISTICS: - pq->num_primitives_written = llvmpipe->so_stats[pq->index].num_primitives_written; - pq->num_primitives_generated = llvmpipe->so_stats[pq->index].primitives_storage_needed; + pq->num_primitives_written[0] = llvmpipe->so_stats[pq->index].num_primitives_written; + pq->num_primitives_generated[0] = llvmpipe->so_stats[pq->index].primitives_storage_needed; break; - case PIPE_QUERY_SO_OVERFLOW_PREDICATE: case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE: - pq->num_primitives_written = llvmpipe->so_stats[pq->index].num_primitives_written; - pq->num_primitives_generated = llvmpipe->so_stats[pq->index].primitives_storage_needed; + for (unsigned s = 0; s < PIPE_MAX_VERTEX_STREAMS; s++) { + pq->num_primitives_written[s] = llvmpipe->so_stats[s].num_primitives_written; + pq->num_primitives_generated[s] = llvmpipe->so_stats[s].primitives_storage_needed; + } + break; + case PIPE_QUERY_SO_OVERFLOW_PREDICATE: + pq->num_primitives_written[0] = llvmpipe->so_stats[pq->index].num_primitives_written; + pq->num_primitives_generated[0] = llvmpipe->so_stats[pq->index].primitives_storage_needed; break; case PIPE_QUERY_PIPELINE_STATISTICS: /* reset our cache */ @@ -406,27 +419,34 @@ 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[pq->index].num_primitives_written - pq->num_primitives_written; + pq->num_primitives_written[0] = + llvmpipe->so_stats[pq->index].num_primitives_written - pq->num_primitives_written[0]; break; case PIPE_QUERY_PRIMITIVES_GENERATED: assert(llvmpipe->active_primgen_queries); llvmpipe->active_primgen_queries--; - pq->num_primitives_generated = - llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated; + pq->num_primitives_generated[0] = + llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated[0]; break; case PIPE_QUERY_SO_STATISTICS: - pq->num_primitives_written = - llvmpipe->so_stats[pq->index].num_primitives_written - pq->num_primitives_written; - pq->num_primitives_generated = - llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated; + pq->num_primitives_written[0] = + llvmpipe->so_stats[pq->index].num_primitives_written - pq->num_primitives_written[0]; + pq->num_primitives_generated[0] = + llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated[0]; break; - case PIPE_QUERY_SO_OVERFLOW_PREDICATE: case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE: - pq->num_primitives_written = - llvmpipe->so_stats[pq->index].num_primitives_written - pq->num_primitives_written; - pq->num_primitives_generated = - llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated; + for (unsigned s = 0; s < PIPE_MAX_VERTEX_STREAMS; s++) { + pq->num_primitives_written[s] = + llvmpipe->so_stats[s].num_primitives_written - pq->num_primitives_written[s]; + pq->num_primitives_generated[s] = + llvmpipe->so_stats[s].primitives_storage_needed - pq->num_primitives_generated[s]; + } + break; + case PIPE_QUERY_SO_OVERFLOW_PREDICATE: + pq->num_primitives_written[0] = + llvmpipe->so_stats[pq->index].num_primitives_written - pq->num_primitives_written[0]; + pq->num_primitives_generated[0] = + llvmpipe->so_stats[pq->index].primitives_storage_needed - pq->num_primitives_generated[0]; 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 aa6707ce661..d73640dd29c 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.h +++ b/src/gallium/drivers/llvmpipe/lp_query.h @@ -47,8 +47,8 @@ struct llvmpipe_query { struct lp_fence *fence; /* fence from last scene this was binned in */ unsigned type; /* PIPE_QUERY_* */ unsigned index; - unsigned num_primitives_generated; - unsigned num_primitives_written; + unsigned num_primitives_generated[PIPE_MAX_VERTEX_STREAMS]; + unsigned num_primitives_written[PIPE_MAX_VERTEX_STREAMS]; struct pipe_query_data_pipeline_statistics stats; }; |