Merge pull request #74808 from bradc6/feature/AllowCustomOutputShaderGenFilepaths

Allow for shaders to be generated outside of the source tree
This commit is contained in:
Rémi Verschelde 2023-04-03 16:01:32 +02:00
commit 154a29d33a
No known key found for this signature in database
GPG key ID: C3336907360768E1
10 changed files with 44 additions and 22 deletions

View file

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

View file

@ -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;

View file

@ -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"

View file

@ -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 {

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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 = ""

View file

@ -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__":

View file

@ -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"