From 3f646d43dd21809e95a9f862ebe17733fbece72a Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 21 Nov 2024 09:04:23 +0100 Subject: [PATCH] radv: fix dumping debug/perftest options when there are holes Also fix the wrong assertion. Fixes: 8c1e2ac03b9 ("radv: Refactor RADV_DEBUG=shaders to be a combination of other options.") Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_instance.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c index 103ccc50542..5c38ceb4ef5 100644 --- a/src/amd/vulkan/radv_instance.c +++ b/src/amd/vulkan/radv_instance.c @@ -90,8 +90,12 @@ static const struct debug_control radv_debug_options[] = {{"nofastclears", RADV_ const char * radv_get_debug_option_name(int id) { - assert(id < ARRAY_SIZE(radv_debug_options) - 1); - return radv_debug_options[id].string; + assert(id < ARRAY_SIZE(radv_debug_options)); + for (uint32_t i = 0; i < ARRAY_SIZE(radv_debug_options); i++) { + if (radv_debug_options[i].flag == (1ull << id)) + return radv_debug_options[i].string; + } + return NULL; } static const struct debug_control radv_perftest_options[] = {{"localbos", RADV_PERFTEST_LOCAL_BOS}, @@ -124,8 +128,12 @@ static const struct debug_control radv_trap_excp_options[] = { const char * radv_get_perftest_option_name(int id) { - assert(id < ARRAY_SIZE(radv_perftest_options) - 1); - return radv_perftest_options[id].string; + assert(id < ARRAY_SIZE(radv_perftest_options)); + for (uint32_t i = 0; i < ARRAY_SIZE(radv_perftest_options); i++) { + if (radv_perftest_options[i].flag == (1ull << id)) + return radv_perftest_options[i].string; + } + return NULL; } static const struct debug_control trace_options[] = {