diff options
author | Roland Scheidegger <[email protected]> | 2013-06-25 23:27:04 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-06-26 23:17:53 +0200 |
commit | 08203428800554215657f1ebf19d74328103800e (patch) | |
tree | 2ffcdf6192673c70944a0087a114dc7877f49b82 /src/gallium/drivers/llvmpipe/lp_query.c | |
parent | 3dbba95b72262344b82fba018b7c2c1208754cd2 (diff) |
llvmpipe: rework query logic
Previously lp_rast_begin_query commands were always inserted into each bin,
and re-issued if the scene was restarted, while lp_rast_end_query commands
were executed for each still active query at the end of tile rasterization.
Also, the ps_invocations and vis_counter were set to zero when the respective
command was encountered.
This however cannot work for multiple queries of the same type (note that
occlusion counter and occlusion predicate while different type were also
affected).
So, change the logic to always set the ps_invocations and vis_counter to zero
at the start of tile rasterization, and then use "start" and "end" per-thread
query values when encountering the begin/end query commands instead, which
should work for multiple queries of the same type. This also means queries do
not have to be reissued in a new scene, however they still need to be finished
at end of tile rasterization, so a list of queries still active at the end of
a scene needs to be maintained.
Also while here don't bin the queries which don't do anything in rasterization.
(This change does not actually handle multiple queries of the same type yet,
as the list of active queries is just a simple fixed array and setup can still
only have one query active per type.)
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_query.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_query.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index 1d3edffba94..38d6b84b8d7 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -120,19 +120,19 @@ llvmpipe_get_query_result(struct pipe_context *pipe, switch (pq->type) { case PIPE_QUERY_OCCLUSION_COUNTER: for (i = 0; i < num_threads; i++) { - *result += pq->count[i]; + *result += pq->end[i]; } break; case PIPE_QUERY_OCCLUSION_PREDICATE: for (i = 0; i < num_threads; i++) { /* safer (still not guaranteed) when there's an overflow */ - vresult->b = vresult->b || pq->count[i]; + vresult->b = vresult->b || pq->end[i]; } break; case PIPE_QUERY_TIMESTAMP: for (i = 0; i < num_threads; i++) { - if (pq->count[i] > *result) { - *result = pq->count[i]; + if (pq->end[i] > *result) { + *result = pq->end[i]; } if (*result == 0) *result = os_time_get_nano(); @@ -170,7 +170,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe, (struct pipe_query_data_pipeline_statistics *)vresult; /* only ps_invocations come from binned query */ for (i = 0; i < num_threads; i++) { - pq->stats.ps_invocations += pq->count[i]; + pq->stats.ps_invocations += pq->end[i]; } pq->stats.ps_invocations *= LP_RASTER_BLOCK_SIZE * LP_RASTER_BLOCK_SIZE; *stats = pq->stats; @@ -200,7 +200,8 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) } - memset(pq->count, 0, sizeof(pq->count)); + memset(pq->start, 0, sizeof(pq->start)); + memset(pq->end, 0, sizeof(pq->end)); lp_setup_begin_query(llvmpipe->setup, pq); switch (pq->type) { @@ -232,8 +233,6 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) break; case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: - /* Both active at same time will still fail all over the place. - * Then again several of each type can be active too... */ llvmpipe->active_occlusion_query++; llvmpipe->dirty |= LP_NEW_OCCLUSION_QUERY; break; |