# Vulkan API for Rust

**URL:** <https://users.rust-lang.org/t/vulkan-api-for-rust/4707>\
**Category:** announcements\
**Created:** [February 21, 2016, 1:45am UTC](https://users.rust-lang.org/t/vulkan-api-for-rust/4707 "2016-02-21T01:45:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fyl2xp1](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/fyl2xp1/32/2159_2.png) [@fyl2xp1](https://users.rust-lang.org/u/fyl2xp1)\
**Post date:** [February 21, 2016, 1:45am UTC](https://users.rust-lang.org/t/vulkan-api-for-rust/4707/1 "2016-02-21T01:45:25Z")

</div>

I'm currently working on an API wrapper to the new [Vulkan](https://www.khronos.org/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](https://crates.io/crates/krust)

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 😁 )
- 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 😡).

Have fun!

---

<div class="post-metadata">

**Author:** ![emoon](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/emoon/32/1187_2.png) [@emoon](https://users.rust-lang.org/u/emoon)\
**Post date:** [February 21, 2016, 2:26am UTC](https://users.rust-lang.org/t/vulkan-api-for-rust/4707/2 "2016-02-21T02:26:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tomaka](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/tomaka/32/5143_2.png) [@tomaka](https://users.rust-lang.org/u/tomaka)\
**Post date:** [February 21, 2016, 6:34am UTC](https://users.rust-lang.org/t/vulkan-api-for-rust/4707/3 "2016-02-21T06:34:43Z")

</div>

> [@fyl2xp1](#):
>
> Platform independence; the bindings are currently written and tested for win64 (stdcall); i still have to learn how to 'flexibilize' this

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

---

<div class="post-metadata">

**Author:** ![kvark](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/kvark/32/332_2.png) [@kvark](https://users.rust-lang.org/u/kvark)\
**Post date:** [February 26, 2016, 2:20am UTC](https://users.rust-lang.org/t/vulkan-api-for-rust/4707/4 "2016-02-26T02:20:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![steffahn](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/steffahn/32/47569_2.png) [@steffahn](https://users.rust-lang.org/u/steffahn)\
**Post date:** [July 3, 2022, 1:57pm UTC](https://users.rust-lang.org/t/vulkan-api-for-rust/4707/5 "2022-07-03T13:57:11Z")

</div>

Closed on July 3, 2022, 1:57pm UTC


