A curated list of wgpu code and resources.

Overview

Awesome wgpu

A curated list of wgpu code and resources.

PRs welcome.

About wgpu

Ecosystem

  1. individual API libraries like ash, d3d12-rs, metal-rs - for the lowest hard-core level available to Rust
  2. gfx-hal for lowest portable level
  3. Rendy for helping to solve the rough corners of gfx-hal
  4. wgpu-rs for the lowest safe level
  5. Engines like ggez or Amethyst for the highest level

https://www.reddit.com/r/rust_gamedev/comments/bv7w2f/wgpurs_now_uses_rendy_to_manage_memory_and/

Learn

Gamedev

Rust gamedev

General gamedev

Physics/Collision

Games

Applications

Examples

Older

UI

Rendering

About Rendy

About Rendy and wgpu https://community.amethyst.rs/t/skepticism-about-rendy/1221/9

wgpu uses gfx-hal and parts of rendy, totally fine on DX12 on Windows https://www.reddit.com/r/rust/comments/eh7wkx/the_state_of_ggez_2020/fcj1746/

We hoped Amethyst team would help, but that didn't happen either. https://www.reddit.com/r/rust/comments/eh7wkx/the_state_of_ggez_2020/fcipapq/

Switching to rendy nearly killed this project due to the time and effort required https://community.amethyst.rs/t/skepticism-about-rendy/1221/11

This duality of APIs in gfx-hal worked to an extent. Providing safety was impossible without imposing some restrictions or overhead. In the command pool example, it’s only safe to re-use a command buffer if it’s done execution on the GPU, and the user doesn’t intent to use it. We can’t possibly know this in gfx-hal without introducing overhead… So, at the end of the day, we decided that the “typed” (user-facing) layer is still useful, it doesn’t have to be a part of gfx-hal. Thus, we removed it, recommending rendy-command as a replacement. This slimmed up gfx-hal API surface and allowed us to straighten up the terminology (no more “RawXXX” or “XxxTyped”). https://gfx-rs.github.io/2019/10/01/update.html

WebGPU and portability

One of the goals of WebGPU that differentiates it from the other libraries and APIs is "strong" portability, in a sense that it not only runs on all targeted platforms, but also the performance expectations match. Therefore, if don't see a way to consistently implement a feature on at least 2 or the 3 target platforms, in such a way that it works and using it shows a difference, we don't include it in the core API. Take sub-passes, for example, that, while you can technically implement them on Metal and DX12 by doing separate passes, they only make a difference on Vulkan mobile GPUs today, so there can't be expectation that using sub-passes makes you magically faster. Take buffer capabilities as another example: if we expose all the queries about what is supported and what not, it's easy to write an application that would work on the developer platform but then break on others, because they possibly forgot to query, or simply don't have another code path in place. Finally, things like "multiple queues" are desired for the most part, but we haven't yet figured a plan on how to expose them portably, as in - without race conditions affecting the portability of user programs. https://github.com/nannou-org/nannou/issues/374#issuecomment-533841665

Misc

Shading Language

GLSL

Found the problem - I need to become a GLSL shader expert https://www.reddit.com/r/rust_gamedev/comments/be08e2/wgpu_pipeline_question/el40lsl/

HLSL

Google and Samsung are developing HLSL compiler for Vulkan, because a large majority of game studios don't want to bother with Vulkan on Android if they cannot port their shaders. https://news.ycombinator.com/item?id=18439910

GLSL vs HLSL

My biggest concerns about using HLSL as the source are:

WSL (formerly WHLSL)

There are many Web developers using GLSL today in WebGL, so a potential browser accepting a different high level language, like HLSL, wouldn’t suit their needs well. In addition, a high-level language such as HLSL can’t be executed faithfully on every platform and graphics API that WebGPU is designed to execute on. https://webkit.org/blog/9528/webgpu-and-wsl-in-safari/

So, we decided to make the language more simple, low-level, and fast to compile, and renamed the language to Web Shading Language to match this pursuit.

CG

CG has been discontinued, and is no longer supported or actively worked on by Nvidia. Nvidia recommends that all users switch to a combination of GLSL and HLSL, or a newer library such as nvFX (on github). This is because it was too difficult to maintain feature-compatibility between GLSL and HLSL. https://gamedev.stackexchange.com/questions/4234/what-are-the-pros-and-cons-of-hlsl-vs-glsl-vs-cg/4333#4333

OpenGL

License

CC0

You might also like...
🍖A WGPU graphics pipeline, along with simple types used to marshal data to the GPU
🍖A WGPU graphics pipeline, along with simple types used to marshal data to the GPU

