d-vulkan 0.3.1
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:
d-vulkan:devices - Simple Vulkan example
d-vulkan:layers - Simple Vulkan example
D-Vulkan
Automatically-generated D bindings for Vulkan.
Usage
The bindings have two configurations: the default
configuration, where the bindings load all functions 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 dvulkan;
. - Get a pointer to the
vkGetInstanceProcAddr
, through platform-specific means (ex. loading the Vulkan shared library, orglfwGetInstanceProcAddress
if using GLFW). - Call
DVulkanLoader.loadInstanceFunctions(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
DVulkanLoader.loadAllFunctions(instance)
to load the rest of the functions. - (Optional) Call
DVulkanLoader.loadAllFunctions(device)
once you have aVkDevice
to load specific functions for a device.
To use in the with-derelict-loader
configuration, follow the above steps, but call DVulkanDerelict.load()
instead of performing steps two and three.
The API is similar to the C Vulkan API, but with some differences:
- Since enums in D are not global, you need to specify the enum type. Ex:
VkResult.VK_SUCCESS
instead of justVK_SUCCESS
. TheDVulkanGlobalEnums
version defines global aliases to enums, making them work like C enums. - 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.
Examples can be found in the examples
directory, and ran with dub run d-vulkan:examplename
.
Bindings for all extensions are available, except for the VK_KHR_*_surface
extensions, which require types from external libraries (X11, XCB, ...). They can be manually loaded with vkGetInstanceProcAddr
if needed.
Generating Bindings
To generate bindings, download the Vulkan-Docs repo, copy/move/symlink vkdgen.py
into src/spec/
, cd
there, and execute it, passing in an output folder to place the D files. Requires Python 3.
- 0.3.1 released 8 years ago
- ColonelThirtyTwo/dvulkan
- BSD 2-clause
- Copyright 2015-2016 The Khronos Group Inc.; Copyright 2016, Alex Parrill
- Authors:
- Sub packages:
- d-vulkan:devices, d-vulkan:layers
- Dependencies:
- none
- Versions:
-
0.3.1 2016-May-19 0.3.0 2016-May-19 0.2.0 2016-Mar-26 0.1.0 2016-Mar-19 ~master 2016-May-27 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
2 downloads this month
-
215 downloads total
-
- Score:
- 1.7
- Short URL:
- d-vulkan.dub.pm