radv/printf: Guard against helper invocations

Helper invocations can allocate printf buffer space but they do not
write any data which can cause crashes in radv_dump_printf_data.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32318>
This commit is contained in:
Konstantin
2024-11-23 17:55:48 +01:00
committed by Marge Bot
parent 5bc4d33fa5
commit 1a3f6c586c

View File

@@ -116,6 +116,9 @@ radv_build_printf(nir_builder *b, nir_def *cond, const char *format_string, ...)
if (cond)
nir_push_if(b, cond);
if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
nir_push_if(b, nir_inot(b, nir_is_helper_invocation(b, 1)));
nir_def *size = nir_imm_int(b, 4);
va_list arg_list;
@@ -204,6 +207,9 @@ radv_build_printf(nir_builder *b, nir_def *cond, const char *format_string, ...)
if (cond)
nir_pop_if(b, NULL);
if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
nir_pop_if(b, NULL);
free(args);
free(strides);