Skip to content

Commit

Permalink
Update glslang and SPIRV-Cross (#1285)
Browse files Browse the repository at this point in the history
Update glslang to version 13.0.0 and SPIRV-Cross to latest main branch.
When updating glslang it now has a better way for setting default
resource limits, that removes the need for "ResourceLimits.h".
  • Loading branch information
SergioRZMasson authored Sep 20, 2023
1 parent 420364e commit 1456d20
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 136 deletions.
2 changes: 2 additions & 0 deletions Dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dependencies/SPIRV-Cross
Submodule SPIRV-Cross updated 1478 files
2 changes: 1 addition & 1 deletion Dependencies/glslang
Submodule glslang updated 1287 files
6 changes: 5 additions & 1 deletion Install/Install.cmake
Original file line number Diff line number Diff line change
@@ -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})

Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Install/Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ target_link_libraries(TestInstall
d3d12
d3dcompiler
Pathcch
glslang-default-resource-limits
gtest_main
${ADDITIONAL_LIBRARIES}
)
Expand Down
3 changes: 1 addition & 2 deletions Plugins/NativeEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
113 changes: 0 additions & 113 deletions Plugins/NativeEngine/Source/ResourceLimits.cpp

This file was deleted.

6 changes: 0 additions & 6 deletions Plugins/NativeEngine/Source/ResourceLimits.h

This file was deleted.

6 changes: 4 additions & 2 deletions Plugins/NativeEngine/Source/ShaderCompilerD3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include "ShaderCompiler.h"
#include "ShaderCompilerCommon.h"
#include "ShaderCompilerTraversers.h"
#include "ResourceLimits.h"
#include <arcana/experimental/array.h>
#include <bgfx/bgfx.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/Public/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h>
#include <spirv_parser.hpp>
#include <spirv_hlsl.hpp>
Expand All @@ -22,7 +22,9 @@ namespace Babylon
const std::array<const char*, 1> sources{source.data()};
shader.setStrings(sources.data(), gsl::narrow_cast<int>(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()};
}
Expand Down
6 changes: 4 additions & 2 deletions Plugins/NativeEngine/Source/ShaderCompilerMetal.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "ShaderCompiler.h"
#include "ShaderCompilerCommon.h"
#include "ShaderCompilerTraversers.h"
#include "ResourceLimits.h"
#include <arcana/experimental/array.h>
#include <bgfx/bgfx.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/Public/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h>
#include <spirv_parser.hpp>
#include <spirv_msl.hpp>
Expand All @@ -18,7 +18,9 @@ namespace Babylon
const std::array<const char*, 1> sources{source.data()};
shader.setStrings(sources.data(), gsl::narrow_cast<int>(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());
}
Expand Down
8 changes: 4 additions & 4 deletions Plugins/NativeEngine/Source/ShaderCompilerOpenGL.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#include "ShaderCompiler.h"
#include "ShaderCompilerCommon.h"
#include "ShaderCompilerTraversers.h"
#include "ResourceLimits.h"
#include <arcana/experimental/array.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/Public/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h>
#include <spirv_parser.hpp>
#include <spirv_glsl.hpp>

namespace Babylon
{
extern const TBuiltInResource DefaultTBuiltInResource;

namespace
{
void AddShader(glslang::TProgram& program, glslang::TShader& shader, std::string_view source)
{
const std::array<const char*, 1> sources{source.data()};
shader.setStrings(sources.data(), gsl::narrow_cast<int>(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());
}
Expand Down
8 changes: 4 additions & 4 deletions Plugins/NativeEngine/Source/ShaderCompilerVulkan.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#include "ShaderCompiler.h"
#include "ShaderCompilerCommon.h"
#include "ShaderCompilerTraversers.h"
#include "ResourceLimits.h"
#include <arcana/experimental/array.h>
#include <glslang/Public/ShaderLang.h>
#include <glslang/Public/ResourceLimits.h>
#include <SPIRV/GlslangToSpv.h>
#include <spirv_parser.hpp>
#include <spirv_glsl.hpp>
#include <bgfx/bgfx.h>

namespace Babylon
{
extern const TBuiltInResource DefaultTBuiltInResource;

namespace
{
void AddShader(glslang::TProgram& program, glslang::TShader& shader, std::string_view source)
{
const std::array<const char*, 1> sources{source.data()};
shader.setStrings(sources.data(), gsl::narrow_cast<int>(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());
}
Expand Down

0 comments on commit 1456d20

Please sign in to comment.