From f060ae9ab6492446dbaf4d55665822c11a72d509 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Wed, 22 Sep 2010 14:59:09 -0400 Subject: [PATCH] r600g: fix multiple occlusion query on same id When calling query begin using same query id we need to discard previous query results. Signed-off-by: Jerome Glisse --- src/gallium/drivers/r600/r600_context.c | 4 ++-- src/gallium/drivers/r600/r600_state2.c | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c index 7a63d966eb5..18ff7936899 100644 --- a/src/gallium/drivers/r600/r600_context.c +++ b/src/gallium/drivers/r600/r600_context.c @@ -69,7 +69,7 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, { struct r600_context *rctx = r600_context(ctx); struct r600_query *rquery = NULL; -#if 0 +#if 1 static int dc = 0; char dname[256]; #endif @@ -84,7 +84,7 @@ void r600_flush(struct pipe_context *ctx, unsigned flags, #if 0 sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 2) { + if (dc < 20) { radeon_ctx_dump_bof(rctx->ctx, dname); R600_ERR("dumped %s\n", dname); } diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index 4ad9e4c6eb1..5182b26fcfa 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -556,6 +556,7 @@ static void r600_draw_common(struct r600_drawl *draw) struct r600_draw rdraw; struct r600_pipe_state vgt; + switch (draw->index_size) { case 2: vgt_draw_initiator = 0; @@ -660,7 +661,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, struct pipe_fence_handle **fence) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; -#if 1 +#if 0 static int dc = 0; char dname[256]; #endif @@ -2089,7 +2090,10 @@ static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *quer 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; + rquery->num_results = 0; r600_query_begin(&rctx->ctx, (struct r600_query *)query); } @@ -2105,7 +2109,11 @@ static boolean r600_get_query_result(struct pipe_context *ctx, boolean wait, void *vresult) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; + struct r600_query *rquery = (struct r600_query *)query; + if (rquery->num_results) { + ctx->flush(ctx, 0, NULL); + } return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult); } -- 2.30.2