util/glsl2spirv: only copy the input file if we're going to change it

Should make the build slightly faster by only copying when we actually
need to, and otherwise pointing at the original source

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30132>
This commit is contained in:
Dylan Baker 2024-07-11 10:12:21 -07:00 committed by Marge Bot
parent 36160c967c
commit 55158bed7f

View file

@ -146,6 +146,9 @@ def postprocess_file(args: 'Arguments') -> None:
def preprocess_file(args: 'Arguments', origin_file: T.TextIO, directory: os.PathLike, filemap: T.Dict[str, str]) -> str:
if args.create_entry is None and args.glsl_ver is None:
return origin_file.name
with open(os.path.join(directory, os.path.basename(origin_file.name)), "w") as copy_file:
lines = origin_file.readlines()