summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_query.c
diff options
context:
space:
mode:
authorVadim Girlin <[email protected]>2011-07-15 07:22:20 +0400
committerAlex Deucher <[email protected]>2011-07-15 15:42:46 -0400
commitef29bfee031cdab3dbb0f9a79828c4b0d0405991 (patch)
treeac65f3f819533dc1c1f4e7d7b4321db40d0340ce /src/gallium/drivers/r600/r600_query.c
parentcfec000e7514342fd51859906e173ba2d474a55c (diff)
r600g: fix queries and predication
Use all zpass data for predication instead of the last block only. Use query buffer as a ring instead of reusing the same area for each new BeginQuery. All query buffer offsets are in bytes to simplify offsets math.
Diffstat (limited to 'src/gallium/drivers/r600/r600_query.c')
-rw-r--r--src/gallium/drivers/r600/r600_query.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 174505c75e9..de1f5d05f4e 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -43,7 +43,7 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query)
struct r600_query *rquery = (struct r600_query *)query;
rquery->result = 0;
- rquery->num_results = 0;
+ rquery->results_start = rquery->results_end;
r600_query_begin(&rctx->ctx, (struct r600_query *)query);
}
@@ -72,12 +72,18 @@ static void r600_render_condition(struct pipe_context *ctx,
struct r600_query *rquery = (struct r600_query *)query;
int wait_flag = 0;
+ /* If we already have nonzero result, render unconditionally */
+ if (query != NULL && rquery->result != 0)
+ return;
+
rctx->current_render_cond = query;
rctx->current_render_cond_mode = mode;
- if (!query) {
- rctx->ctx.predicate_drawing = false;
- r600_query_predication(&rctx->ctx, NULL, PREDICATION_OP_CLEAR, 1);
+ if (query == NULL) {
+ if (rctx->ctx.predicate_drawing) {
+ rctx->ctx.predicate_drawing = false;
+ r600_query_predication(&rctx->ctx, NULL, PREDICATION_OP_CLEAR, 1);
+ }
return;
}
@@ -88,7 +94,6 @@ static void r600_render_condition(struct pipe_context *ctx,
rctx->ctx.predicate_drawing = true;
r600_query_predication(&rctx->ctx, rquery, PREDICATION_OP_ZPASS, wait_flag);
-
}
void r600_init_query_functions(struct r600_pipe_context *rctx)