Skip to content
nldkPublic

About

A Vulkan 1.3 renderer in C++, built as a shared library with a C API and bindings for C#, Go, Java and more.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

NRE (VulkanRenderer)

A Vulkan renderer built as a shared library (librenderer.so), with a C API (libnre_c, include/nre.h) and bindings for other languages.

How this was made

I wrote the core of the renderer myself: Vulkan setup, shaders, the pipeline, buffers, model loading, descriptor sets, textures and the skybox. Most of what came after was built with AI (Claude Code), including the C API, the language bindings, PBR lighting and these docs. Commits made with Claude are marked Co-Authored-By: Claude.

Dependencies

Toolchain

What Version Why
C++ compiler GCC 15+ CMAKE_CXX_STANDARD 26, and #embed in src/renderer/defaultAssets/defaultAssets.h
CMake 3.28+ With GCC, a newer CMake that knows GCC's C++26 flag (3.31 works; 3.28 doesn't)
Ninja any Generator used by the presets in CMakePresets.json

Apps that only use the public headers need C++23 (std::expected), not C++26.

System packages

What Version Used for
Vulkan loader any (libvulkan.so.1; the dev package isn't needed) Linked by librenderer.so
GPU driver Vulkan 1.3 Running it
glslc (shaderc) any with --target-env=vulkan1.3 Compiling the built-in and example shaders
GLFW 3.4+, optional Window and input. Without it (or with an older one) CMake builds GLFW 3.4 from source
X11 + Wayland dev packages only when GLFW is built from source GLFW's X11 and Wayland backends. Turn one off with -DGLFW_BUILD_X11=OFF / -DGLFW_BUILD_WAYLAND=OFF
Vulkan validation layers optional Validation in Debug builds (RENDERER_ENABLE_VALIDATION)

The Vulkan headers aren't taken from the system: they're fetched (see below), so an older SDK or distro package works.

On Arch:

sudo pacman -S gcc cmake ninja vulkan-icd-loader shaderc glfw vulkan-validation-layers

On Ubuntu 24.04 / Debian (GLFW from source; GCC 15 from the ubuntu-toolchain-r/test PPA, a recent CMake from Kitware):

sudo apt install ninja-build libvulkan1 glslc \
    libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev \
    libwayland-dev libxkbcommon-dev wayland-protocols pkg-config

Fetched by CMake

These are downloaded at configure time with FetchContent and pinned, so nothing needs installing. They're built statically into librenderer.so and not exported, except GLM, which is in the public headers.

Library Version Used for
Vulkan-Headers 1.4.363 Vulkan API headers (vk-bootstrap uses 1.4 types)
Vulkan-Utility-Libraries 1.4.363 vk_enum_string_helper.h (headers only)
GLFW 3.4 Only when the system has no GLFW 3.4+
vk-bootstrap 558b002 (main, 2026-10-07) Instance, device and swapchain setup
VulkanMemoryAllocator 3.3.0 GPU memory allocation
GLM 1.0.1 Math (public API)
fastgltf 0.9.1 glTF loading. Bundles its own simdjson, even when one is installed (-DCMAKE_DISABLE_FIND_PACKAGE_simdjson=OFF uses the system's)
tinyobjloader 2.0.0rc13 OBJ loading
stb_image 31c1ad3 Texture loading

Optional tools

What Used for
Doxygen, Graphviz API reference: scripts/docs.sh
Docker Linux release build: scripts/release/build-linux.sh
MinGW-w64 GCC, llvm-lib, bubblewrap, curl, zip Windows release build: scripts/release/build-windows.sh

Each language binding has its own toolchain requirements; see bindings/README.md.

Building

cmake -S . -B cmake-build-debug -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build cmake-build-debug
./cmake-build-debug/bin/VulkanRenderer
Option Default
NRE_UNSAFE_API OFF Build NRE::Unsafe (renderer_unsafe.h): raw Vulkan/GLFW handles. Also enables the GPU tests. The *-unsafe presets turn it on.
NRE_C_API ON Build libnre_c

Tests: ctest --test-dir cmake-build-debug.

About

A Vulkan 1.3 renderer in C++, built as a shared library with a C API and bindings for C#, Go, Java and more.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages