Vulkan API for Rust

I'm currently working on an API wrapper to the new Vulkan graphics API called krust. This shall become a Rust-like wrapper around the original bindings.

I didn't want to wait for a generic API-binding generator to become available. To get started I hand-crafted the bindings for everyone to play with: krust on crates.io

Bear with me as I'm just starting to get familiar with Vulkan, Rust, GitHub, Cargo, etc. and this is just a first attempt to make the new API available. Any help is welcome!

Things that will be improved (despite just 'everything'):

  • Platform independence; the bindings are currently written and tested for win64 (stdcall); i still have to learn how to 'flexibilize' this
  • A hand-full of functions using function pointers or perform other types of call-backs still need to be adopted
  • Somehow connect the API to a window manager to get the hello triangle on screen rather than in memory (I'm pretty sure @tomaka will beat me on this :grin: )
  • The hand-crafted wrapper will possibly be removed later, as a generic one comes available (I believe @brendanzab is working on this)
  • I still have to figure out whether or how to integrate a SPIR-V compiler (Rust-to-SPIR-V would be awesome!)

The test program just tries to connect to the driver by fetching an Instance, and printing out its handle.

Hint: If you're using the using the current nVidia beta drivers (on Windows), you'll have to install the msvcr120.dll (Microsoft Visual C Redistributables 20-something) or you'll receive a far negative exit code when loading the dll (took me 3 hours to figure this out :rage:).

Have fun!

2 Likes

There is also some work on that over here GitHub - tomaka/vulkano: Safe and rich Rust wrapper around the Vulkan API if you haven't seen that.

The correct calling convention is "system" and should work everywhere (except on Android+ARM, where it's something I'm not familiar with).

1 Like

So do I understand correctly that krust stands somewhere between vk-sys and vulkano? I.e. it's almost a binding, just a little bit wrapped up into Rust.