From 6d3be477ab14a5205e06540b7aadadb2f721fb0d Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Mon, 24 Nov 2025 11:36:42 +0200 Subject: [PATCH] anv: enable application shader printfs with debug option Signed-off-by: Lionel Landwerlin Reviewed-by: Alyssa Rosenzweig Part-of: --- src/intel/vulkan/anv_shader_compile.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/intel/vulkan/anv_shader_compile.c b/src/intel/vulkan/anv_shader_compile.c index 5cab72ab4c3..f3bd6325316 100644 --- a/src/intel/vulkan/anv_shader_compile.c +++ b/src/intel/vulkan/anv_shader_compile.c @@ -167,6 +167,8 @@ anv_shader_get_spirv_options(struct vk_physical_device *device, .phys_ssbo_addr_format = nir_address_format_64bit_global, .push_const_addr_format = nir_address_format_logical, + .printf = INTEL_DEBUG(DEBUG_SHADER_PRINT), + /* TODO: Consider changing this to an address format that has the NULL * pointer equals to 0. That might be a better format to play nice * with certain code / code generators. @@ -215,6 +217,14 @@ anv_shader_preprocess_nir(struct vk_physical_device *device, NIR_PASS(_, nir, nir_opt_barrier_modes); NIR_PASS(_, nir, nir_opt_acquire_release_barriers, SCOPE_QUEUE_FAMILY); + if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) { + const nir_lower_printf_options printf_opts = { + .ptr_bit_size = 64, + .hash_format_strings = true, + }; + NIR_PASS(_, nir, nir_lower_printf, &printf_opts); + } + nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir)); }