summaryrefslogtreecommitdiffstats
path: root/glsl_builders.py
diff options
context:
space:
mode:
authorBradley Clemetson <brad.clemetson@codeprogrammers.net>2023-03-19 21:01:58 -0700
committerBradley Clemetson <brad.clemetson@codeprogrammers.net>2023-03-19 21:18:52 -0700
commit2302c7102fce093ed7cbbcda86bfcfebf1fe4fd5 (patch)
tree0fd368cfb777c18b9d0e29e3b0cc942e76142269 /glsl_builders.py
parent550a7798510810d238b733a54f69da71b2a2d152 (diff)
downloadredot-engine-2302c7102fce093ed7cbbcda86bfcfebf1fe4fd5.tar.gz
Allow for external python scripts to call the build python headers via external scripts
Change GLES3 to not use a relative path Make the parameters more explicit and ensure the shaders generated are not using relative paths
Diffstat (limited to 'glsl_builders.py')
-rw-r--r--glsl_builders.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/glsl_builders.py b/glsl_builders.py
index 888f541cf4..1dcae2fd75 100644
--- a/glsl_builders.py
+++ b/glsl_builders.py
@@ -114,11 +114,17 @@ def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth:
return header_data
-def build_rd_header(filename: str, header_data: Optional[RDHeaderStruct] = None) -> None:
+def build_rd_header(
+ filename: str, optional_output_filename: str = None, header_data: Optional[RDHeaderStruct] = None
+) -> None:
header_data = header_data or RDHeaderStruct()
include_file_in_rd_header(filename, header_data, 0)
- out_file = filename + ".gen.h"
+ if optional_output_filename is None:
+ out_file = filename + ".gen.h"
+ else:
+ out_file = optional_output_filename
+
out_file_base = out_file
out_file_base = out_file_base[out_file_base.rfind("/") + 1 :]
out_file_base = out_file_base[out_file_base.rfind("\\") + 1 :]
@@ -165,7 +171,7 @@ public:
def build_rd_headers(target, source, env):
for x in source:
- build_rd_header(str(x))
+ build_rd_header(filename=str(x))
class RAWHeaderStruct:
@@ -193,11 +199,17 @@ def include_file_in_raw_header(filename: str, header_data: RAWHeaderStruct, dept
fs.close()
-def build_raw_header(filename: str, header_data: Optional[RAWHeaderStruct] = None):
+def build_raw_header(
+ filename: str, optional_output_filename: str = None, header_data: Optional[RAWHeaderStruct] = None
+):
header_data = header_data or RAWHeaderStruct()
include_file_in_raw_header(filename, header_data, 0)
- out_file = filename + ".gen.h"
+ if optional_output_filename is None:
+ out_file = filename + ".gen.h"
+ else:
+ out_file = optional_output_filename
+
out_file_base = out_file.replace(".glsl.gen.h", "_shader_glsl")
out_file_base = out_file_base[out_file_base.rfind("/") + 1 :]
out_file_base = out_file_base[out_file_base.rfind("\\") + 1 :]
@@ -219,7 +231,7 @@ static const char {out_file_base}[] = {{
def build_raw_headers(target, source, env):
for x in source:
- build_raw_header(str(x))
+ build_raw_header(filename=str(x))
if __name__ == "__main__":