diff --git a/Dependencies/CMakeLists.txt b/Dependencies/CMakeLists.txt index 44b69df16..22eb211c2 100644 --- a/Dependencies/CMakeLists.txt +++ b/Dependencies/CMakeLists.txt @@ -78,12 +78,14 @@ set_property(TARGET OGLCompiler PROPERTY FOLDER Dependencies/glslang) set_property(TARGET OSDependent PROPERTY FOLDER Dependencies/glslang) set_property(TARGET MachineIndependent PROPERTY FOLDER Dependencies/glslang) set_property(TARGET SPIRV PROPERTY FOLDER Dependencies/glslang) +set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER Dependencies/glslang) disable_warnings(GenericCodeGen) disable_warnings(glslang) disable_warnings(OGLCompiler) disable_warnings(OSDependent) disable_warnings(MachineIndependent) disable_warnings(SPIRV) +disable_warnings(glslang-default-resource-limits) # -------------------------------- SPIRV-Cross -------------------------------- # Dependencies: none diff --git a/Dependencies/SPIRV-Cross b/Dependencies/SPIRV-Cross index bbcef69a4..54997fb4b 160000 --- a/Dependencies/SPIRV-Cross +++ b/Dependencies/SPIRV-Cross @@ -1 +1 @@ -Subproject commit bbcef69a455fbf3e0deddf4e2eca47e57bf296e3 +Subproject commit 54997fb4bc3adeb47b9b9f7bb67f1c25eaca2204 diff --git a/Dependencies/glslang b/Dependencies/glslang index 1fa21491b..f1cb8608b 160000 --- a/Dependencies/glslang +++ b/Dependencies/glslang @@ -1 +1 @@ -Subproject commit 1fa21491bc203b1dee1b871007989d762974f284 +Subproject commit f1cb8608b390a7f51b4ae0d62cd415ba47a59b86 diff --git a/Install/Install.cmake b/Install/Install.cmake index 295520588..ff6d95c23 100644 --- a/Install/Install.cmake +++ b/Install/Install.cmake @@ -1,5 +1,9 @@ include(GNUInstallDirs) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "./install/" CACHE PATH "..." FORCE) +endif() + function(install_targets) install(TARGETS ${ARGN}) @@ -27,7 +31,7 @@ install_targets(arcana) install_targets(astc-encoder edtaa3 etc1 etc2 iqa nvtt pvrtc squish tinyexr bgfx bimg bx) ## glslang -install_targets(GenericCodeGen glslang MachineIndependent OGLCompiler OSDependent SPIRV) +install_targets(GenericCodeGen glslang MachineIndependent OGLCompiler OSDependent SPIRV glslang-default-resource-limits) ## SPIRV-Cross install_targets(spirv-cross-core spirv-cross-glsl) diff --git a/Install/Test/CMakeLists.txt b/Install/Test/CMakeLists.txt index ab6eaeece..1493c7bcc 100644 --- a/Install/Test/CMakeLists.txt +++ b/Install/Test/CMakeLists.txt @@ -171,6 +171,7 @@ target_link_libraries(TestInstall d3d12 d3dcompiler Pathcch + glslang-default-resource-limits gtest_main ${ADDITIONAL_LIBRARIES} ) diff --git a/Plugins/NativeEngine/CMakeLists.txt b/Plugins/NativeEngine/CMakeLists.txt index 98f93d779..119b23d64 100644 --- a/Plugins/NativeEngine/CMakeLists.txt +++ b/Plugins/NativeEngine/CMakeLists.txt @@ -7,8 +7,6 @@ set(SOURCES "Source/NativeEngine.cpp" "Source/NativeEngine.h" "Source/PerFrameValue.h" - "Source/ResourceLimits.cpp" - "Source/ResourceLimits.h" "Source/ShaderCompiler.h" "Source/ShaderCompilerCommon.h" "Source/ShaderCompilerCommon.cpp" @@ -41,6 +39,7 @@ target_link_libraries(NativeEngine PRIVATE bimg PRIVATE bx PRIVATE glslang + PRIVATE glslang-default-resource-limits PRIVATE SPIRV PRIVATE GraphicsDeviceContext PRIVATE napi_extensions) diff --git a/Plugins/NativeEngine/Source/ResourceLimits.cpp b/Plugins/NativeEngine/Source/ResourceLimits.cpp deleted file mode 100644 index 73d4e6313..000000000 --- a/Plugins/NativeEngine/Source/ResourceLimits.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "ResourceLimits.h" - -namespace Babylon -{ - const TBuiltInResource DefaultTBuiltInResource = { - 32, // MaxLights - 6, // MaxClipPlanes - 32, // MaxTextureUnits - 32, // MaxTextureCoords - 64, // MaxVertexAttribs - 4096, // MaxVertexUniformComponents - 64, // MaxVaryingFloats - 32, // MaxVertexTextureImageUnits - 80, // MaxCombinedTextureImageUnits - 32, // MaxTextureImageUnits - 4096, // MaxFragmentUniformComponents - 32, // MaxDrawBuffers - 128, // MaxVertexUniformVectors - 8, // MaxVaryingVectors - 16, // MaxFragmentUniformVectors - 16, // MaxVertexOutputVectors - 15, // MaxFragmentInputVectors - -8, // MinProgramTexelOffset - 7, // MaxProgramTexelOffset - 8, // MaxClipDistances - 65535, // MaxComputeWorkGroupCountX - 65535, // MaxComputeWorkGroupCountY - 65535, // MaxComputeWorkGroupCountZ - 1024, // MaxComputeWorkGroupSizeX - 1024, // MaxComputeWorkGroupSizeY - 64, // MaxComputeWorkGroupSizeZ - 1024, // MaxComputeUniformComponents - 16, // MaxComputeTextureImageUnits - 8, // MaxComputeImageUniforms - 8, // MaxComputeAtomicCounters - 1, // MaxComputeAtomicCounterBuffers - 60, // MaxVaryingComponents - 64, // MaxVertexOutputComponents - 64, // MaxGeometryInputComponents - 128, // MaxGeometryOutputComponents - 128, // MaxFragmentInputComponents - 8, // MaxImageUnits - 8, // MaxCombinedImageUnitsAndFragmentOutputs - 8, // MaxCombinedShaderOutputResources - 0, // MaxImageSamples - 0, // MaxVertexImageUniforms - 0, // MaxTessControlImageUniforms - 0, // MaxTessEvaluationImageUniforms - 0, // MaxGeometryImageUniforms - 8, // MaxFragmentImageUniforms - 8, // MaxCombinedImageUniforms - 16, // MaxGeometryTextureImageUnits - 256, // MaxGeometryOutputVertices - 1024, // MaxGeometryTotalOutputComponents - 1024, // MaxGeometryUniformComponents - 64, // MaxGeometryVaryingComponents - 128, // MaxTessControlInputComponents - 128, // MaxTessControlOutputComponents - 16, // MaxTessControlTextureImageUnits - 1024, // MaxTessControlUniformComponents - 4096, // MaxTessControlTotalOutputComponents - 128, // MaxTessEvaluationInputComponents - 128, // MaxTessEvaluationOutputComponents - 16, // MaxTessEvaluationTextureImageUnits - 1024, // MaxTessEvaluationUniformComponents - 120, // MaxTessPatchComponents - 32, // MaxPatchVertices - 64, // MaxTessGenLevel - 16, // MaxViewports - 0, // MaxVertexAtomicCounters - 0, // MaxTessControlAtomicCounters - 0, // MaxTessEvaluationAtomicCounters - 0, // MaxGeometryAtomicCounters - 8, // MaxFragmentAtomicCounters - 8, // MaxCombinedAtomicCounters - 1, // MaxAtomicCounterBindings - 0, // MaxVertexAtomicCounterBuffers - 0, // MaxTessControlAtomicCounterBuffers - 0, // MaxTessEvaluationAtomicCounterBuffers - 0, // MaxGeometryAtomicCounterBuffers - 1, // MaxFragmentAtomicCounterBuffers - 1, // MaxCombinedAtomicCounterBuffers - 16384, // MaxAtomicCounterBufferSize - 4, // MaxTransformFeedbackBuffers - 64, // MaxTransformFeedbackInterleavedComponents - 8, // MaxCullDistances - 8, // MaxCombinedClipAndCullDistances - 4, // MaxSamples - 256, // maxMeshOutputVerticesNV - 512, // maxMeshOutputPrimitivesNV - 32, // maxMeshWorkGroupSizeX_NV - 1, // maxMeshWorkGroupSizeY_NV - 1, // maxMeshWorkGroupSizeZ_NV - 32, // maxTaskWorkGroupSizeX_NV - 1, // maxTaskWorkGroupSizeY_NV - 1, // maxTaskWorkGroupSizeZ_NV - 4, // maxMeshViewCountNV - 1, // maxDualSourceDrawBuffersEXT - - // limits - { - 1, // nonInductiveForLoops - 1, // whileLoops - 1, // doWhileLoops - 1, // generalUniformIndexing - 1, // generalAttributeMatrixVectorIndexing - 1, // generalVaryingIndexing - 1, // generalSamplerIndexing - 1, // generalVariableIndexing - 1, // generalConstantMatrixVectorIndexing - }, - }; -} diff --git a/Plugins/NativeEngine/Source/ResourceLimits.h b/Plugins/NativeEngine/Source/ResourceLimits.h deleted file mode 100644 index c69ef5953..000000000 --- a/Plugins/NativeEngine/Source/ResourceLimits.h +++ /dev/null @@ -1,6 +0,0 @@ -#include - -namespace Babylon -{ - extern const TBuiltInResource DefaultTBuiltInResource; -} diff --git a/Plugins/NativeEngine/Source/ShaderCompilerD3D.h b/Plugins/NativeEngine/Source/ShaderCompilerD3D.h index ec9cad7ed..76a9ff447 100644 --- a/Plugins/NativeEngine/Source/ShaderCompilerD3D.h +++ b/Plugins/NativeEngine/Source/ShaderCompilerD3D.h @@ -3,10 +3,10 @@ #include "ShaderCompiler.h" #include "ShaderCompilerCommon.h" #include "ShaderCompilerTraversers.h" -#include "ResourceLimits.h" #include #include #include +#include #include #include #include @@ -22,7 +22,9 @@ namespace Babylon const std::array sources{source.data()}; shader.setStrings(sources.data(), gsl::narrow_cast(sources.size())); - if (!shader.parse(&DefaultTBuiltInResource, 310, EProfile::EEsProfile, true, true, EShMsgDefault)) + auto defaultTBuiltInResource = GetDefaultResources(); + + if (!shader.parse(defaultTBuiltInResource, 310, EProfile::EEsProfile, true, true, EShMsgDefault)) { throw std::runtime_error{shader.getInfoLog()}; } diff --git a/Plugins/NativeEngine/Source/ShaderCompilerMetal.cpp b/Plugins/NativeEngine/Source/ShaderCompilerMetal.cpp index 800b7822a..e8a13c023 100644 --- a/Plugins/NativeEngine/Source/ShaderCompilerMetal.cpp +++ b/Plugins/NativeEngine/Source/ShaderCompilerMetal.cpp @@ -1,10 +1,10 @@ #include "ShaderCompiler.h" #include "ShaderCompilerCommon.h" #include "ShaderCompilerTraversers.h" -#include "ResourceLimits.h" #include #include #include +#include #include #include #include @@ -18,7 +18,9 @@ namespace Babylon const std::array sources{source.data()}; shader.setStrings(sources.data(), gsl::narrow_cast(sources.size())); - if (!shader.parse(&DefaultTBuiltInResource, 310, EProfile::EEsProfile, true, true, EShMsgDefault)) + auto defaultTBuiltInResource = GetDefaultResources(); + + if (!shader.parse(defaultTBuiltInResource, 310, EProfile::EEsProfile, true, true, EShMsgDefault)) { throw std::runtime_error(shader.getInfoLog()); } diff --git a/Plugins/NativeEngine/Source/ShaderCompilerOpenGL.cpp b/Plugins/NativeEngine/Source/ShaderCompilerOpenGL.cpp index 5023f50cd..b202d80bc 100644 --- a/Plugins/NativeEngine/Source/ShaderCompilerOpenGL.cpp +++ b/Plugins/NativeEngine/Source/ShaderCompilerOpenGL.cpp @@ -1,17 +1,15 @@ #include "ShaderCompiler.h" #include "ShaderCompilerCommon.h" #include "ShaderCompilerTraversers.h" -#include "ResourceLimits.h" #include #include +#include #include #include #include namespace Babylon { - extern const TBuiltInResource DefaultTBuiltInResource; - namespace { void AddShader(glslang::TProgram& program, glslang::TShader& shader, std::string_view source) @@ -19,7 +17,9 @@ namespace Babylon const std::array sources{source.data()}; shader.setStrings(sources.data(), gsl::narrow_cast(sources.size())); - if (!shader.parse(&DefaultTBuiltInResource, 310, EProfile::EEsProfile, true, true, EShMsgDefault)) + auto defaultTBuiltInResource = GetDefaultResources(); + + if (!shader.parse(defaultTBuiltInResource, 310, EProfile::EEsProfile, true, true, EShMsgDefault)) { throw std::runtime_error(shader.getInfoLog()); } diff --git a/Plugins/NativeEngine/Source/ShaderCompilerVulkan.cpp b/Plugins/NativeEngine/Source/ShaderCompilerVulkan.cpp index e05654962..173db99ad 100644 --- a/Plugins/NativeEngine/Source/ShaderCompilerVulkan.cpp +++ b/Plugins/NativeEngine/Source/ShaderCompilerVulkan.cpp @@ -1,9 +1,9 @@ #include "ShaderCompiler.h" #include "ShaderCompilerCommon.h" #include "ShaderCompilerTraversers.h" -#include "ResourceLimits.h" #include #include +#include #include #include #include @@ -11,8 +11,6 @@ namespace Babylon { - extern const TBuiltInResource DefaultTBuiltInResource; - namespace { void AddShader(glslang::TProgram& program, glslang::TShader& shader, std::string_view source) @@ -20,7 +18,9 @@ namespace Babylon const std::array sources{source.data()}; shader.setStrings(sources.data(), gsl::narrow_cast(sources.size())); - if (!shader.parse(&DefaultTBuiltInResource, 310, EProfile::EEsProfile, true, true, EShMsgDefault)) + auto defaultTBuiltInResource = GetDefaultResources(); + + if (!shader.parse(defaultTBuiltInResource, 310, EProfile::EEsProfile, true, true, EShMsgDefault)) { throw std::runtime_error(shader.getInfoLog()); }