From 2325f2b6473e7905f839f11528d587a585ed595d Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Wed, 10 Oct 2018 01:36:23 -0500 Subject: [PATCH] r600: Fix tmp_buffer in query buffer shader. --- src/gallium/drivers/r600/r600_query.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index ccabab9cd..df5c9bb53 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -1441,7 +1441,7 @@ static void r600_create_query_result_shader(struct r600_common_context *rctx) "MOV TEMP[0], IMM[0].xxxx\n" "AND TEMP[4], CONST[0][0].wwww, IMM[1].xxxx\n" "UIF TEMP[4]\n" - "LOAD TEMP[0].xyz, BUFFER[1], IMM[0].xxxx\n" + "LOAD TEMP[0].xyz, BUFFER[1], CONST[0][2].yyyy\n" "ENDIF\n" "MOV TEMP[1].x, IMM[0].xxxx\n" @@ -1511,7 +1511,7 @@ static void r600_create_query_result_shader(struct r600_common_context *rctx) "AND TEMP[4], CONST[0][0].wwww, IMM[1].yyyy\n" "UIF TEMP[4]\n" /* Store accumulated data for chaining. */ - "STORE BUFFER[2].xyz, CONST[0][1].wwww, TEMP[0]\n" + "STORE BUFFER[2].xyz, CONST[0][2].yyyy, TEMP[0]\n" "ELSE\n" "AND TEMP[4], CONST[0][0].wwww, IMM[1].zzzz\n" "UIF TEMP[4]\n" @@ -1627,6 +1627,7 @@ static void r600_query_hw_get_result_resource(struct r600_common_context *rctx, uint32_t pair_count; uint32_t buffer_offset; uint32_t buffer0_offset; + uint32_t tmp_offset; } consts; if (!rctx->query_result_shader) { @@ -1655,8 +1656,9 @@ static void r600_query_hw_get_result_resource(struct r600_common_context *rctx, constant_buffer.user_buffer = &consts; ssbo[1].buffer = tmp_buffer; - ssbo[1].buffer_offset = tmp_buffer_offset; - ssbo[1].buffer_size = 16; + ssbo[1].buffer_offset = tmp_buffer_offset & ~0xff; + ssbo[1].buffer_size = tmp_buffer_offset + 16 - ssbo[1].buffer_offset; + consts.tmp_offset = tmp_buffer_offset & 0xff; ssbo[2] = ssbo[1]; @@ -1723,8 +1725,7 @@ static void r600_query_hw_get_result_resource(struct r600_common_context *rctx, ssbo[2].buffer_offset = offset & ~0xff; ssbo[2].buffer_size = offset + 8; consts.buffer_offset = (offset & 0xff); - } else - consts.buffer_offset = 0; + } rctx->b.set_constant_buffer(&rctx->b, PIPE_SHADER_COMPUTE, 0, &constant_buffer); -- 2.17.1