diff options
author | James Benton <[email protected]> | 2012-12-03 07:00:37 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2012-12-03 17:21:57 +0000 |
commit | 16f0d70ffe6d42d22b9e6b927b297e75a199aa78 (patch) | |
tree | 743ca3f973a5389fd8ecb49c3181b2ae2b26dfd3 /src/gallium/drivers/llvmpipe/lp_setup.c | |
parent | 041966801ec87e3bf32913e43d6882eca9434695 (diff) |
llvmpipe: Implement PIPE_QUERY_TIMESTAMP and PIPE_QUERY_TIME_ELAPSED.
This required an update for the query storage in llvmpipe, there
can now be an active query per query type, so an occlusion query
can run at the same time as a time elapsed query.
Based on PIPE_QUERY_TIME_ELAPSED patch from Dave Airlie.
v2: fix up piglits for timers (also from Dave Airlie)
a) if we don't render anything the result is 0, so just
return the current time
b) add missing screen get_timestamp callback.
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 84defc65054..1d71a87319e 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -232,12 +232,14 @@ begin_binning( struct lp_setup_context *setup ) } } - if (setup->active_query) { - ok = lp_scene_bin_everywhere( scene, - LP_RAST_OP_BEGIN_QUERY, - lp_rast_arg_query(setup->active_query) ); - if (!ok) - return FALSE; + for (i = 0; i < PIPE_QUERY_TYPES; ++i) { + if (setup->active_query[i]) { + ok = lp_scene_bin_everywhere( scene, + LP_RAST_OP_BEGIN_QUERY, + lp_rast_arg_query(setup->active_query[i]) ); + if (!ok) + return FALSE; + } } setup->clear.flags = 0; @@ -1116,11 +1118,16 @@ lp_setup_begin_query(struct lp_setup_context *setup, struct llvmpipe_query *pq) { /* init the query to its beginning state */ - assert(setup->active_query == NULL); + assert(setup->active_query[pq->type] == NULL); set_scene_state(setup, SETUP_ACTIVE, "begin_query"); - setup->active_query = pq; + setup->active_query[pq->type] = pq; + + /* XXX: It is possible that a query is created before the scene + * has been created. This means that setup->scene == NULL resulting + * in the query not being binned and thus is ignored. + */ if (setup->scene) { if (!lp_scene_bin_everywhere(setup->scene, @@ -1146,12 +1153,12 @@ lp_setup_begin_query(struct lp_setup_context *setup, void lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq) { - union lp_rast_cmd_arg dummy = { 0 }; - set_scene_state(setup, SETUP_ACTIVE, "end_query"); - assert(setup->active_query == pq); - setup->active_query = NULL; + if (pq->type != PIPE_QUERY_TIMESTAMP) { + assert(setup->active_query[pq->type] == pq); + setup->active_query[pq->type] = NULL; + } /* Setup will automatically re-issue any query which carried over a * scene boundary, and the rasterizer automatically "ends" queries @@ -1166,7 +1173,7 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq) if (!lp_scene_bin_everywhere(setup->scene, LP_RAST_OP_END_QUERY, - dummy)) { + lp_rast_arg_query(pq))) { lp_setup_flush(setup, NULL, __FUNCTION__); } } |