Fork me on GitHub

Vulkano

Safe Rust wrapper around the Vulkan API

Introduction

Welcome to the vulkano guide!

This guide will cover the basics of Vulkan and vulkano, and will help you getting started with interfacing with a GPU.

It will teach you the basics of graphics programming in the sense that you will know how to draw objects on the screen. However this guide doesn't cover actual graphics programming techniques, such as loading a 3D model or adding realistic lighting to a scene.

We will assume that you are familiar with the Rust programming language. If you are not, you should definitely learn it first!

Quick glossary

When you create a program (either in Rust or any other programming language) and run it, the program's instructions are executed by the CPU (Central Processing Unit).

But some computers also usually have a video card plugged in them. This video card has its own microprocessor called the GPU (Graphics Processing Unit) or the graphics processor. It can be seen more or less as a secondary machine within your main machine. Your monitor is generally plugged in to your video card if you have one.

Vulkan is a standard API whose version 1.0 was released in 2016 that lets you interface with the video card and the GPU of the machine your program is running on. Vulkano is a Rust library on top of Vulkan that makes it much easier and safer to use. After you have learned to use Vulkan/vulkano, you will be able to ask your GPU to perform operations and either write the result into memory (which you can then read from your Rust program), or to write the result to your monitor for you to physically see.

Setup

As with all Rust libraries, add this entry in your Cargo.toml:

vulkano = "0.6"

Note: New versions of vulkano (0.6.1, 0.6.2, ...) are being regularly released. If you some code in this guide doesn't compile for you, try running cargo update to get the latest version. And if it still doesn't compile, feel free to open an issue.

And add this to your crate root:

#[macro_use]
extern crate vulkano;

You are now ready to get started!