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:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user