@@ -861,10 +861,6 @@ def generate_src_file(shader_paths_pair):
861
861
862
862
# Construct generated file name
863
863
gen_out_path = os .path .join (output_dir , f"{ src_file_name } .{ out_file_ext } " )
864
- # Construct path of cached generated file
865
- cached_gen_out_path = os .path .join (
866
- cache_dir , f"{ src_file_name } .{ out_file_ext } "
867
- )
868
864
869
865
# Execute codegen to generate the output file
870
866
with codecs .open (src_file_fullpath , "r" , encoding = "utf-8" ) as input_file :
@@ -875,10 +871,6 @@ def generate_src_file(shader_paths_pair):
875
871
with codecs .open (gen_out_path , "w" , encoding = "utf-8" ) as output_file :
876
872
output_file .write (output_text )
877
873
878
- if cache_dir is not None :
879
- # Store the generated file in the cache for SPIR-V compilation
880
- shutil .copyfile (gen_out_path , cached_gen_out_path )
881
-
882
874
def compile_spirv (shader_paths_pair ):
883
875
# Extract components from the input tuple
884
876
# name of generated .glsl, .glslh, or .h
@@ -959,7 +951,10 @@ def compile_spirv(shader_paths_pair):
959
951
else :
960
952
raise RuntimeError (f"{ err_msg_base } { e .stderr } " ) from e
961
953
954
+ # If compilation was successful, store the source GLSL file and the
955
+ # compiled SPIR-V file in the cache for future comparison.
962
956
if cache_dir is not None :
957
+ shutil .copyfile (gen_out_path , cached_gen_out_path )
963
958
shutil .copyfile (spv_out_path , cached_spv_out_path )
964
959
965
960
return (spv_out_path , gen_out_path )
0 commit comments