From f714eaba0dca3fe65ac7494e7e597de03cd3d623 Mon Sep 17 00:00:00 2001 From: Dario Date: Fri, 16 Jan 2026 13:09:03 -0300 Subject: [PATCH] Do not store SPIR-V in memory unless pipeline statistics are used. --- drivers/vulkan/rendering_device_driver_vulkan.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/vulkan/rendering_device_driver_vulkan.cpp b/drivers/vulkan/rendering_device_driver_vulkan.cpp index c30e9c6b719..2b368aa2216 100644 --- a/drivers/vulkan/rendering_device_driver_vulkan.cpp +++ b/drivers/vulkan/rendering_device_driver_vulkan.cpp @@ -3891,9 +3891,12 @@ RDD::ShaderID RenderingDeviceDriverVulkan::shader_create_from_container(const Re const bool store_respv = use_respv && !shader_refl.specialization_constants.is_empty(); const int64_t stage_count = shader_refl.stages_vector.size(); shader_info.vk_stages_create_info.reserve(stage_count); - shader_info.spirv_stage_bytes.reserve(stage_count); shader_info.original_stage_size.reserve(stage_count); +#if RECORD_PIPELINE_STATISTICS + shader_info.spirv_stage_bytes.reserve(stage_count); +#endif + if (store_respv) { shader_info.respv_stage_shaders.reserve(stage_count); } @@ -3958,7 +3961,9 @@ RDD::ShaderID RenderingDeviceDriverVulkan::shader_create_from_container(const Re } } +#if RECORD_PIPELINE_STATISTICS shader_info.spirv_stage_bytes.push_back(decoded_spirv); +#endif VkShaderModuleCreateInfo shader_module_create_info = {}; shader_module_create_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; @@ -5676,7 +5681,7 @@ RDD::PipelineID RenderingDeviceDriverVulkan::render_pipeline_create( } } - print_line(vformat("re-spirv transformed the shader from %d bytes to %d bytes with constants %s (%d).", shader_info->spirv_stage_bytes[i].size(), respv_optimized_data.size(), spec_constants, p_shader.id)); + print_line(vformat("re-spirv transformed the shader from %d bytes to %d bytes with constants %s (%d).", shader_info->respv_stage_shaders[i].inlinedSpirvWords.size() * sizeof(uint32_t), respv_optimized_data.size(), spec_constants, p_shader.id)); #endif // Create the shader module with the optimized output.