d-vulkan 0.1.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:

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:

  1. Import via import dvulkan;.
  2. Get a pointer to the vkGetInstanceProcAddr, through platform-specific means (ex. loading the Vulkan shared library, or glfwGetInstanceProcAddress if using GLFW).
  3. Call DVulkanLoader.loadInstanceFunctions(getProcAddr), where getProcAddr is the address of the loaded vkGetInstanceProcAddr function, to load the following functions:
    • vkGetInstanceProcAddr (sets the global variable from the passed value)
    • vkCreateInstance
    • vkEnumerateInstanceExtensionProperties
    • vkEnumerateInstanceLayerProperties
  4. Create a VkInstance using the above functions.
  5. Call DVulkanLoader.loadAllFunctions(instance) to load the rest of the functions.
  6. (Optional) Call DVulkanLoader.loadAllFunctions(device) once you have a VkDevice 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 just VK_SUCCESS.
  • All structures have their sType field set to the appropriate value upon initialization; explicit initialization is not needed.
  • VkPipelineShaderStageCreateInfo.module has been renamed to VkPipelineShaderStageCreateInfo._module, since module is a D keyword.

Examples can be found in the examples directory, and ran with dub run dvulkan: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.

Authors:
  • Alex Parrill
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
Show all 5 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 208 downloads total

Score:
1.3
Short URL:
d-vulkan.dub.pm