Bindings for Vulkan Memory Allocator v3.2.1 in Odin Programming Language.
Copy the vma
folder to your project or shared
directory.
vma_vulkan_functions := vma.create_vulkan_functions()
allocator_create_info: vma.Allocator_Create_Info = {
flags = {.Buffer_Device_Address},
instance = instance,
vulkan_api_version = 1003000, // 1.3
physical_device = physical_device,
device = device,
vulkan_functions = &vma_vulkan_functions,
}
allocator: vma.Allocator = ---
if res := vma.create_allocator(allocator_create_info, &allocator); res != .SUCCESS {
log.errorf("Failed to Create Vulkan Memory Allocator: [%v]", res)
return
}
defer vma.destroy_allocator(allocator)
Precompiled binaries are not available, but you can easily compile the library using Premake.
- Premake5 - the build configuration
- You can download the Pre-Built Binaries, simply need to be unpacked and placed somewhere on the system search path or any other convenient location.
- For Unix, also requires GNU libc 2.38.
- Git - required for clone dependencies
-
Clone or download this repository
-
Download and install premake5.exe.
Either add to PATH or copy to project directory.
-
Open a command window, navigate to the project directory and generate Visual Studio 2022 project files with desired
vk-version
.vk-version
specifies the Vulkan minor version. For example, 3 corresponds to1003000
(Vulkan 1.3).premake5 --vk-version=3 vs2022 # 1003000 (1.3)
-
From the project folder, open the directory
build\make\windows
, them open the generated solution vma.sln. -
In Visual Studio, confirm that the dropdown box at the top says “x64” (not “x86”); and then use Build > Build Solution.
The generated library file
vma_windows_x86_64.lib
will be located in the root of the project directory.
If you do not have Visual Studio installed, you can use the Build Tools for Visual Studio 2022, which includes only the required tools to build.
-
Follow the steps above to use
premake5
for generating the project files. -
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio.
-
Make sure you have the required folder in the PATH:
<portable-msvc>\msvc\VC\Auxiliary\Build
- forvcvars64.bat
<portable-msvc>\msvc\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64
- forcl
andlib
-
Open a command window, navigate to the
build
directory, and locate thebuild.bat
file. This batch file will use the generated project files to build VMA. -
Compile and link VMA:
build.bat
-
Clone or download this repository
-
Download and install premake5
-
Open a terminal window, navigate to the project directory and generate the makefiles with desired
vk-version
:vk-version
specifies the Vulkan minor version. For example, 3 corresponds to1003000
(Vulkan 1.3).premake5 --vk-version=3 gmake2 # 1003000 (1.3) # On macOS, you can also use Xcode: premake5 --vk-version=3 xcode4
-
From the project folder, navigate to the generated build directory:
cd build/make/linux # Or cd build/make/macosx
-
Compile the project using the
make
command:make config=release_x86_64 # Or for debug build: # make config=debug_x86_64
On macOS, the
make
command might need different configuration flags:make config=release_x86_64 # For Intel Macs # or make config=release_arm64 # For Apple Silicon (M1/M2/M3) Macs
The generated library file will be located in the root of the project directory.
Types and values follow the Odin Naming Convention. In general, Ada_Case
for types and
snake_case
for values
Case | |
---|---|
Import Name | snake_case (but prefer single word) |
Types | Ada_Case |
Enum Values | Ada_Case |
Procedures | snake_case |
Local Variables | snake_case |
Constant Variables | SCREAMING_SNAKE_CASE |
MIT License - See LICENSE file for details.