summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--drivers/gles3/effects/copy_effects.h2
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.h4
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h4
-rw-r--r--drivers/gles3/storage/material_storage.h10
-rw-r--r--drivers/gles3/storage/mesh_storage.h2
-rw-r--r--drivers/gles3/storage/particles_storage.h2
-rw-r--r--drivers/gles3/storage/texture_storage.h2
-rw-r--r--gles3_builders.py14
-rw-r--r--glsl_builders.py24
-rw-r--r--servers/rendering/renderer_rd/effects/fsr.h2
10 files changed, 44 insertions, 22 deletions
diff --git a/drivers/gles3/effects/copy_effects.h b/drivers/gles3/effects/copy_effects.h
index 38f79b96a6..105fbcfe98 100644
--- a/drivers/gles3/effects/copy_effects.h
+++ b/drivers/gles3/effects/copy_effects.h
@@ -33,7 +33,7 @@
#ifdef GLES3_ENABLED
-#include "../shaders/copy.glsl.gen.h"
+#include "drivers/gles3/shaders/copy.glsl.gen.h"
namespace GLES3 {
diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h
index 1c14d0b466..2eac5f57e1 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.h
+++ b/drivers/gles3/rasterizer_canvas_gles3.h
@@ -39,8 +39,8 @@
#include "storage/material_storage.h"
#include "storage/texture_storage.h"
-#include "shaders/canvas.glsl.gen.h"
-#include "shaders/canvas_occlusion.glsl.gen.h"
+#include "drivers/gles3/shaders/canvas.glsl.gen.h"
+#include "drivers/gles3/shaders/canvas_occlusion.glsl.gen.h"
class RasterizerSceneGLES3;
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index ff043d67f6..b4e787ad85 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -37,13 +37,13 @@
#include "core/templates/paged_allocator.h"
#include "core/templates/rid_owner.h"
#include "core/templates/self_list.h"
+#include "drivers/gles3/shaders/cubemap_filter.glsl.gen.h"
+#include "drivers/gles3/shaders/sky.glsl.gen.h"
#include "scene/resources/mesh.h"
#include "servers/rendering/renderer_compositor.h"
#include "servers/rendering/renderer_scene_render.h"
#include "servers/rendering_server.h"
#include "shader_gles3.h"
-#include "shaders/cubemap_filter.glsl.gen.h"
-#include "shaders/sky.glsl.gen.h"
#include "storage/light_storage.h"
#include "storage/material_storage.h"
#include "storage/render_scene_buffers_gles3.h"
diff --git a/drivers/gles3/storage/material_storage.h b/drivers/gles3/storage/material_storage.h
index 4c5861b017..92399127bb 100644
--- a/drivers/gles3/storage/material_storage.h
+++ b/drivers/gles3/storage/material_storage.h
@@ -42,11 +42,11 @@
#include "servers/rendering/storage/material_storage.h"
#include "servers/rendering/storage/utilities.h"
-#include "../shaders/canvas.glsl.gen.h"
-#include "../shaders/cubemap_filter.glsl.gen.h"
-#include "../shaders/particles.glsl.gen.h"
-#include "../shaders/scene.glsl.gen.h"
-#include "../shaders/sky.glsl.gen.h"
+#include "drivers/gles3/shaders/canvas.glsl.gen.h"
+#include "drivers/gles3/shaders/cubemap_filter.glsl.gen.h"
+#include "drivers/gles3/shaders/particles.glsl.gen.h"
+#include "drivers/gles3/shaders/scene.glsl.gen.h"
+#include "drivers/gles3/shaders/sky.glsl.gen.h"
namespace GLES3 {
diff --git a/drivers/gles3/storage/mesh_storage.h b/drivers/gles3/storage/mesh_storage.h
index e1c2bc3f63..f9122771f9 100644
--- a/drivers/gles3/storage/mesh_storage.h
+++ b/drivers/gles3/storage/mesh_storage.h
@@ -33,10 +33,10 @@
#ifdef GLES3_ENABLED
-#include "../shaders/skeleton.glsl.gen.h"
#include "core/templates/local_vector.h"
#include "core/templates/rid_owner.h"
#include "core/templates/self_list.h"
+#include "drivers/gles3/shaders/skeleton.glsl.gen.h"
#include "servers/rendering/storage/mesh_storage.h"
#include "servers/rendering/storage/utilities.h"
diff --git a/drivers/gles3/storage/particles_storage.h b/drivers/gles3/storage/particles_storage.h
index b220c48de9..0e84c2ca8f 100644
--- a/drivers/gles3/storage/particles_storage.h
+++ b/drivers/gles3/storage/particles_storage.h
@@ -33,10 +33,10 @@
#ifdef GLES3_ENABLED
-#include "../shaders/particles_copy.glsl.gen.h"
#include "core/templates/local_vector.h"
#include "core/templates/rid_owner.h"
#include "core/templates/self_list.h"
+#include "drivers/gles3/shaders/particles_copy.glsl.gen.h"
#include "servers/rendering/storage/particles_storage.h"
#include "servers/rendering/storage/utilities.h"
diff --git a/drivers/gles3/storage/texture_storage.h b/drivers/gles3/storage/texture_storage.h
index c702904648..be1e9bd21c 100644
--- a/drivers/gles3/storage/texture_storage.h
+++ b/drivers/gles3/storage/texture_storage.h
@@ -39,7 +39,7 @@
#include "servers/rendering/renderer_compositor.h"
#include "servers/rendering/storage/texture_storage.h"
-#include "../shaders/canvas_sdf.glsl.gen.h"
+#include "drivers/gles3/shaders/canvas_sdf.glsl.gen.h"
// This must come first to avoid windows.h mess
#include "platform_config.h"
diff --git a/gles3_builders.py b/gles3_builders.py
index 0d0037dea1..6b5a53221c 100644
--- a/gles3_builders.py
+++ b/gles3_builders.py
@@ -199,11 +199,21 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
return header_data
-def build_gles3_header(filename: str, include: str, class_suffix: str, header_data: Optional[GLES3HeaderStruct] = None):
+def build_gles3_header(
+ filename: str,
+ include: str,
+ class_suffix: str,
+ optional_output_filename: str = None,
+ header_data: Optional[GLES3HeaderStruct] = None,
+):
header_data = header_data or GLES3HeaderStruct()
include_file_in_gles3_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
+
fd = open(out_file, "w")
defspec = 0
defvariant = ""
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__":
diff --git a/servers/rendering/renderer_rd/effects/fsr.h b/servers/rendering/renderer_rd/effects/fsr.h
index 9cb4894f8d..3ff59bf584 100644
--- a/servers/rendering/renderer_rd/effects/fsr.h
+++ b/servers/rendering/renderer_rd/effects/fsr.h
@@ -32,8 +32,8 @@
#define FSR_RD_H
#include "../pipeline_cache_rd.h"
-#include "../shaders/effects/fsr_upscale.glsl.gen.h"
#include "../storage_rd/render_scene_buffers_rd.h"
+#include "servers/rendering/renderer_rd/shaders/effects/fsr_upscale.glsl.gen.h"
#include "servers/rendering/renderer_scene_render.h"
#include "servers/rendering_server.h"