Home

Awesome

The aim of this project is to provide low-level low-overhead haskell bindings to vulkan api. Features of the bindings:

vulkan-api Hackage

Generated haskell bindings for vulkan api.

Tested using stack on:

Status update vulan-api-1.4 (2021.04.05)

Vulkan-Docs changed between version 1.1 and 1.2 a lot, which made adapting genvulkan rather hard. At this point, I decided to modify the generated code manually until I come up with a better way to generate haskell code fully automatically (I expect this would require a rather large refactoring).

The current semi-generated code matches v. 1.2.174 of Vulkan-Docs vk.xml. Here are some manual adjustments I've had to make:

genvulkan

Generate haskell vulkan sources using vk.xml file. To update the api bindings, run genvulkan using stack with this project folder:

cd genvulkan
stack build
stack exec genvulkan

vulkan-examples

Examples of programs using vulkan-api bindings. Consists of several executables implementing steps of vulkan-tutorial.com. This is the easiest way to familiarize yourself with the library.

Prerequisites

vulkan-triangles

A more haskell-style example of a vulkan program. This is a combined result of programs in vulkan-examples with a little cleaner code.

TODO

vulkan-api
genvulkan

Why another Haskell bindings?

The generated bindings vulkan-api are not the only Haskell bindings for Vulkan API. There is another package, called vulkan that started in 2016. The main reason for me to write this new package two years later was that vulkan package was abandoned for a while and required significant efforts to be compiled at the time this project started in January 2018 (as of April 2018 things seem to have changed and that package is great again :) ). However, the are a few design decisions that render vulkan and vulkan-api quite different. The main difference is that vulkan uses regular Haskell data types plus DuplicateRecordFields to manipulate Vulkan objects, whereas vulkan-api uses wrapped pinned byte arrays plus type classes and TypeApplications; as a result:

There is a number of smaller things: