Overview of VulkanSceneGraph
mastervulkan.h which uses Apache License 2.0).repository·master·Indexed 23 days ago
https://github.com/vsg-dev/vulkanscenegraphA high-performance, cross-platform C++17 scene graph library built on top of the Vulkan API, designed for modern graphics and compute applications. It provides a framework for encapsulating Vulkan command buffer calls through a compilable command system, including support for vertex/index buffer binding, image blitting, and attachment clearing.
vulkan.h which uses Apache License 2.0).The VSG ecosystem includes several companion libraries for extended functionality:
FetchContent to pull in all main libraries and dependencies.To build VSG, ensure you meet the following requirements:
Required:
Optional:
Note on Vulkan SDK: For the latest versions, it is recommended to use the VulkanSDK provided by LunarG. After unpacking the SDK, set the VULKAN_SDK environment variable to the include/lib directory within it.
Ubuntu family:
sudo apt-get install cmake-curses-gui g++ git libvulkan-dev glslang-dev glslang-toolsFedora:
dnf install git cmake ninja-build gcc-c++ libxcb-devel vulkan-loader-devel glslc glslang-develGentoo:
emerge dev-util/vulkan-toolsmacOS (via Homebrew):
brew cmake
brew glslang
brew clang-formatStatic Library (.a) build:
git clone https://github.com/vsg-dev/VulkanSceneGraph.git
cd VulkanSceneGraph
cmake .
cmake --build . -j 16 -t installShared Library (.so) build:
git clone https://github.com/vsg-dev/VulkanSceneGraph.git
mkdir vsg-shared-build
cd vsg-shared-build
cmake ../VulkanSceneGraph -DBUILD_SHARED_LIBS=ON
cmake --build . -j 16 -t installmacOS Note: Use standard Makefiles rather than building directly in Xcode to avoid issues with code signing settings.
To use VSG in your own project, ensure you are using CMake. When VSG is installed, it provides a CMake package configuration file in lib/cmake/vsg.
Add the following to your CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
find_package(vsg REQUIRED)
add_executable(myapp "myapp.cpp")
target_link_libraries(myapp vsg::vsg)Linking to vsg::vsg automatically handles:
VSG_SHARED_LIBRARY on Windows).Requires Android NDK 18 and CMake 3.13.
Run the following CMake command (replace /location/of/Android/sdk/ndk-bundle with your actual path):
cmake ./ \
-DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_SYSTEM_NAME="Android" \
-DCMAKE_SYSTEM_VERSION=24 \
-DCMAKE_ANDROID_STL_TYPE="c++_static" \
-DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \
-DCMAKE_ANDROID_NDK=/location/of/Android/sdk/ndk-bundle \
-DCMAKE_INSTALL_PREFIX=/usr/local/android
make -j 8
make installDownload and install the Vulkan SDK (1.2.162.0 or later) from LunarG. Ensure the installer adds VK_SDK_PATH and VULKAN_SDK to your environment variables.
cmake . -G "Visual Studio 15 2017 Win64"(Note: You can also use Visual Studio 2019 or 2022 with appropriate -G flags).VSG.sln file.Program Files, you must run Visual Studio as an Administrator.git clone https://github.com/vsg-dev/VulkanSceneGraph.git
cd VulkanSceneGraph
mkdir build && cd build
cmake .. -G "Visual Studio 15 2017 Win64"
cmake --build .
cmake --install .To specify a different installation directory via CLI, use --prefix Path\To\Another\Directory with the install command.
Add the VSG install path to your CMAKE_PREFIX_PATH environment variable so other projects can find it:
CMAKE_PREFIX_PATH = C:\Program Files\VSG
Since macOS does not natively support Vulkan, you must use MoltenVK to translate Vulkan calls to Metal.
macOS subfolder.VULKAN_SDK environment variable and related MoltenVK variables so CMake can locate the SDK. You can verify the setup by running the vulkaninfo executable found in vulkansdk/macOS/bin.install target within Xcode.CMAKE_PREFIX_PATH to point to your VSG installation so other CMake projects can find it.Note for Xcode Users: Xcode often ignores system environment variables. If your application fails to run within Xcode, manually add the required environment variables (like VULKAN_SDK, VK_LAYER_PATH, etc.) to the Product > Scheme > Edit Scheme > Arguments section.
# 1. Set up environment variables (e.g., in .bash_profile)
export VULKAN_SDK="/path/to/your/vulkansdk/macOS"
export VK_LAYER_PATH="$VULKAN_SDK/etc/vulkan/explicit_layer.d"
export VK_ICD_FILENAMES="$VULKAN_SDK/etc/vulkan/icd.d/MoltenVK_icd.json"
export PATH="$VULKAN_SDK:$VULKAN_SDK/bin:$PATH"
export DYLD_LIBRARY_PATH="$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH"
# 2. Build VSG
git clone https://github.com/vsg-dev/VulkanSceneGraph.git
cd VulkanSceneGraph
cmake . -G "Xcode"
# 3. After installing VSG, set prefix for other projects
export CMAKE_PREFIX_PATH="/usr/local/lib/cmake/vsg"Use the following commands to clone the repository and build/install the static libvsg library (.a/.lib) directly in the source directory.
git clone https://github.com/vsg-dev/VulkanSceneGraph.git
cd VulkanSceneGraph
cmake .
cmake --build . -j 16 -t installTo build VulkanSceneGraph for Android, you need Android NDK 18 and CMake 3.13.
make to compile and make install to place headers and libraries in your specified prefix.git clone https://github.com/vsg-dev/VulkanSceneGraph.git
cd VulkanSceneGraph
cmake ./ \
-DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_SYSTEM_NAME="Android" \
-DCMAKE_SYSTEM_VERSION=24 \
-DCMAKE_ANDROID_STL_TYPE="c++_static" \
-DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \
-DCMAKE_ANDROID_NDK=/location/of/Android/sdk/ndk-bundle \
-DCMAKE_INSTALL_PREFIX=/usr/local/android
make -j 8
make installTo build or use VulkanSceneGraph, ensure your environment meets the following requirements:
vsg::Commands class acts as a container for multiple vsg::Command objects. It is functionally equivalent to vsg::Group but optimized for performance by reducing CPU overhead when applying the state stack prior to command calls. You can use it to group related commands together, which will then be traversed and executed as a single unit during the command recording process.