diff options
author | Marek Olšák <[email protected]> | 2011-11-10 23:38:31 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-11-11 00:03:52 +0100 |
commit | 72c1658554b2d1e90e687340c5db4fec939b3901 (patch) | |
tree | c938e129a282b121bd959bc3985db6490cae0d16 /src/gallium/drivers/r600 | |
parent | 3800fe800bfc7faac6e629e584487c5904a5ef2b (diff) |
r600g: the type of OCCLUSION_PREDICATE result should be boolean
Diffstat (limited to 'src/gallium/drivers/r600')
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_context.c | 19 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_query.c | 4 |
3 files changed, 17 insertions, 11 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 28c1ee15ce3..f04bcae1e51 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -164,7 +164,10 @@ struct r600_range { }; struct r600_query { - u64 result; + union { + uint64_t u64; + boolean b; + } result; /* The kind of query */ unsigned type; /* Offset of the first result for current query */ diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index 867c6a00952..c51016738bd 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -1617,21 +1617,21 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu switch (query->type) { case PIPE_QUERY_OCCLUSION_COUNTER: while (results_base != query->results_end) { - query->result += + query->result.u64 += r600_query_read_result(map + results_base, 0, 2, true); results_base = (results_base + 16) % query->buffer->b.b.b.width0; } break; case PIPE_QUERY_OCCLUSION_PREDICATE: while (results_base != query->results_end) { - query->result = query->result || - r600_query_read_result(map + results_base, 0, 2, true); + query->result.b = query->result.b || + r600_query_read_result(map + results_base, 0, 2, true) != 0; results_base = (results_base + 16) % query->buffer->b.b.b.width0; } break; case PIPE_QUERY_TIME_ELAPSED: while (results_base != query->results_end) { - query->result += + query->result.u64 += r600_query_read_result(map + results_base, 0, 2, false); results_base = (results_base + query->result_size) % query->buffer->b.b.b.width0; } @@ -1830,24 +1830,27 @@ boolean r600_context_query_result(struct r600_context *ctx, struct r600_query *query, boolean wait, void *vresult) { - uint64_t *result = (uint64_t*)vresult; + boolean *result_b = (boolean*)vresult; + uint64_t *result_u64 = (uint64_t*)vresult; if (!r600_query_result(ctx, query, wait)) return FALSE; switch (query->type) { case PIPE_QUERY_OCCLUSION_COUNTER: + *result_u64 = query->result.u64; + break; case PIPE_QUERY_OCCLUSION_PREDICATE: - *result = query->result; + *result_b = query->result.b; break; case PIPE_QUERY_TIME_ELAPSED: - *result = (1000000 * query->result) / ctx->screen->info.r600_clock_crystal_freq; + *result_u64 = (1000000 * query->result.u64) / ctx->screen->info.r600_clock_crystal_freq; break; default: assert(0); } - query->result = 0; + memset(&query->result, 0, sizeof(query->result)); return TRUE; } diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index afdb0382d37..ec0d91f0874 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -42,7 +42,7 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; - rquery->result = 0; + memset(&rquery->result, 0, sizeof(rquery->result)); rquery->results_start = rquery->results_end; r600_query_begin(&rctx->ctx, (struct r600_query *)query); LIST_ADDTAIL(&rquery->list, &rctx->ctx.active_query_list); @@ -76,7 +76,7 @@ static void r600_render_condition(struct pipe_context *ctx, int wait_flag = 0; /* If we already have nonzero result, render unconditionally */ - if (query != NULL && rquery->result != 0) { + if (query != NULL && rquery->result.u64 != 0) { if (rctx->current_render_cond) { r600_render_condition(ctx, NULL, 0); } |