Skip to content

Commit a3612a1

Browse files
authored
[ET-VK][ez] Small fix to SPIR-V compilation artifact caching
Differential Revision: D71973524 Pull Request resolved: #9716
1 parent 95702dc commit a3612a1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

backends/vulkan/runtime/gen_vulkan_spv.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,7 @@ def process_shader(shader_paths_pair):
801801
output_file.write(output_text)
802802

803803
if cache_dir is not None:
804-
# Otherwise, store the generated and source GLSL files in the cache
805-
shutil.copyfile(source_glsl, cached_source_glsl)
804+
# Otherwise, store the generated GLSL files in the cache
806805
shutil.copyfile(glsl_out_path, cached_glsl_out_path)
807806

808807
# If no GLSL compiler is specified, then only write out the generated GLSL shaders.
@@ -852,6 +851,15 @@ def process_shader(shader_paths_pair):
852851
):
853852
output_file_map[spv_out_path] = glsl_out_path
854853

854+
# Save all source GLSL files to the cache. Only do this at the very end since
855+
# multiple variants may use the same source file.
856+
if cache_dir is not None:
857+
for _, source_glsl in self.glsl_src_files.items():
858+
cached_source_glsl = os.path.join(
859+
cache_dir, os.path.basename(source_glsl) + ".t"
860+
)
861+
shutil.copyfile(source_glsl, cached_source_glsl)
862+
855863
return output_file_map
856864

857865

0 commit comments

Comments
 (0)