20 releases

0.9.0 Feb 12, 2019
0.8.3 Oct 1, 2018
0.8.2 Jan 24, 2018
0.8.0 Dec 30, 2017
0.2.0 Mar 22, 2016

#6 in Graphics APIs

Download history 1138/week @ 2018-11-30 1548/week @ 2018-12-07 1283/week @ 2018-12-14 1836/week @ 2018-12-21 1651/week @ 2018-12-28 1692/week @ 2019-01-04 1533/week @ 2019-01-11 1475/week @ 2019-01-18 1728/week @ 2019-01-25 1519/week @ 2019-02-01 1465/week @ 2019-02-08 1898/week @ 2019-02-15 1548/week @ 2019-02-22 1681/week @ 2019-03-01 1812/week @ 2019-03-08

6,628 downloads per month
Used in 110 crates (23 directly)



Travis Build Status AppVeyor Build Status Gitter Chat
Getting Started | Documentation (work in progress) | Blog


gfx-rs is a low-level, cross-platform graphics abstraction library in Rust. It consists of the following layers/components:

  • gfx-hal which is gfx's hardware abstraction layer: a Vulkan-ic mostly unsafe API which translates to native graphics backends.
  • gfx-backend-* which contains graphics backends for various platforms:
  • gfx-warden which is a data-driven reference test framework, used to verify consistency across all graphics backends.


To run an example, simply use cargo run and specify the backend with --features {backend} (where {backend} is one of vulkan, dx12, dx11, metal, or gl). For example:

git clone https://github.com/gfx-rs/gfx
cd gfx/examples
# macOS
cargo run --bin quad --features metal
# vulkan
cargo run --bin quad --features vulkan
# Windows
cargo run --bin compute --features dx12 1 2 3 4

This runs the quad example using the Vulkan backend, and then the compute example using the DirectX 12 backend.

These examples assume that necessary dependencies for the graphics backend are already installed. For more information about installation and usage, refer to the Getting Started guide.

Hardware Abstraction Layer

The Hardware Abstraction Layer (HAL), is a thin, low-level graphics layer which translates API calls to various graphics backends, which allows for cross-platform support. The API of this layer is based on the Vulkan API, adapted to be more Rust-friendly.

Hardware Abstraction Layer (HAL)

Currently HAL has backends for Vulkan, DirectX 12, Metal, and OpenGL/OpenGL ES/WebGL.

The HAL layer is consumed directly by user applications or libraries. HAL is also used in efforts such as gfx-portability.

Previously Released Crates and API (pre-LL)

The code in master is a complete low-level rewrite of gfx based on HAL as described above.

The previously released crates (gfx_core, gfx, gfx_device_*, gfx_window_) are still being developed and published from the pre-ll (pre-low level rewrite) branch.


This repository is licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~22K SLoC