diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-09-27 09:39:53 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-02-11 12:02:50 +0100 |
commit | 65ad12e79ae17c72e04af03371ac32df7e37f229 (patch) | |
tree | 555c5d3d0c8f594937d061e270aa3e870a19a060 /modules/glslang | |
parent | 7458a601cecf4d6f22ffd284ebe5ec114f7f0b56 (diff) |
glslang: Disable warnings and allow unbundling
Diffstat (limited to 'modules/glslang')
-rw-r--r-- | modules/glslang/SCsub | 106 | ||||
-rw-r--r-- | modules/glslang/register_types.cpp | 15 |
2 files changed, 61 insertions, 60 deletions
diff --git a/modules/glslang/SCsub b/modules/glslang/SCsub index 7e401ff52c..8c9445436e 100644 --- a/modules/glslang/SCsub +++ b/modules/glslang/SCsub @@ -6,61 +6,63 @@ Import('env_modules') env_glslang = env_modules.Clone() # Thirdparty source files -# Not unbundled so far since not widespread as shared library -thirdparty_dir = "#thirdparty/glslang/" -thirdparty_sources = [ - "glslang/MachineIndependent/RemoveTree.cpp", - "glslang/MachineIndependent/ParseHelper.cpp", - "glslang/MachineIndependent/iomapper.cpp", - "glslang/MachineIndependent/propagateNoContraction.cpp", - "glslang/MachineIndependent/Intermediate.cpp", - "glslang/MachineIndependent/linkValidate.cpp", - "glslang/MachineIndependent/attribute.cpp", - "glslang/MachineIndependent/Scan.cpp", - "glslang/MachineIndependent/Initialize.cpp", - "glslang/MachineIndependent/Constant.cpp", - "glslang/MachineIndependent/reflection.cpp", - "glslang/MachineIndependent/limits.cpp", - "glslang/MachineIndependent/preprocessor/PpScanner.cpp", - "glslang/MachineIndependent/preprocessor/PpTokens.cpp", - "glslang/MachineIndependent/preprocessor/PpAtom.cpp", - "glslang/MachineIndependent/preprocessor/PpContext.cpp", - "glslang/MachineIndependent/preprocessor/Pp.cpp", - "glslang/MachineIndependent/InfoSink.cpp", - "glslang/MachineIndependent/intermOut.cpp", - "glslang/MachineIndependent/SymbolTable.cpp", - "glslang/MachineIndependent/glslang_tab.cpp", - "glslang/MachineIndependent/pch.cpp", - "glslang/MachineIndependent/Versions.cpp", - "glslang/MachineIndependent/ShaderLang.cpp", - "glslang/MachineIndependent/parseConst.cpp", - "glslang/MachineIndependent/PoolAlloc.cpp", - "glslang/MachineIndependent/ParseContextBase.cpp", - "glslang/MachineIndependent/IntermTraverse.cpp", - "glslang/GenericCodeGen/Link.cpp", - "glslang/GenericCodeGen/CodeGen.cpp", - "OGLCompilersDLL/InitializeDll.cpp", - "SPIRV/InReadableOrder.cpp", - "SPIRV/GlslangToSpv.cpp", - "SPIRV/SpvBuilder.cpp", - "SPIRV/SpvTools.cpp", - "SPIRV/disassemble.cpp", - "SPIRV/doc.cpp", - "SPIRV/SPVRemapper.cpp", - "SPIRV/SpvPostProcess.cpp", - "SPIRV/Logger.cpp" -] +if env['builtin_glslang']: + thirdparty_dir = "#thirdparty/glslang/" + thirdparty_sources = [ + "glslang/MachineIndependent/RemoveTree.cpp", + "glslang/MachineIndependent/ParseHelper.cpp", + "glslang/MachineIndependent/iomapper.cpp", + "glslang/MachineIndependent/propagateNoContraction.cpp", + "glslang/MachineIndependent/Intermediate.cpp", + "glslang/MachineIndependent/linkValidate.cpp", + "glslang/MachineIndependent/attribute.cpp", + "glslang/MachineIndependent/Scan.cpp", + "glslang/MachineIndependent/Initialize.cpp", + "glslang/MachineIndependent/Constant.cpp", + "glslang/MachineIndependent/reflection.cpp", + "glslang/MachineIndependent/limits.cpp", + "glslang/MachineIndependent/preprocessor/PpScanner.cpp", + "glslang/MachineIndependent/preprocessor/PpTokens.cpp", + "glslang/MachineIndependent/preprocessor/PpAtom.cpp", + "glslang/MachineIndependent/preprocessor/PpContext.cpp", + "glslang/MachineIndependent/preprocessor/Pp.cpp", + "glslang/MachineIndependent/InfoSink.cpp", + "glslang/MachineIndependent/intermOut.cpp", + "glslang/MachineIndependent/SymbolTable.cpp", + "glslang/MachineIndependent/glslang_tab.cpp", + "glslang/MachineIndependent/pch.cpp", + "glslang/MachineIndependent/Versions.cpp", + "glslang/MachineIndependent/ShaderLang.cpp", + "glslang/MachineIndependent/parseConst.cpp", + "glslang/MachineIndependent/PoolAlloc.cpp", + "glslang/MachineIndependent/ParseContextBase.cpp", + "glslang/MachineIndependent/IntermTraverse.cpp", + "glslang/GenericCodeGen/Link.cpp", + "glslang/GenericCodeGen/CodeGen.cpp", + "OGLCompilersDLL/InitializeDll.cpp", + "SPIRV/InReadableOrder.cpp", + "SPIRV/GlslangToSpv.cpp", + "SPIRV/SpvBuilder.cpp", + "SPIRV/SpvTools.cpp", + "SPIRV/disassemble.cpp", + "SPIRV/doc.cpp", + "SPIRV/SPVRemapper.cpp", + "SPIRV/SpvPostProcess.cpp", + "SPIRV/Logger.cpp" + ] -if (env["platform"]=="windows"): - thirdparty_sources.append("glslang/OSDependent/Windows/ossource.cpp") -else: - thirdparty_sources.append("glslang/OSDependent/Unix/ossource.cpp") + if (env["platform"]=="windows"): + thirdparty_sources.append("glslang/OSDependent/Windows/ossource.cpp") + else: + thirdparty_sources.append("glslang/OSDependent/Unix/ossource.cpp") -thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] + thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] + env_glslang.Prepend(CPPPATH=[thirdparty_dir]) + + env_thirdparty = env_glslang.Clone() + env_thirdparty.disable_warnings() + env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources) -env_glslang.add_source_files(env.modules_sources, thirdparty_sources) # Godot's own source files env_glslang.add_source_files(env.modules_sources, "*.cpp") -env.Prepend(CPPPATH=[thirdparty_dir]) - diff --git a/modules/glslang/register_types.cpp b/modules/glslang/register_types.cpp index b8d8dbc947..a335391d89 100644 --- a/modules/glslang/register_types.cpp +++ b/modules/glslang/register_types.cpp @@ -29,11 +29,12 @@ /*************************************************************************/ #include "register_types.h" + #include "servers/visual/rendering_device.h" -#include "thirdparty/glslang/SPIRV/GlslangToSpv.h" -#include "thirdparty/glslang/glslang/Include/Types.h" -#include "thirdparty/glslang/glslang/Public/ShaderLang.h" +#include <SPIRV/GlslangToSpv.h> +#include <glslang/Include/Types.h> +#include <glslang/Public/ShaderLang.h> static const TBuiltInResource default_builtin_resource = { /*maxLights*/ 32, @@ -145,7 +146,7 @@ static PoolVector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_s PoolVector<uint8_t> ret; - ERR_FAIL_COND_V(p_language==RenderingDevice::SHADER_LANGUAGE_HLSL,ret); + ERR_FAIL_COND_V(p_language == RenderingDevice::SHADER_LANGUAGE_HLSL, ret); EShLanguage stages[RenderingDevice::SHADER_STAGE_MAX] = { EShLangVertex, @@ -174,7 +175,7 @@ static PoolVector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_s const int DefaultVersion = 100; std::string pre_processed_code; - //preprocess + //preprocess if (!shader.preprocess(&default_builtin_resource, DefaultVersion, ENoProfile, false, false, messages, &pre_processed_code, includer)) { if (r_error) { @@ -216,17 +217,15 @@ static PoolVector<uint8_t> _compile_shader_glsl(RenderingDevice::ShaderStage p_s return ret; } - std::vector<uint32_t> SpirV; spv::SpvBuildLogger logger; glslang::SpvOptions spvOptions; glslang::GlslangToSpv(*program.getIntermediate(stages[p_stage]), SpirV, &logger, &spvOptions); - ret.resize(SpirV.size() * sizeof(uint32_t)); { PoolVector<uint8_t>::Write w = ret.write(); - copymem(w.ptr(),&SpirV[0],SpirV.size()*sizeof(uint32_t)); + copymem(w.ptr(), &SpirV[0], SpirV.size() * sizeof(uint32_t)); } return ret; |