Moving glslang dependencies build out of the VulkanSceneGraph as back to optional external dependency #1199
Replies: 19 comments 22 replies
-
In my testing the 1.3.283 Vulkan SDK for Windows was still missing |
Beta Was this translation helpful? Give feedback.
-
To make it possible to check the VSG version to deter,mine when glslang is an external dependency I have just bumped the VSG version to 1.1.5 in the external_glslang branch 16b8369 When testing external_glslang branch on Windows I found out, as Chris mentions above, that VulkanSDK-1.3.283's inclusion of gslang is a bit broken, so had to fallback to using the glslang in vcpkg. I had to update my vcpkg to get the latest version of their glslang which is now 14.2. With the vcpkg installed everything worked great, including fixes a crash that was happening due to the glslang fork that the VSG was compiling in prior to the external_glslang branch, |
Beta Was this translation helpful? Give feedback.
-
I made tests on macOS today. The VulkanSDK-1.3.283's inclusion of gslang is a bit broken indeed. Using a glslang installation provided by homebrew (a package manager for Mac) worked out of the box. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the testing @rainergericke. Which version of glslang comes with homebrew? |
Beta Was this translation helpful? Give feedback.
-
glslang --version: Glslang Version: 11:14.2.0 |
Beta Was this translation helpful? Give feedback.
-
Thanks. 14.2 is the version I saw with vcpkg on Windows as well. |
Beta Was this translation helpful? Give feedback.
-
We'll need to update the platform specific dependency and install notes to mention how to install glslang. @rainergericke could you provide a bit of text & command line (if it's command line) on installing glsalng from homebrew so it can be included in the INSTALL.md notes? A PR would be fine too. |
Beta Was this translation helpful? Give feedback.
-
Installation of vsg with external glslang is straight forward on the Mac:
/sourceDirPath and /PrefixDirPath must be set to the user needs. |
Beta Was this translation helpful? Give feedback.
-
Tested on the
To install glslang-devel for the header files and unversioned libs, run
Build commands used:
|
Beta Was this translation helpful? Give feedback.
-
Rockylinux 8 still ships with glslang 12.2 |
Beta Was this translation helpful? Give feedback.
-
As testing looked to have gone relatively smoothly I have gone ahead and merged the external_glslang branch with VSG master: The VSG version has been bumped to 1.1.5 in prep for me tagging another developer release tomorrow. Could folks test VSG master and let me know if there are issues, or if there a refinements to the INSTALL.md docs to help guide developers on different platform combinations please post them here or generate a PR for them. Thanks. |
Beta Was this translation helpful? Give feedback.
-
My tests of VSG version 1.1.5 were successful on macOS 14.5. |
Beta Was this translation helpful? Give feedback.
-
Windows 10: [cmake] glslang not found. ShaderCompile support disabled. EDIT: I also noticed that there's no glslangConfig.cmake in the lib\cmake folder |
Beta Was this translation helpful? Give feedback.
-
Anton could you try the glslang in vcpkg rather than the one currently provided by the VulkanSDK, this one does at least have the correct CMake config support. As Chris mentions LunarG haven't correctly handled the cmake config files for glslang in the Windows VulkanSDK so for now under Windows we'll need to fallback to using vcpkg or building and install glslang from source. Hopefully LunarG will sort it out for the next release of VulkanSDK. |
Beta Was this translation helpful? Give feedback.
-
I haven't worked on vsgFramework recently but it could be useful for folks that are finding it awkward to build dependencies alongside the VulkanSceneGraph. Tomorrow I'll update it to include building glslang before the VSG in prep for the VSG-1.0.5 release that I'll make this coming week. |
Beta Was this translation helpful? Give feedback.
-
@robertosfield Probably there is an issue on Windows with latest master and maybe this is related to glslang changes. I was using instance positions and after upgrade it started to crash. I've reproduced this on a modified example. In vsgbuilder example 'box if' changed to this:
And on Visual Studio 2022 on windows 11 it crashes. The callstack:
I take glslang from vcpkg. Current glslang version there is 14.2.0. Failing point in glslang is builder.setBuildPoint(shaderEntry->getLastBlock());
shaderEntry is null and this causes access violation. Maybe this is a miss configuration on my side, but I don't know what can be done else. |
Beta Was this translation helpful? Give feedback.
-
Check if your VSG picked up on glslang. If it isn't the VSG will still
build but without shader compile support and won't be able to handle all
SHaderSet combinations
…On Sun, 23 Jun 2024, 00:27 Mikałaj, ***@***.***> wrote:
@robertosfield <https://github.com/robertosfield> Probably there is an
issue on Windows with latest master and maybe this is related to glslang
changes. I was using instance positions and after upgrade it started to
crash. I've reproduced this on a modified example. In vsgbuilder example
'box if' changed to this:
if (box)
{
geomInfo.position += geomInfo.dx * 1.5f;
auto positions = vsg::vec3Array::create(5);
geomInfo.positions = positions;
for (int i = 0; i < 5; ++i)
{
(*positions)[i].set(geomInfo.position.x, geomInfo.position.y, geomInfo.position.z + i * 4);
}
stateInfo.instance_positions_vec3 = true;
auto node = builder->createBox(geomInfo, stateInfo);
bound.add(geomInfo.position);
if (auto sg = node.cast<vsg::StateGroup>(); sg && inherit)
{
options->inheritedState = sg->stateCommands;
scene = sg;
}
else
{
scene->addChild(node);
}
stateInfo.instance_positions_vec3 = false;
}
And on Visual Studio 2022 on windows 11 it crashes. The callstack:
> vsgbuilder.exe!std::vector<spv::Block *,std::allocator<spv::Block *>>::back() Line 1954 C++
vsgbuilder.exe!spv::Function::getLastBlock() Line 389 C++
vsgbuilder.exe!`anonymous namespace'::TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TIntermAggregate * node) Line 2967 C++
vsgbuilder.exe!glslang::TIntermAggregate::traverse(glslang::TIntermTraverser * it) Line 159 C++
vsgbuilder.exe!`anonymous namespace'::TGlslangToSpvTraverser::visitFunctions(const glslang::TVector<TIntermNode *> & glslFunctions) Line 5660 C++
vsgbuilder.exe!`anonymous namespace'::TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TIntermAggregate * node) Line 2926 C++
vsgbuilder.exe!glslang::TIntermAggregate::traverse(glslang::TIntermTraverser * it) Line 159 C++
vsgbuilder.exe!glslang::GlslangToSpv(const glslang::TIntermediate & intermediate, std::vector<unsigned int,std::allocator<unsigned int>> & spirv, spv::SpvBuildLogger * logger, glslang::SpvOptions * options) Line 10383 C++
vsgbuilder.exe!vsg::ShaderCompiler::compile(std::vector<vsg::ref_ptr<vsg::ShaderStage>,std::allocator<vsg::ref_ptr<vsg::ShaderStage>>> & shaders, const std::vector<std::string,std::allocator<std::string>> & defines, vsg::ref_ptr<vsg::Options const> options) Line 287 C++
vsgbuilder.exe!vsg::GraphicsPipeline::compile(vsg::Context & context) Line 161 C++
vsgbuilder.exe!vsg::BindGraphicsPipeline::compile(vsg::Context & context) Line 284 C++
vsgbuilder.exe!vsg::CompileTraversal::apply(vsg::Compilable & node) Line 241 C++
vsgbuilder.exe!vsg::Visitor::apply(vsg::Command & value) Line 709 C++
vsgbuilder.exe!vsg::Visitor::apply(vsg::StateCommand & value) Line 713 C++
vsgbuilder.exe!vsg::Visitor::apply(vsg::BindGraphicsPipeline & value) Line 769 C++
vsgbuilder.exe!vsg::Inherit<vsg::StateCommand,vsg::BindGraphicsPipeline>::accept(vsg::Visitor & visitor) Line 70 C++
vsgbuilder.exe!vsg::StateGroup::t_traverse<vsg::StateGroup,vsg::Visitor>(vsg::StateGroup & node, vsg::Visitor & visitor) Line 69 C++
vsgbuilder.exe!vsg::StateGroup::traverse(vsg::Visitor & visitor) Line 73 C++
vsgbuilder.exe!vsg::CompileTraversal::apply(vsg::Object & object) Line 232 C++
vsgbuilder.exe!vsg::Visitor::apply(vsg::Node & value) Line 530 C++
vsgbuilder.exe!vsg::Visitor::apply(vsg::Group & value) Line 542 C++
vsgbuilder.exe!vsg::Visitor::apply(vsg::StateGroup & value) Line 558 C++
vsgbuilder.exe!vsg::Inherit<vsg::Group,vsg::StateGroup>::accept(vsg::Visitor & visitor) Line 70 C++
vsgbuilder.exe!vsg::Group::t_traverse<vsg::Group,vsg::Visitor>(vsg::Group & node, vsg::Visitor & visitor) Line 51 C++
vsgbuilder.exe!vsg::Group::traverse(vsg::Visitor & visitor) Line 54 C++
vsgbuilder.exe!vsg::CompileTraversal::apply(vsg::Object & object) Line 232 C++
vsgbuilder.exe!vsg::Visitor::apply(vsg::Node & value) Line 530 C++
vsgbuilder.exe!vsg::Visitor::apply(vsg::Group & value) Line 542 C++
vsgbuilder.exe!vsg::Inherit<vsg::Node,vsg::Group>::accept(vsg::Visitor & visitor) Line 70 C++
vsgbuilder.exe!vsg::Group::t_traverse<vsg::Group,vsg::Visitor>(vsg::Group & node, vsg::Visitor & visitor) Line 51 C++
vsgbuilder.exe!vsg::Group::traverse(vsg::Visitor & visitor) Line 54 C++
vsgbuilder.exe!vsg::CompileTraversal::apply(vsg::View & view) Line 391 C++
vsgbuilder.exe!vsg::View::t_accept<vsg::View,vsg::Visitor>(vsg::View & node, vsg::Visitor & visitor) Line 56 C++
vsgbuilder.exe!vsg::View::accept(vsg::Visitor & visitor) Line 59 C++
vsgbuilder.exe!vsg::Group::t_traverse<vsg::Group,vsg::Visitor>(vsg::Group & node, vsg::Visitor & visitor) Line 51 C++
vsgbuilder.exe!vsg::Group::traverse(vsg::Visitor & visitor) Line 54 C++
vsgbuilder.exe!vsg::CompileTraversal::apply(vsg::RenderGraph & renderGraph) Line 353 C++
vsgbuilder.exe!vsg::Inherit<vsg::Group,vsg::RenderGraph>::accept(vsg::Visitor & visitor) Line 70 C++
vsgbuilder.exe!vsg::Group::t_traverse<vsg::Group,vsg::Visitor>(vsg::Group & node, vsg::Visitor & visitor) Line 51 C++
vsgbuilder.exe!vsg::Group::traverse(vsg::Visitor & visitor) Line 54 C++
vsgbuilder.exe!vsg::CompileTraversal::apply(vsg::CommandGraph & commandGraph) Line 278 C++
vsgbuilder.exe!vsg::Inherit<vsg::Group,vsg::CommandGraph>::accept(vsg::Visitor & visitor) Line 70 C++
vsgbuilder.exe!vsg::Viewer::compile(vsg::ref_ptr<vsg::ResourceHints> hints) Line 378 C++
vsgbuilder.exe!main(int argc, char * * argv) Line 327 C++
vsgbuilder.exe!invoke_main() Line 79 C++
vsgbuilder.exe!__scrt_common_main_seh() Line 288 C++
vsgbuilder.exe!__scrt_common_main() Line 331 C++
vsgbuilder.exe!mainCRTStartup(void * __formal) Line 17 C++
kernel32.dll!00007ffede03257d() Unknown
ntdll.dll!00007ffedef6af28() Unknown
I take glslang from vcpkg. Current glslang version there is 14.2.0.
Failing point in glslang is
builder.setBuildPoint(shaderEntry->getLastBlock());
case glslang::EOpFunction:
if (visit == glslang::EvPreVisit) {
if (options.generateDebugInfo) {
builder.setDebugSourceLocation(node->getLoc().line, node->getLoc().getFilename());
}
if (isShaderEntryPoint(node)) {
inEntryPoint = true;
builder.setBuildPoint(shaderEntry->getLastBlock());
builder.enterFunction(shaderEntry);
currentFunction = shaderEntry;
} else {
handleFunctionEntry(node);
}
shaderEntry is null and this causes access violation. Maybe this is a miss
configuration on my side, but I don't know what can be done else.
—
Reply to this email directly, view it on GitHub
<#1199 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKEGUGNEPCYEOE73RLC4B3ZIYB4ZAVCNFSM6AAAAABIDHBF7SVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TQNBZGI4TI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Long time Windows C++ hack here but not a regular user of cmake or vcpkg. Using VisualStudio 2022, I need glslang to use vsgPoints and had quite a time getting this all to work. It turns out vcpkg in Visual Studio 2022 also has issues, see https://superuser.com/questions/1829880/vcpkg-could-not-locate-a-manifest-vcpkg-json which I got around by using vcpkg from Visual Studio 2017. Unfortunately, the vsg cmake does not like the results so I ended up cloning and building glslang and SPIRV from github, links below; GLSLang, https://github.com/KhronosGroup/glslang Rebuilding vsg then led to a bunch of import errors; CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: CMake Error in CMakeLists.txt: Generating done (0.1s) My workaround here was to manually add the glslang and SPIRV directories and libraries to all the vsg visual studio solutions, removing the otherwise linked Vulkan SDK ones. My thinking that having an installer with pre-built solutions and libraries would be a significant boon for potential new Windows vsg users coming from a different tool-chain as getting a vsg development environment up and running under Windows is a long and frustrating exercise for those of us not overly familiar with cmake. |
Beta Was this translation helpful? Give feedback.
-
As I've said in a few places now, if you're not already familiar with vcpkg, it's probably easiest for Windows users to just build glslang according to the instructions in its readme, which basically amount to cd <parent of where you want glslang to be>
git clone https://github.com/KhronosGroup/glslang.git
cd glslang
.\update_glslang_sources.py
mkdir build
cd build
# this will probably default to the latest Visual Studio generator you've got installed and require no extra arguments
cmake ..
# feel free to specify RelWithDebInfo or Debug or to do this for more than one config
cmake --build . --config Release
cmake --install . --config Release --prefix ..\install and then simply specify |
Beta Was this translation helpful? Give feedback.
-
In the early days of development the VulkanSceneGraph linked to glslang as an external dependency but this was fraught with issues of different 3rd party repositories presenting different versions of glslang and packaging them in inconsistent ways, and the versioning of glslang at times as well - it was nightmare trying to keep the VSG building cleanly with all these combinations of how glslang presented itself.
The solution I ended up with was to build the glslang source code as part of the VulkanSceneGraph itself. To achieve this I had to branch glslang and fixes a large number of warnings - VulkanSceneGraph uses stricter warning levels than glslang, but it's worked reasonably well - it's pretty unobtrusive for most users. However, it's not idea, it's a workaroud to what was a tangled mess of inconsistencies.
Fast forward to do today and glslang-14.x is finally becoming more consistent distributed - LunarG's VulkanSDK 1.3.283.0 now includes a modern enough glslang, it's header and crucially the cmake config files on all platform build combinations. vcpkg inlcudes glslang and a modern enough version of gslang is included in K/Ubuntu 24.04 LTS, and the glslang repo itself is good enough place to rely upon.
This improvement in the availability of glslang-14.x in usable forms means we can revisit how we include glslang and try out linking to as an optional dependency, so as a trial I have created an external_glslang branch that gets rid of the internal gslang build and just links to the external glslang:
https://github.com/vsg-dev/VulkanSceneGraph/tree/external_glslang
I have tested under Kubuntu 20.04, 22.04 and 24.04, and will be continuing testing of Windows 11 today. Under Kubuntu 20.04 and 22.04 the version of glslang they provide is not modern enough so if you want to use runtime shader compilation then you need to build glslang from source or use VulkanSDK-1.3.283.0 or later. Under Windows's using VulkanSDK-1.3.283.0 or later should be sufficient, as well as pulling in glslang fom vcpkg - but that's something I'll confirming today.
I would appreciate members of the community testing out the external_glslang branch on their systems. CMake configure step will say if it's found an appropriate version of glslang or not. If it doesn't find a suitable version then the VSG build will work fine but won't be able to build in support for compiling GLSL shaders to SPIRV at runtime.
The current vsgshadow example default code path utilizes shadow compilation so just running it will let you know if everything is built with glslang successfully, checked the include/vsg/Version.h for the include/vsg/core/Version.h will also show support or not, the is what mine looks like right now with support:
While I have access to various versions of Kubuntu and Windows 11 here I don't have prior versions of Windows, Android, macOS or other Linux distros so I am reliant on members of the community with these systems to test things out.
I have updated the build instructions a little already to reflect these changes but I'll need to refine them further before the VulkanSceneGraph-1.2 stable release, so please have a read through those as well and make suggestion/amendments to make them more helpful and up to date.
Thanks.
Robert.
Beta Was this translation helpful? Give feedback.
All reactions