Auto-generated D bindings for Vulkan
To use this package, run the following command in your project's root directory:
Put the following dependency into your project's dependences section:
This package provides sub packages which can be used individually:
erupted:devices - Simple Vulkan example
erupted:layers - Simple Vulkan example
The bindings have two configurations: the
default configuration, where the bindings load few functions (see bellow) from the
vkGetInstanceProcAddr, which you supply when loading and the
with-derelict-loader configuration, which uses the Derelict library to load
vkGetInstanceProcAddr for you.
To use in the
- Import via
- Get a pointer to the
vkGetInstanceProcAddr, through platform-specific means (e.g. loading the Vulkan shared library, or
glfwGetInstanceProcAddressif using GLFW).
getProcAddris the address of the loaded
vkGetInstanceProcAddrfunction, to load the following functions:
vkGetInstanceProcAddr(sets the global variable from the passed value)
- Create a
VkInstanceusing the above functions.
EruptedLoader.loadInstanceLevelFunctions(VkInstance)to load additional
VkInstancerelated functions. Get information about available physical devices (e.g. GPU(s), APU(s), etc.) and physical device related resources (e.g. Queue Families, Queues per Family, etc. )
- Now three options are available to acquire a logical device and device resource related functions (functions with first param of
EruptedLoader.loadDeviceLevelFunctions(VkInstance), the acquired functions call indirectly through the
VkInstanceand will be internally dispatched by the implementation
EruptedLoader.loadDeviceLevelFunctions(VkDevice), the acquired functions call directly the
VkDeviceand related resources. This path is faster, skips one indirection, but (in theory, not tested yet!) is useful only in a single physical deveice environment. Calling the same function with another
VkDeviceshould overwrite (this is the not tested theory) all the previously fetched __gshared function
createDispatchDeviceLevelFunctions(VkDevice)and capture the result, which is a struct with all the device level fuction pointers kind of namespaced in that struct. This should avoid collisions.
To use in the
with-derelict-loader configuration, follow the above steps, but call
EruptedDerelict.load() instead of performing steps two and three.
with-derelict-loaderfetches derelictUtil, gets a pointer to
vkGetInstanceProcAddrand loads few additional global functions (see above)
The API is similar to the C Vulkan API, but with some differences:
- Named enums in D are not global but they are forwarded into global scope. Hence e.g.
VK_SUCCESScan both be used.
- All structures have their
sTypefield set to the appropriate value upon initialization; explicit initialization is not needed.
VkPipelineShaderStageCreateInfo.modulehas been renamed to
moduleis a D keyword.
Platform surface extensions
If you wish to create vulkan surface(s) yourself (instead of using e.g. glfw) you need to specify the required platform as compiler version flag. The available platform specifiers are the same as those found in
vk_platform.h. In such a case a platform specific d module will be publicly imported into types.d so that required platform specific types and functions become available.
A twist is that the only API included in phobos is the Windows API hence the module
core.sys.windows.windows is publicly imported in case of
VK_USE_PLATFORM_WIN32_KHR. In all other cases the imported module names are the same as the corresponding includes in the
vk_platform.h, only exception is
wayland_client instead of
wayland-client.h. You need to instruct dmd/dub with the proper path to such a module and/or edit the respective line in types.d file.
To erupt the vulkan-docs yourself (Requires Python 3 and lxml.etree) download the Vulkan-Docs repo and
path/to/vulkan-docs as first argument and an output folder for the D files as second argument.
Additions to D-Vulkan
- Platform surface extensions
- DerelictLoader for Posix Systems
- With respect to API without Secrets D-Vulkans function loading system is partially broken
- Registered by Peter Particle
- 1.0.0 released 5 years ago
- BSD 2-clause
- Copyright 2015-2016 The Khronos Group Inc.; Copyright 2016, Alex Parrill, Peter Particle
- Sub packages:
- erupted:devices, erupted:layers
2.1.24+v1.2.174 2021-Apr-03 2.1.23+v1.2.173 2021-Apr-03 2.1.21+v1.2.171 2021-Apr-03 2.1.20+v1.2.170 2021-Apr-03 2.1.19+v1.2.169 2021-Mar-03
- Download Stats:
0 downloads today
1 downloads this week
17 downloads this month
3736 downloads total
- Short URL: