Foundation is a work-in-progress cross-platform rendering framework.
Heavily inspired by Arseny Kapoulkine's niagara, bgfx, and Unreal Engine, this project aims to provide a high-performance, low overhead rendering framework for extremely fast prototyping of various GPU workloads.
- Low-level modern API (Vulkan 1.3) as first-class citizen
- Modern C++20 codebase with minimal dependencies
- Modern lock-free data structures at @ref Foundation::Atomics for low-contention, high-concurrency workloads
- Explict thread safe guarantees - you pay for what you use
- Arena allocation strategies for minimal fragmentation and latency in hot paths
- Optional profiling integration with Tracy Profiler
- Full SPIR-V shader reflection support with automatic pipeline binding and generation
- Slang as the primary shading language
- Frame Graph/Frame Pass architecture with optimized resource barrier placement
- Async Compute support for modern GPUs with automatic release/acquire and synchronization
- Multithreaded command recording with automatic command buffer merging
- Unreal Render Dependency Graph inspired syntax without esoteric macros
A comprehensive Examples section is provided below for quickstarts and reference.
You can also check out the @ref Editor application for an advanced usage of the framework.
All examples can also be found at The Examples directory.
cmake is required for builds. A C++20 compliant compiler is also required.
All third-party dependencies are included as FetchContent declarations. See @ref Thirdparty for a comprehensive list.
Slang is required for building shaders for all backends, and should be available in your PATH.
Vulkan SDK is required for building the @ref VulkanApplication backend.
You can build, and debug the app with Visual Studio's CMake intergration. Or with any alternative CMake workflow of your choice.
The Vulkan SDK installer should take care of most, if not all the setup for you.
Refer to https://docs.vulkan.org/tutorial/latest/02_Development_environment.html#_linux_2 for setting up the Vulkan SDK on Linux.
- Arch Linux
# Enable [extra-testing] in /etc/pacman.conf for the latest validation layers et al
sudo pacman -S vulkan-validation-layers vulkan-tools vulkan-radeon vulkan-headersRefer to https://docs.vulkan.org/tutorial/latest/02_Development_environment.html#_macos for setting up the Vulkan SDK on macOS.
The following commands will create a build directory, generate the build system files, and build all targets with 8 parallel jobs.
Binary artifacts will be located in build/bin/.
mkdir build
cd build
cmake ..
cmake --build . -j8The following CMake options are available:
| Option | Description | Default |
|---|---|---|
| FOUNDATION_WITH_ASAN | Build with Address Sanitizer enabled | OFF |
| FOUNDATION_WITH_TSAN | Build with Thread Sanitizer enabled | OFF |
| FOUNDATION_WITH_PROFILING | Build with profiler (Tracy) enabled | ON |
| FOUNDATION_RHIVULKAN_VALIDATION_LAYER | Build with Vulkan Validation Layer enabled | ON |
| FOUNDATION_WITH_EXAMPLES | Build examples | ON |
| FOUNDATION_WITH_TESTS | Build tests | ON |
Toggle these options with -D<OPTION>=ON/OFF when running cmake .., e.g. cmake -DFOUNDATION_WITH_SANITIZERS=ON ..
CMake Unity Builds are supported, and can be enabled with -DCMAKE_UNITY_BUILD=ON when running cmake ...
- https://github.com/microsoft/mimalloc.git
- https://github.com/fmtlib/fmt.git
- https://github.com/gabime/spdlog.git
- https://github.com/wolfpld/tracy.git
- https://github.com/nothings/stb.git
- https://github.com/thisistherk/fast_obj
- https://github.com/zeux/meshoptimizer.git
Or, notes to self. If you are here, well ...thanks a lot for the interest^^
- VVL Timeline resource tracking has been an issue - though should be resolved by now. Always update the SDK to the latest version.
- RenderDoc is generally enough for most debugging tasks.
- Though some esoteric issues would eventually require HW specific tools for accurate timing and performance metrics.
- NSight™ Graphics for NVIDIA GPUs
- Radeon™ Developer Tool Suite
mkdir build
cd build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
# Get the script from https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/tool/run-clang-tidy.py
python run-clang-tidy.py -header-filter=".*/Source/.*" ".*/Source/.*" -config "$(cat ../.clang-tidy)"