From ec5d0ffb04fe8643f9e248bf8530aa89c46f3e02 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 15 Feb 2024 18:09:41 -0800 Subject: [PATCH] radv: fix pipeline stats mask Left-shifting by 11*8 or 14*8 is undefined. This fixes many dEQP-VK.query_pool.statistics_query.* failures (but not pre-existing flakes) for release builds using clang. Fixes: 48aabaf225f ("radv: do not harcode the pipeline stats mask for query resolves") Part-of: --- src/amd/vulkan/radv_query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c index 8ee45b1b963..74e9efddcc3 100644 --- a/src/amd/vulkan/radv_query.c +++ b/src/amd/vulkan/radv_query.c @@ -1155,7 +1155,7 @@ radv_query_shader(struct radv_cmd_buffer *cmd_buffer, VkPipeline *pipeline, stru .range = VK_WHOLE_SIZE}}}); /* Encode the number of elements for easy access by the shader. */ - pipeline_stats_mask &= (1 << radv_get_pipelinestat_query_size(device)) - 1; + pipeline_stats_mask &= (1 << (radv_get_pipelinestat_query_size(device) / 8)) - 1; pipeline_stats_mask |= util_bitcount(pipeline_stats_mask) << 16; avail_offset -= src_offset;