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
This commit is contained in:
Bradley Clemetson 2023-03-19 21:01:58 -07:00
parent 550a779851
commit 2302c7102f
No known key found for this signature in database
GPG Key ID: 374B0EAFF7F488D0
10 changed files with 44 additions and 22 deletions

View File

@ -33,7 +33,7 @@
#ifdef GLES3_ENABLED #ifdef GLES3_ENABLED
#include "../shaders/copy.glsl.gen.h" #include "drivers/gles3/shaders/copy.glsl.gen.h"
namespace GLES3 { namespace GLES3 {

View File

@ -39,8 +39,8 @@
#include "storage/material_storage.h" #include "storage/material_storage.h"
#include "storage/texture_storage.h" #include "storage/texture_storage.h"
#include "shaders/canvas.glsl.gen.h" #include "drivers/gles3/shaders/canvas.glsl.gen.h"
#include "shaders/canvas_occlusion.glsl.gen.h" #include "drivers/gles3/shaders/canvas_occlusion.glsl.gen.h"
class RasterizerSceneGLES3; class RasterizerSceneGLES3;

View File

@ -37,13 +37,13 @@
#include "core/templates/paged_allocator.h" #include "core/templates/paged_allocator.h"
#include "core/templates/rid_owner.h" #include "core/templates/rid_owner.h"
#include "core/templates/self_list.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 "scene/resources/mesh.h"
#include "servers/rendering/renderer_compositor.h" #include "servers/rendering/renderer_compositor.h"
#include "servers/rendering/renderer_scene_render.h" #include "servers/rendering/renderer_scene_render.h"
#include "servers/rendering_server.h" #include "servers/rendering_server.h"
#include "shader_gles3.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/light_storage.h"
#include "storage/material_storage.h" #include "storage/material_storage.h"
#include "storage/render_scene_buffers_gles3.h" #include "storage/render_scene_buffers_gles3.h"

View File

@ -42,11 +42,11 @@
#include "servers/rendering/storage/material_storage.h" #include "servers/rendering/storage/material_storage.h"
#include "servers/rendering/storage/utilities.h" #include "servers/rendering/storage/utilities.h"
#include "../shaders/canvas.glsl.gen.h" #include "drivers/gles3/shaders/canvas.glsl.gen.h"
#include "../shaders/cubemap_filter.glsl.gen.h" #include "drivers/gles3/shaders/cubemap_filter.glsl.gen.h"
#include "../shaders/particles.glsl.gen.h" #include "drivers/gles3/shaders/particles.glsl.gen.h"
#include "../shaders/scene.glsl.gen.h" #include "drivers/gles3/shaders/scene.glsl.gen.h"
#include "../shaders/sky.glsl.gen.h" #include "drivers/gles3/shaders/sky.glsl.gen.h"
namespace GLES3 { namespace GLES3 {

View File

@ -33,10 +33,10 @@
#ifdef GLES3_ENABLED #ifdef GLES3_ENABLED
#include "../shaders/skeleton.glsl.gen.h"
#include "core/templates/local_vector.h" #include "core/templates/local_vector.h"
#include "core/templates/rid_owner.h" #include "core/templates/rid_owner.h"
#include "core/templates/self_list.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/mesh_storage.h"
#include "servers/rendering/storage/utilities.h" #include "servers/rendering/storage/utilities.h"

View File

@ -33,10 +33,10 @@
#ifdef GLES3_ENABLED #ifdef GLES3_ENABLED
#include "../shaders/particles_copy.glsl.gen.h"
#include "core/templates/local_vector.h" #include "core/templates/local_vector.h"
#include "core/templates/rid_owner.h" #include "core/templates/rid_owner.h"
#include "core/templates/self_list.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/particles_storage.h"
#include "servers/rendering/storage/utilities.h" #include "servers/rendering/storage/utilities.h"

View File

@ -39,7 +39,7 @@
#include "servers/rendering/renderer_compositor.h" #include "servers/rendering/renderer_compositor.h"
#include "servers/rendering/storage/texture_storage.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 // This must come first to avoid windows.h mess
#include "platform_config.h" #include "platform_config.h"

View File

@ -199,11 +199,21 @@ def include_file_in_gles3_header(filename: str, header_data: GLES3HeaderStruct,
return header_data 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() header_data = header_data or GLES3HeaderStruct()
include_file_in_gles3_header(filename, header_data, 0) include_file_in_gles3_header(filename, header_data, 0)
if optional_output_filename is None:
out_file = filename + ".gen.h" out_file = filename + ".gen.h"
else:
out_file = optional_output_filename
fd = open(out_file, "w") fd = open(out_file, "w")
defspec = 0 defspec = 0
defvariant = "" defvariant = ""

View File

@ -114,11 +114,17 @@ def include_file_in_rd_header(filename: str, header_data: RDHeaderStruct, depth:
return header_data 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() header_data = header_data or RDHeaderStruct()
include_file_in_rd_header(filename, header_data, 0) include_file_in_rd_header(filename, header_data, 0)
if optional_output_filename is None:
out_file = filename + ".gen.h" out_file = filename + ".gen.h"
else:
out_file = optional_output_filename
out_file_base = out_file 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 :]
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): def build_rd_headers(target, source, env):
for x in source: for x in source:
build_rd_header(str(x)) build_rd_header(filename=str(x))
class RAWHeaderStruct: class RAWHeaderStruct:
@ -193,11 +199,17 @@ def include_file_in_raw_header(filename: str, header_data: RAWHeaderStruct, dept
fs.close() 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() header_data = header_data or RAWHeaderStruct()
include_file_in_raw_header(filename, header_data, 0) include_file_in_raw_header(filename, header_data, 0)
if optional_output_filename is None:
out_file = filename + ".gen.h" 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.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 :]
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): def build_raw_headers(target, source, env):
for x in source: for x in source:
build_raw_header(str(x)) build_raw_header(filename=str(x))
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -32,8 +32,8 @@
#define FSR_RD_H #define FSR_RD_H
#include "../pipeline_cache_rd.h" #include "../pipeline_cache_rd.h"
#include "../shaders/effects/fsr_upscale.glsl.gen.h"
#include "../storage_rd/render_scene_buffers_rd.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/renderer_scene_render.h"
#include "servers/rendering_server.h" #include "servers/rendering_server.h"