erupted 1.0.0
Auto-generated D bindings for Vulkan
To use this package, run the following command in your project's root directory:
Manual usage
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
ErupteD
Automatically-generated D bindings for Vulkan based on D-Vulkan. Acquiring Vulkan functions is based on Intel API without Secrets
Usage
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 default
configuration:
- Import via
import erupted;
. - Get a pointer to the
vkGetInstanceProcAddr
, through platform-specific means (e.g. loading the Vulkan shared library, orglfwGetInstanceProcAddress
if using GLFW). - Call
EruptedLoader.loadGlobalLevelFunctions(getProcAddr)
, wheregetProcAddr
is the address of the loadedvkGetInstanceProcAddr
function, to load the following functions:vkGetInstanceProcAddr
(sets the global variable from the passed value)vkCreateInstance
vkEnumerateInstanceExtensionProperties
vkEnumerateInstanceLayerProperties
- Create a
VkInstance
using the above functions. - Call
EruptedLoader.loadInstanceLevelFunctions(VkInstance)
to load additionalVkInstance
related 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
VkDevice
,VkQueue
orVkCommandBuffer
):- Call
EruptedLoader.loadDeviceLevelFunctions(VkInstance)
, the acquired functions call indirectly through theVkInstance
and will be internally dispatched by the implementation - Call
EruptedLoader.loadDeviceLevelFunctions(VkDevice)
, the acquired functions call directly theVkDevice
and 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 anotherVkDevice
should overwrite (this is the not tested theory) all the previously fetched __gshared function - Call
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.
- Call
To use in the with-derelict-loader
configuration, follow the above steps, but call EruptedDerelict.load()
instead of performing steps two and three.
Available configurations:
with-derelict-loader
fetches derelictUtil, gets a pointer tovkGetInstanceProcAddr
and 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.
VkResult.VK_SUCCESS
andVK_SUCCESS
can both be used. - All structures have their
sType
field set to the appropriate value upon initialization; explicit initialization is not needed. VkPipelineShaderStageCreateInfo.module
has been renamed toVkPipelineShaderStageCreateInfo._module
, sincemodule
is 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.
Generating Bindings
To erupt the vulkan-docs yourself (Requires Python 3 and lxml.etree) download the Vulkan-Docs repo and
call erupt.py
passing 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
- 1.0.0 released 8 years ago
- ParticlePeter/ErupteD
- BSD 2-clause
- Copyright 2015-2016 The Khronos Group Inc.; Copyright 2016, Alex Parrill, Peter Particle
- Authors:
- Sub packages:
- erupted:devices, erupted:layers
- Dependencies:
- none
- Versions:
-
2.1.98+v1.3.248 2023-Apr-20 2.1.97+v1.3.247 2023-Apr-18 2.1.96+v1.3.246 2023-Apr-18 2.1.95+v1.3.245 2023-Apr-18 2.1.94+v1.3.244 2023-Apr-18 - Download Stats:
-
-
1 downloads today
-
3 downloads this week
-
11 downloads this month
-
5155 downloads total
-
- Score:
- 2.4
- Short URL:
- erupted.dub.pm