diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index ed84cb5f98e..526600eb40b 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -6444,6 +6444,7 @@ bool nir_lower_helper_writes(nir_shader *shader, bool lower_plain_stores); typedef struct nir_lower_printf_options { unsigned max_buffer_size; + unsigned ptr_bit_size; bool use_printf_base_identifier; } nir_lower_printf_options; diff --git a/src/compiler/nir/nir_lower_printf.c b/src/compiler/nir/nir_lower_printf.c index 6173ff50043..c655c7ec068 100644 --- a/src/compiler/nir/nir_lower_printf.c +++ b/src/compiler/nir/nir_lower_printf.c @@ -46,7 +46,8 @@ lower_printf_intrin(nir_builder *b, nir_intrinsic_instr *prntf, void *_options) nir_deref_instr *args = nir_src_as_deref(prntf->src[1]); assert(args->deref_type == nir_deref_type_var); - const unsigned ptr_bit_size = nir_get_ptr_bitsize(b->shader); + const unsigned ptr_bit_size = options->ptr_bit_size != 0 ? + options->ptr_bit_size : nir_get_ptr_bitsize(b->shader); /* Atomic add a buffer size counter to determine where to write. If * overflowed, return -1, otherwise, store the arguments and return 0. diff --git a/src/gallium/frontends/rusticl/core/kernel.rs b/src/gallium/frontends/rusticl/core/kernel.rs index 010b067dbc5..87b7fde283d 100644 --- a/src/gallium/frontends/rusticl/core/kernel.rs +++ b/src/gallium/frontends/rusticl/core/kernel.rs @@ -463,6 +463,7 @@ fn lower_and_optimize_nir( nir_pass!(nir, nir_dedup_inline_samplers); let printf_opts = nir_lower_printf_options { + ptr_bit_size: 0, use_printf_base_identifier: false, max_buffer_size: dev.printf_buffer_size() as u32, };