From 822da92d68a537a5cb90d4e4e1eb099e15a4b137 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Mon, 9 Feb 2026 09:04:53 +0100 Subject: [PATCH] nvk: Report NIR shader in pipeline executable properties All other drivers in mesa report NIR for VK_KHR_pipeline_executable_properties let's do the same as this can be useful to see what we have right before compilation. Signed-off-by: Mary Guillemard Reviewed-by: Mel Henning Part-of: --- src/nouveau/vulkan/nvk_shader.c | 13 +++++++++++++ src/nouveau/vulkan/nvk_shader.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index c94414817d6..1311497aeb8 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -520,6 +520,9 @@ nvk_compile_nir(struct nvk_device *dev, nir_shader *nir, shader->data_size = data_size; } + if (dump_asm) + shader->nir_str = nir_shader_as_str(nir, NULL); + return VK_SUCCESS; } @@ -870,6 +873,7 @@ nvk_shader_destroy(struct vk_device *vk_dev, } free((void *)shader->data_ptr); + ralloc_free((void *)shader->nir_str); vk_shader_free(&dev->vk, pAllocator, &shader->vk); } @@ -1273,6 +1277,15 @@ nvk_shader_get_executable_internal_representations( assert(executable_index == 0); + if (shader->nir_str != NULL) { + vk_outarray_append_typed(VkPipelineExecutableInternalRepresentationKHR, &out, ir) { + WRITE_STR(ir->name, "NIR shader"); + WRITE_STR(ir->description, "NIR shader"); + if (!write_ir_text(ir, shader->nir_str)) + incomplete_text = true; + } + } + if (shader->nak != NULL && shader->nak->asm_str != NULL) { vk_outarray_append_typed(VkPipelineExecutableInternalRepresentationKHR, &out, ir) { WRITE_STR(ir->name, "NAK assembly"); diff --git a/src/nouveau/vulkan/nvk_shader.h b/src/nouveau/vulkan/nvk_shader.h index 5a8d40674be..9c2239556cd 100644 --- a/src/nouveau/vulkan/nvk_shader.h +++ b/src/nouveau/vulkan/nvk_shader.h @@ -94,6 +94,7 @@ struct nvk_shader { float min_sample_shading; struct nak_shader_bin *nak; + const char *nir_str; const void *code_ptr; uint32_t code_size;