radv: fix dumping debug/perftest options when there are holes

Also fix the wrong assertion.

Fixes: 8c1e2ac03b ("radv: Refactor RADV_DEBUG=shaders to be a combination of other options.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32276>
This commit is contained in:
Samuel Pitoiset 2024-11-21 09:04:23 +01:00 committed by Marge Bot
parent e0f48568c7
commit 3f646d43dd

View file

@ -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[] = {