Foundation
Loading...
Searching...
No Matches

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.

Features

  • Low-level modern API (Vulkan 1.3) as first-class citizen
  • Modern C++20 codebase with minimal dependencies
  • Modern lock-free data structures at 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

Renderer

  • 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

Quickstart

A comprehensive Examples section is provided below for quickstarts and reference.

You can also check out the ModelViewer application for an advanced usage of the framework.

Examples

All examples can also be found at The Examples directory.

Building

cmake is required for builds. A C++20 compliant compiler is also required.

All third-party dependencies are included as FetchContent declarations. See 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 VulkanApplication backend.

Windows

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.

Linux

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-headers

macOS

Refer to https://docs.vulkan.org/tutorial/latest/02_Development_environment.html#_macos for setting up the Vulkan SDK on macOS.

Building from command line

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 . -j8

Build Options

The 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
FOUNDATION_WITH_MODELVIEWER Build the model viewer application 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 ...

Third party

Core

Math

Native

RHIVulkan

ModelViewer

Debugging

Or, notes to self. If you are here, well ...thanks a lot for the interest^^

Vulkan

Linux & AMD

Radeon™ Developer Tool Suite has issues with OSS AMD drivers (RADV and co), see:

On Arch https://aur.archlinux.org/packages/vulkan-amdgpu-pro seems to resolve the issue.

clang-tidy

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)"