LLGI is a cross-platform graphics abstraction library that provides a common API for DirectX 12, Metal, and Vulkan.
This repository currently contains:
LLGI: the core static libraryLLGI_Test: rendering and shader tests (BUILD_TEST=ON)example_glfw,example_imgui,example_GPUParticle: sample applications (BUILD_EXAMPLE=ON)ShaderTranspiler: shader conversion tool (BUILD_TOOL=ON)
| Platform | Default backend | Optional backends | Notes |
|---|---|---|---|
| Windows | DirectX 12 | Vulkan | CI builds both x86 and x64 configurations. |
| macOS | Metal | - | CI builds with CMAKE_OSX_DEPLOYMENT_TARGET=10.15. |
| iOS | Metal | - | CI includes an iOS build configuration. |
| Linux | Vulkan | - | BUILD_VULKAN is forced to ON on Linux. |
| Path | Description |
|---|---|
src/ |
LLGI library sources and public headers |
src_test/ |
Test executable and shader test assets |
examples/ |
GLFW, Dear ImGui, and GPU particle samples |
tools/ |
Shader transpiler sources |
scripts/transpile.py |
Helper script to batch-convert shader assets |
thirdparty/ |
Bundled third-party dependencies used by Vulkan compiler/tool builds |
git clone https://github.com/effekseer/LLGI.git
cd LLGI
git submodule update --init --recursive- CMake 3.15 or newer
- A C++ toolchain for your platform (
Visual Studio,Xcode,clang, orgcc) - On Linux, Vulkan and X11 development packages
- When
BUILD_VULKAN_COMPILERorBUILD_TOOLis enabled, the bundledglslangandSPIRV-Crosssubmodules are used by default
Linux packages used in CI:
sudo apt-get update
sudo apt-get install -y \
libx11-dev \
libxrandr-dev \
libxi-dev \
libxinerama-dev \
libxcursor-dev \
libudev-dev \
libx11-xcb-dev \
libglu1-mesa-dev \
mesa-common-dev \
libvulkan-dev| Option | Default | Description |
|---|---|---|
BUILD_TEST |
OFF |
Build LLGI_Test |
BUILD_EXAMPLE |
OFF |
Build sample applications |
BUILD_TOOL |
OFF |
Build ShaderTranspiler |
BUILD_VULKAN |
OFF (ON on Linux) |
Enable the Vulkan backend |
BUILD_VULKAN_COMPILER |
OFF |
Enable Vulkan shader compilation support in LLGI::CreateCompiler |
USE_CREATE_COMPILER_FUNCTION |
ON |
Keep LLGI::CreateCompiler enabled |
USE_MSVC_RUNTIME_LIBRARY_DLL |
ON |
Use the DLL MSVC runtime (/MD) |
cmake -S . -B build -DBUILD_TEST=ON -DBUILD_EXAMPLE=ON
cmake --build build --config ReleaseFor a 32-bit build:
cmake -S . -B build -A Win32 -DBUILD_TEST=ON
cmake --build build --config Releasecmake -S . -B build \
-DBUILD_TEST=ON \
-DBUILD_EXAMPLE=ON \
-DBUILD_TOOL=ON \
-DBUILD_VULKAN=ON \
-DBUILD_VULKAN_COMPILER=ON
cmake --build build --config Releasecmake -S . -B build -G Xcode \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DBUILD_TEST=ON \
-DBUILD_EXAMPLE=ON
cmake --build build --config Releasecmake -S . -B build-ios -G Xcode \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
cmake --build build-ios --config Releasecmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TEST=ON \
-DBUILD_EXAMPLE=ON \
-DBUILD_TOOL=ON \
-DBUILD_VULKAN_COMPILER=ON
cmake --build buildOn Linux, BUILD_VULKAN is enabled automatically by the top-level
CMakeLists.txt.
cmake --install build --prefix <install-prefix>For multi-config generators such as Visual Studio or Xcode, add
--config Release.
The install step exports the LLGI static library, public headers, and CMake
package files under lib/cmake.
LLGI_Test is available when BUILD_TEST=ON.
Default device selection:
- Windows: DirectX 12
- macOS/iOS: Metal
- Linux: Vulkan
Examples:
# Linux / macOS
./build/src_test/LLGI_Test
./build/src_test/LLGI_Test --filter=SimpleRender.*
# Windows
build\src_test\Release\LLGI_Test.exe
build\src_test\Release\LLGI_Test.exe --filter=Compile.*
build\src_test\Release\LLGI_Test.exe --vulkanIf you want Vulkan shader compilation through
LLGI::CreateCompiler(DeviceType::Vulkan) or the Compile.* tests on Vulkan,
configure with -DBUILD_VULKAN_COMPILER=ON.
When BUILD_EXAMPLE=ON, the following targets are built:
example_glfw: minimal clear/present flow using GLFWexample_imgui: Dear ImGui integration on top of LLGI and GLFWexample_GPUParticle: GPU particle sample
The smallest end-to-end sample is in examples/glfw/main.cpp.
When BUILD_TOOL=ON, the repository builds ShaderTranspiler.
The helper script below uses the built tool to batch-convert shader assets:
python scripts/transpile.py src_test/Shaders/
python scripts/transpile.py examples/GPUParticle/Shaders/Additional notes are available in tools/README.md.
auto window = std::unique_ptr<LLGI::Window>(LLGI::CreateWindow("LLGI", {1280, 720}));
LLGI::PlatformParameter parameter;
parameter.Device = LLGI::DeviceType::Default;
auto platform = LLGI::CreateSharedPtr(LLGI::CreatePlatform(parameter, window.get()));
auto graphics = LLGI::CreateSharedPtr(platform->CreateGraphics());
auto memoryPool = LLGI::CreateSharedPtr(graphics->CreateSingleFrameMemoryPool(1024 * 1024, 128));
auto commandList = LLGI::CreateSharedPtr(graphics->CreateCommandList(memoryPool.get()));For a complete runnable example, see examples/glfw/main.cpp.
LLGI is distributed under the zlib license. See LICENSE.