renderling 🍖 This library is a collection of WGPU render pipelines. Shaders are written in GLSL. shaderc is used to compile shaders to SPIR-V. Defini

🦅🦁 Fast, simple 2D text renderer for wgpu

🦅 glyphon 🦁 Fast, simple 2D text rendering for wgpu What is this? This crate provides a simple way to render 2D text with wgpu by: rasterizing glyph

A barebones example of how to integrate OpenXR with wgpu (Vulkan-only)

wgpu-openxr-example a barebones example of how to integrate OpenXR with wgpu (Vulkan-only) It has four modes: cargo run --no-default-features: desktop

bevy_sequential_actions is a library for the Bevy game engine that aims to execute a list of actions in a sequential manner.
bevy_sequential_actions is a library for the Bevy game engine that aims to execute a list of actions in a sequential manner.

Bevy Sequential Actions bevy_sequential_actions is a library for the Bevy game engine that aims to execute a list of actions in a sequential manner. T

A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it techinically works
A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it techinically works

rustetris A tetris game I wrote in rust using ncurses. I'm sure that there's a better way to write a tetris game, and the code may be sus, but it tech

Rust-and-opengl-lessons - Collection of example code for learning OpenGL in Rust

rust-and-opengl-lessons Project requires Rust 1.31 Collection of example code for learning OpenGL in Rust 00 - Setup 01 - Window 02 - OpenGL Context 0

Examples inspired by 'Nature of Code' in Bevy 3D and Rust
Examples inspired by 'Nature of Code' in Bevy 3D and Rust

rust-bevy and the Nature of Code The book The Nature of Code from Daniel Shiffman is a wonderful book about programming. https://natureofcode.com/book

A single-threaded executor for deferred async code for games.

This crate provides a single-threaded, sequential, parameterized async runtime. In other words, this creates coroutines, specifically targeting video game logic, though cosync is suitable for creating any sequences of directions which take time.

CLI game to see how fast you can guess the language of a code block!
CLI game to see how fast you can guess the language of a code block!

Guess That Lang! CLI game to see how fast you can guess the language of a code block! If you like the game, please consider giving a ⭐ ! Code is retri

Owner
Roman Frołow
Roman Frołow
game engine built in rust, using wgpu and probably other stuff too

horizon game engine engine for devpty games, made in 99.9% rust and 0.1% shell. this is our main project currently. the engine will be used for most i

DEVPTY 2 Apr 12, 2022
3d Cellular Automata using WGPU in Rust (for the web and using compute shaders)

3D-Cellular-Automata-WGPU 3d Cellular Automata using WGPU in Rust (for the web and using compute shaders) The branches are very messy... I recommend y

null 18 Dec 18, 2022
Bevy plugin for an AssetServer that can load embedded resources, or use other AssetServers based on the path.

Bevy-Embasset Embed your asset folder inside your binary. bevy-embasset adds support for loading assets embedded into the binary. Furthermore, it can

Johnny Tidemand Vestergaard 9 Aug 4, 2022
A Bevy helper to easily manage resources that need to persist across game sessions.

bevy-persistent A Bevy helper to easily manage resources that need to persist across game sessions. Background In games, there are a lot of resources

Umut 5 Mar 25, 2023
A modern 3D/2D game engine that uses wgpu.

Harmony A modern 3D/2D game engine that uses wgpu and is designed to work out of the box with minimal effort. It uses legion for handling game/renderi

John 152 Dec 24, 2022
Simple profiler scopes for wgpu using timer queries

wgpu-profiler Simple profiler scopes for wgpu using timer queries Features Easy to use profiler scopes Allows nesting! Can be disabled by runtime flag

null 41 Dec 5, 2022
Rustcraft is a simple Minecraft engine written in rust using wgpu.

Rustcraft is a simple Minecraft engine written in rust using wgpu.

Raphael Van Hoffelen 110 Dec 22, 2022
Self Study on developing a game engine using wgpu as the rendering API. Learning as I go.

Fabled Engine Any issues, enhancement, features, or bugs report are always welcome in Issues. The obj branch is where frequent development and up to d

Khalid 20 Jan 5, 2023
Tic-Tac-Toe on the GPU, as an example application for wgpu

Tic-Tac-GPU A simple (cough cough) example on a tic-tac-toe game with wgpu. Why? Because I didn't find that many small applications which use wgpu as

multisn8 2 Oct 7, 2022
Guide for using gfx-rs's wgpu library.

Introduction What is wgpu? Wgpu is a Rust implementation of the WebGPU API spec. WebGPU is a specification published by the GPU for the Web Community

sotrh 1k Dec 29, 2022