forked from anunknowperson/renderlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_shaders.py
More file actions
24 lines (15 loc) · 788 Bytes
/
Copy pathbuild_shaders.py
File metadata and controls
24 lines (15 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
import subprocess
shaders_directory = os.environ['PYTHONPATH'] + "/shaders/"
glslc_executable = "glslc.exe"
print("Shader builder working directory: " + os.environ['PYTHONPATH'])
for filename in os.listdir(shaders_directory):
if filename.endswith(".vert") or filename.endswith(".frag"):
shader_file_path = os.path.join(shaders_directory, filename)
output_file = os.path.splitext(shader_file_path)[0] + os.path.splitext(shader_file_path)[1] + ".spv"
command = [glslc_executable, shader_file_path, "-o", output_file]
try:
subprocess.run(command, check=True)
print(f"Compiled {filename} to {output_file}")
except subprocess.CalledProcessError as e:
print(f"Failed to compile {filename}: {e}")