Releases: Erellu/fubuki
v1.0.0.0
🎉 Fubuki is open-source! 🎉
About
Idiomatic C++23 cross-platform composable abstraction framework for Vulkan and low-level graphics.
Fubuki is designed to be both idiomatic (modern) C++ and idiomatic low-level graphics code.
Documentation
- Tutorials: see /tutorials.
- Doxygen: run
doxygen
on theDoxyfile
available at the repository root. - Style guide, design notes, contribution guidelines: see /doc.
Highlights
- Minimally-invasive abstractions thanks to the pass-by-view paradigm.
- Fubuki's API is designed to limit the changes required in existing code to benefit from its features.
- Reports error with
std::expected
unless otherwise specified.- Constructors that can
throw
have anoexcept
equivalent factory function.
- Constructors that can
- Compile-time validated
pNext
chain. - Compile-time validated loading system for Vulkan function pointers (
PFN
).fubuki::invoke<"vkFunctionName">
/fubuki::fuyu::invoke<"...">
invoke the corresponding Vulkan function with zero runtime overhead.
- Platform-agnostic API to create native window surfaces.
- Platform-agnostic API to interact with the keyboard, the mouse and display monitor (under the restrictions of the platform).
- Accessible internals for custom platform-specific code.
fubuki::small_vector
(vector
with Small Buffer Optimisation - SBO)- Much, much more. For a slightly more in-depth overview of the features Fubuki provides, see the corresponding
README.md
in each library:
Compiler support
Compiler | Platform | Manually tested | CI-tested |
---|---|---|---|
clang-19 |
Linux | ✅ | ✅ |
gcc-14 |
Linux | ✅ | ✅ |
MSVC-2022 |
Windows | ✅ | ✅ |
MinGW/gcc-13 |
Windows | ✅ | ❌ |
MinGW/LLVM-17 |
Windows | ✅ | ❌ |
Dependencies
- Vulkan SDK.
- Fubuki code is provided for
1.4.309.0
. - Version-dependent code can be regenerated for any other SDK version which uses a compatible format for the Vulkan registry. See the maintenance documentation.
- Fubuki code is provided for
- CMake 3.23 or later.
- A compiler supporting C++23.
- Python 3.9 or above (see https://www.python.org/ for installation details).
doxygen
(if you want to build the Doxygen documentation)
Linux-specific
Important
Only tested on Ubuntu 24.04.
Please do not hesitate to open an issue if your platform requires, for example, different packages.
Ubuntu 24.04
sudo apt-get install pkg-config libwayland-dev wayland-protocols wayland-scanner++ libwayland-client++1 libx11-dev libxrandr-dev libxkbcommon-dev
Note
If you are using WSL, consider taking a look at this thread, which suggests solutions when the connection to a display fails.
In particular, see this answer.
Dev-only dependencies
Developers will need the following:
clang-format
. The executable must be exported so that it can be found from$ENV{PATH}
(in the CMake meaning of the expression).- Python
termcolor
.
Cloning
Simply run
git clone --recurse-submodules --remote-submodules https://github.com/Erellu/fubuki.git
Or if you have an old version of Git (2.12 or before)
git clone --recursive https://github.com/Erellu/fubuki.git
git submodule init
git submodule update
Building
- Clone the repository and pull its submodules.
- Download the Vulkan SDK and the other dependencies.
- Run
cmake
(orcmake-gui
if you prefer the graphical interface) and select the build system (ninja
, etc.).- Set
CMAKE_BUILD_TYPE
to one ofDebug
,Release
,RelWithDebInfo
,MinSizeRel
. - Set the other Fubuki options (see below).
- Set
- Go to your build directory and build (
ninja
or whatever you selected).
CMake options
Name | Description | Default |
---|---|---|
FUBUKI_BUILD_TESTS |
Build Fubuki unit tests | OFF |
FUBUKI_BUILD_TUTORIALS |
Build Fubuki tutorials. | ON |
FUBUKI_INSTALL |
Install Fubuki to directory set in CMAKE_INSTALL_PREFIX . |
ON |
FUBUKI_NO_IO |
Do not build fubuki::io (use this when building Fubuki for a platform fubuki::io doesn't support, such as OSX). This also disables tutorials and tests that depend on this target. |
OFF |
FUBUKI_SKIP_GENERATION |
(Dev) Skip code generations processes. Put it on OFF when changing the Vulkan SDK version. |
ON |
FUBUKI_VERBOSE_BUILD |
(Dev) Display detailed messages when configuring Fubuki. | OFF |
Installation
At the current state of the project, I cannot provide prebuilt binaries, so you will have to build it yourself:
- Follow the building steps above.
- Set
FUBUKI_INSTALL
toON
. - Set
CMAKE_INSTALL_PREFIX
to the desired install location. - Build.
Examples
core
Retrieve PFN_vk*
by name
Example C++ code
// The name is automagically validated at compile time
auto* const pfn = fubuki::pfn<"vkCreateDevice">(instance);
fubuki_assert(pfn, "Could not retrieve the function pointer");
// Compile error
// auto* const pfn2 = fubuki::pfn<"vkThisFunctionDoesNotExist">(instance);
Invoke Vulkan functions by name
Example C++ code
auto device_functions = fubuki::load(instance, vk_version, device);
// The name and the arguments are also validated at compile time
auto result = fubuki::invoke<"vkQueueSubmit">(device_functions, ...);
// Compile-time error: vkQueueSubmit cannot be invoke with such arguments
// auto result = fubuki::invoke<"vkQueueSubmit">(device_functions, an_int);
pnext
chain
Example C++ code
VkDeviceCreateInfo vk_info {...};
VkPhysicalDeviceVulkan11Features vk11 {...};
VkPhysicalDeviceVulkan12Features vk12 {...};
VkPhysicalDeviceVulkan13Features vk13 {...};
const fubuki::pnext_chain chain{
vk11,
vk12,
vk13,
};
// Contents are validated at compile time
fubuki::extend(vk_info, chain);
fuyu
See:
- Tutorial 00: Instance and device: basic usage and general semantics
- Tutorial 02: Vulkan context: how to build a declarative API to setup a complete execution context.
- Tutorial 04: Triangle: The usual triangle, using Vulkan 1.3's dynamic rendering,
fubuki::fuyu
andfuyu::command::pipe
.
Invoke Vulkan functions by name
Similar to fubuki::invoke
, fubuki::fuyu::invoke
provides an interface to call Vulkan functions by name. It is a simple compatibility layer for fuyu::views
:
Example C++ code
[[nodiscard]]
VkExtent2D render_area_granularity(const fuyu::render_pass_view pass) noexcept
{
VkExtent2D result = {};
...