10 unstable releases (4 breaking)

0.5.2 Jul 10, 2020
0.5.1 Jul 9, 2020
0.5.0 Apr 6, 2020
0.4.0 Nov 4, 2019
0.1.0 Jan 24, 2019

#4 in Graphics APIs

Download history 2948/week @ 2020-04-22 4167/week @ 2020-04-29 4015/week @ 2020-05-06 5178/week @ 2020-05-13 4971/week @ 2020-05-20 5210/week @ 2020-05-27 4798/week @ 2020-06-03 4191/week @ 2020-06-10 3788/week @ 2020-06-17 4451/week @ 2020-06-24 4449/week @ 2020-07-01 4805/week @ 2020-07-08 4598/week @ 2020-07-15 4410/week @ 2020-07-22 3901/week @ 2020-07-29 3353/week @ 2020-08-05

17,904 downloads per month
Used in 47 crates (29 directly)

MPL-2.0 license

75KB
1.5K SLoC

wgpu-rs

Build Status Crates.io Docs.rs Matrix

wgpu-rs is an idiomatic Rust wrapper over wgpu-core. It's designed to be suitable for general purpose graphics and computation needs of Rust community.

Currently wgpu-rs works on native platforms, but WASM support is currently being added as well.

Gallery

Cube Shadow MipMap Skybox vange-rs Brawl GLX map

Usage

How to Run Examples

All examples are located under the examples directory.

These examples use the default syntax for running examples, as found in the Cargo documentation. For example, to run the cube example:

cargo run --example cube

The hello-triangle and hello-compute examples show bare-bones setup without any helper code. For hello-compute, pass 4 numbers separated by spaces as arguments:

cargo run --example hello-compute 1 2 3 4

Friends

Shout out to the following projects that work best with wgpu-rs:

  • wgpu_glyph - for your text-y rendering needs
  • coffee - a whole 2D engine
  • iced - a cross-platform GUI library
  • rgx - a 2D graphics library
  • imgui-wgpu - Dear ImGui interfacing
  • pixels - the easiest way to create a hardware-accelerated pixel frame buffer
  • kas - tooKit Abstraction System
  • oxidator - RTS game engine
  • nannou - a creative coding framework

Also, libraries that have support for wgpu-rs:

  • conrod - shader-based UI
  • grr-2d - experimental 2D renderer
  • lyon - a path tessellation library

Development

If you need to test local fixes to gfx-rs or other dependencies, the simplest way is to add a Cargo patch. For example, when working on DX12 backend on Windows, you can check out the "hal-0.2" branch of gfx-rs repo and add this to the end of "Cargo.toml":

[patch.crates-io]
gfx-backend-dx12 = { path = "../gfx/src/backend/dx12" }
gfx-hal = { path = "../gfx/src/hal" }

If a version needs to be changed, you need to to do cargo update -p gfx-backend-dx12.

Dependencies

~1.7–3.5MB
~71K SLoC