From 1d3dbb2bef3fef0d873c08fcca8dbf1c11ac8a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 27 Apr 2024 02:42:48 -0400 Subject: [PATCH] radeonsi: fix the size of the query result SSBO This was harmless because the shader writes only 4 bytes if the type has 32 bits. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/gfx11_query.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeonsi/gfx11_query.c b/src/gallium/drivers/radeonsi/gfx11_query.c index 722f91d36a6..b6e5e34100a 100644 --- a/src/gallium/drivers/radeonsi/gfx11_query.c +++ b/src/gallium/drivers/radeonsi/gfx11_query.c @@ -322,7 +322,8 @@ static void gfx11_sh_query_get_result_resource(struct si_context *sctx, struct s consts.config = 1; } - if (result_type == PIPE_QUERY_TYPE_I64 || result_type == PIPE_QUERY_TYPE_U64) + bool is_result_64bit = result_type == PIPE_QUERY_TYPE_I64 || result_type == PIPE_QUERY_TYPE_U64; + if (is_result_64bit) consts.config |= 8; constant_buffer.buffer_size = sizeof(consts); @@ -370,7 +371,7 @@ static void gfx11_sh_query_get_result_resource(struct si_context *sctx, struct s if (qbuf == query->last) { ssbo[2].buffer = resource; ssbo[2].buffer_offset = offset; - ssbo[2].buffer_size = 8; + ssbo[2].buffer_size = is_result_64bit ? 8 : 4; } sctx->b.set_constant_buffer(&sctx->b, PIPE_SHADER_COMPUTE, 0, false, &constant_buffer);