nir: add ptr_bit_size parameter to nir_lower_printf

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25814>
This commit is contained in:
Lionel Landwerlin 2024-02-28 09:34:58 +02:00 committed by Marge Bot
parent 2be28ee58a
commit c518a176f5
3 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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.

View File

@ -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,
};