└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Awesome wgpu 2 | 3 | A curated list of wgpu code and resources. 4 | 5 | PRs welcome. 6 | 7 | ## About wgpu 8 | 9 | - https://github.com/gfx-rs/wgpu-rs 10 | - matrix chat https://matrix.to/#/#wgpu:matrix.org 11 | - wgpu suports DX11, DX12 and Vulkan on Windows, Vulkan on Linux and Metal on macOS & iOS https://github.com/gfx-rs/wgpu 12 | - [The rise of wgpu - Gfx-rs nuts and bolts](https://gfx-rs.github.io/2019/03/06/wgpu.html) 13 | - https://www.reddit.com/r/rust/comments/ay3olj/the_rise_of_wgpurs/ 14 | - https://news.ycombinator.com/item?id=19327043 15 | - current status of WebGPU in web browsers https://webgpu.io 16 | - https://www.reddit.com/r/rust_gamedev/comments/e9nh8w/current_status_of_webgpu_wasm_and_web_games_in/ 17 | - https://wiki.alopex.li/AGuideToRustGraphicsLibraries2019 18 | - wgpu and WebGL https://www.reddit.com/r/rust/comments/eh7wkx/the_state_of_ggez_2020/fcipapq/ 19 | - wgpu and OpenGL https://www.reddit.com/r/rust/comments/eh7wkx/the_state_of_ggez_2020/fcj2hyq/ 20 | - Geometry shaders are effectively a dead end https://www.reddit.com/r/rust/comments/dou249/will_wgpu_support_shader_types_that_are_not/f5r1a6k/ 21 | - https://www.reddit.com/r/rust_gamedev/comments/b01zy9/please_help_me_understand_the_gfxrs_architecture/ 22 | 23 | ## Ecosystem 24 | 25 | 1. individual API libraries like ash, d3d12-rs, metal-rs - for the lowest hard-core level available to Rust 26 | 2. gfx-hal for lowest portable level 27 | 3. Rendy for helping to solve the rough corners of gfx-hal 28 | 4. wgpu-rs for the lowest safe level 29 | 5. Engines like ggez or Amethyst for the highest level 30 | 31 | https://www.reddit.com/r/rust_gamedev/comments/bv7w2f/wgpurs_now_uses_rendy_to_manage_memory_and/ 32 | 33 | ## Learn 34 | 35 | - https://rust-tutorials.github.io/learn-wgpu 36 | - https://github.com/rust-tutorials/learn-wgpu 37 | - https://sotrh.github.io/learn-wgpu/ 38 | - https://github.com/sotrh/learn-wgpu 39 | - this guide https://vulkano.rs/guide/introduction explains more i.e. swapchain https://vulkano.rs/guide/swapchain-creation 40 | - https://github.com/vulkano-rs/vulkano-www 41 | - https://crates.io/crates/winit 42 | - https://crates.io/crates/wgpu 43 | - old https://github.com/fredlangva/WGPU-Tut 44 | - https://www.reddit.com/r/rust_gamedev/comments/bcjdl0/learning_wgpurs_coming_from_openwebgl/ 45 | - [3D Game in Rust #2 - Try to run a wgpu-rs tutorial - YouTube](https://www.youtube.com/watch?v=KZTmTbcA-VY) 46 | - [Get started with GPU Compute on the Web](https://developers.google.com/web/updates/2019/08/get-started-with-gpu-compute-on-the-web) 47 | - [Building WebGPU with Rust - Dzmitry Malyshau - FOSDEM'20](https://www.youtube.com/watch?v=Z1l91Y3_oyw) 48 | 49 | ## Gamedev 50 | 51 | - A tiny hardware-accelerated pixel frame buffer https://github.com/parasyte/pixels 52 | - Answer why RedrawRequested event is not implemented https://github.com/rukai/winit_input_helper/issues/3#issuecomment-545316276 53 | - https://github.com/JamesPatrickGill/mos-6502-rusted 54 | - RTS game/engine https://github.com/Ruddle/oxidator 55 | - https://github.com/maroider/overlay 56 | - https://github.com/Noxime/vg-test 57 | - https://github.com/robmikh/goldsrc-asset-viewer 58 | - https://github.com/vulpesgames/mist-game-engine 59 | - https://github.com/chutchinson/chip-8 60 | - https://github.com/Napokue/chip-8 61 | - https://github.com/deadcore/playstation-emulator 62 | - https://github.com/catt-io/romy 63 | - https://github.com/lavignes/dth 64 | - 2D rendering library https://github.com/tonis2/felin 65 | - 2D graphics library https://github.com/cloudhead/rgx used by https://github.com/cloudhead/rx 66 | - https://github.com/StarlitGhost/GBOxide 67 | - A brawl file parser for Super Smash Bros. Brawl https://github.com/rukai/brawllib_rs 68 | - An opinionated 2D game engine https://github.com/hecrj/coffee 69 | - based on old wgpu 0.2 70 | 71 | ## Rust gamedev 72 | 73 | - https://github.com/rust-unofficial/awesome-rust/blob/master/README.md#game-development 74 | - https://www.reddit.com/r/rust_gamedev 75 | - Lack of allocator support in std is a big issue for gamedev. https://www.reddit.com/r/rust/comments/cr5rht/whats_the_state_of_game_development_in_rust/ex3g6e9/ 76 | - Game Input Library for Rust https://github.com/Arvamer/gilrs 77 | - Used by https://github.com/parasyte/pixels 78 | - [How to make roguelike games in Rust](http://bfnightly.bracketproductions.com/rustbook/) 79 | - https://news.ycombinator.com/item?id=22020229 80 | - Ultraviolet (linear algebra library specifically for games & graphics which is faster than the alternatives for both runtime and compile times) https://crates.io/crates/ultraviolet 81 | - via https://news.ycombinator.com/item?id=22024916 82 | - experimental const generics based linear algebra library that works without any allocations in no_std and utilizes simd. So now you can do fancy maths on embedded. https://djugei.github.io/optimath-0-3-0/ 83 | - https://www.reddit.com/r/rust/comments/eo4ury/show_rrust_optimath_linear_algebra_with_const/ 84 | - High performance Rust ECS library https://crates.io/crates/legion 85 | - via https://news.ycombinator.com/item?id=22024916 86 | - The flexibility in Legion is filled with tradeoffs, generally showing benefits in performance and runtime flexibility, while generally trading off some of the ergonomics of the SPECS interface. https://github.com/amethyst/rfcs/issues/22 87 | - https://iolivia.me/posts/entity-component-system-explained/ 88 | - https://github.com/rukai/winit_input_helper 89 | - used by pixels and others https://crates.io/crates/winit_input_helper/reverse_dependencies 90 | - experimental Rust library for continuous 2D collision detection in games https://github.com/SergiusIW/collider-rs 91 | - https://github.com/SergiusIW/chirperjax 92 | - development library tailored to 2D pixel-art games. Supports SDL2 or WebAssembly https://github.com/SergiusIW/gate 93 | - https://github.com/SergiusIW/chirperjax 94 | 95 | ## General gamedev 96 | 97 | - https://gafferongames.com/post/fix_your_timestep/ 98 | - via https://github.com/17cupsofcoffee/tetra 99 | - https://gafferongames.com/post/integration_basics/ 100 | - https://www.reddit.com/r/gamedev/comments/df7dth/i_compiled_a_massive_list_of_yt_channels_about/ 101 | - https://gamedev.stackexchange.com/questions?tab=Votes 102 | 103 | ## Physics/Collision 104 | 105 | - http://arewegameyet.com/categories/physics/ 106 | - https://github.com/kvark/vange-rs/blob/master/bin/road/physics/mod.rs 107 | - https://github.com/kvark/vange-rs/blob/master/src/render/collision.rs 108 | - https://github.com/rukai/canon_collision/blob/master/canon_collision/src/collision.rs 109 | 110 | ## Games 111 | 112 | - https://github.com/rukai/canon_collision 113 | - https://github.com/kvark/vange-rs 114 | - https://kvark.github.io/vange-rs/ 115 | - In a nutshell, it's Metal with Vulkan's binding model https://www.reddit.com/r/rust_gamedev/comments/bcjdl0/learning_wgpurs_coming_from_openwebgl/ektqwx3/ 116 | - https://github.com/Technici4n/voxel-rs 117 | - 2D, space invaders clone https://github.com/parasyte/pixels/tree/master/examples/invaders 118 | - 2D, game of life https://github.com/parasyte/pixels/tree/master/examples/conway 119 | - https://github.com/terrence2/openfa 120 | - https://github.com/derekdreery/rogue 121 | - https://github.com/Limvot/vulkemon 122 | - https://github.com/glalonde/spout/tree/master/rust 123 | - https://github.com/Limvot/vulkemon 124 | 125 | ## Applications 126 | 127 | - pixel editor https://github.com/cloudhead/rx 128 | - https://github.com/Yatekii/sailor 129 | - Realtime 3D N-Body-Simulation: https://git.koesters.xyz/timo/nbodysim 130 | - https://github.com/manuranga/igni 131 | - https://github.com/stevebob/rip 132 | - https://github.com/chiptunecafe/rawrscope 133 | - https://github.com/cbrewster/brewcode 134 | - https://github.com/Elyhaka/Swaynimated 135 | - https://github.com/CryZe/livesplit-one-desktop 136 | - HDR image viewer https://github.com/mandeep/viewimg 137 | - Radiance HDR images (and later OpenEXR) 138 | - https://github.com/KongouDesu/BackupGUI 139 | 140 | ## Examples 141 | 142 | - https://github.com/gfx-rs/wgpu-rs/tree/master/examples 143 | - https://github.com/LordBenjamin/sharp-and-rusty 144 | - https://github.com/rohit507/rust-gfx-experiments 145 | - https://github.com/stevebob/hello-wgpu 146 | - https://github.com/vitvakatu/cubes 147 | - https://github.com/laopo001/wgpu-learn 148 | - https://github.com/xayon40-12/wgpu_ray 149 | - https://github.com/maroider/wgpu_playground 150 | - https://github.com/terrence2/stampede 151 | - https://github.com/Lonsdaleiter/RustTest 152 | - iOS and Metal https://github.com/grenlight/idroid_demo 153 | 154 | ### Older 155 | 156 | - https://github.com/WaDelma/hiekkapeli 157 | - https://github.com/krauslabs/wgpu-vg-toy 158 | - https://github.com/fredlangva/wgpu_one 159 | - https://www.reddit.com/r/rust/comments/c9wsot/i_need_some_help_with_wgpu/ 160 | - https://github.com/WaDelma/hiekkapeli 161 | - https://github.com/menuan/lack 162 | 163 | ## UI 164 | 165 | - https://github.com/hecrj/iced 166 | - https://github.com/dhardy/kas 167 | - https://www.reddit.com/r/rust/comments/ebvp4i/kas_gui/ 168 | - https://github.com/redox-os/orbtk 169 | - bindings for Nuklear (using old `wgpu = "~0.3"`) https://github.com/snuk182/nuklear-backend-wgpurs 170 | 171 | ## Rendering 172 | 173 | - some parts of rendy used by wgpu-rs https://github.com/rust-tutorials/learn-rendy 174 | - svg https://github.com/nical/lyon 175 | - https://github.com/mikialex/rendiation 176 | - text https://github.com/hecrj/wgpu_glyph 177 | - render bitmap fonts without jagged edges even at high magnifications https://github.com/grenlight/sdf-text-view 178 | - terminal https://github.com/stevebob/prototty 179 | - physically-based renderer https://github.com/mad-s/hijiki 180 | 181 | ## About Rendy 182 | 183 | About Rendy and wgpu https://community.amethyst.rs/t/skepticism-about-rendy/1221/9 184 | 185 | >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/ 186 | 187 | >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/ 188 | 189 | >Switching to rendy nearly killed this project due to the time and effort required https://community.amethyst.rs/t/skepticism-about-rendy/1221/11 190 | 191 | >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 192 | 193 | ## WebGPU and portability 194 | 195 | >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 196 | 197 | ## Misc 198 | 199 | - Processing-esque https://github.com/flmng0/peach 200 | - Wave Function Collapse https://github.com/stevebob/wfc 201 | - process images on the GPU https://github.com/danielbusaba/Rust-GPU 202 | - LBM fluid simulation https://github.com/grenlight/fluid-webgpu 203 | - Safe Wrapper Around the Chromium Embedded Framework https://github.com/anlumo/cef 204 | 205 | ## Shading Language 206 | 207 | - https://www.reddit.com/r/shaders/ 208 | - https://github.com/topics/shading-language 209 | - https://github.com/KhronosGroup/Vulkan-Ecosystem 210 | - books, editors, viewers recommendations https://www.reddit.com/r/gamedev/comments/cis14v/good_starting_points_for_learning_to_write_shaders/ 211 | 212 | ### GLSL 213 | 214 | >Found the problem - I need to become a GLSL shader expert https://www.reddit.com/r/rust_gamedev/comments/be08e2/wgpu_pipeline_question/el40lsl/ 215 | 216 | - https://github.com/radixzz/awesome-glsl 217 | - https://thebookofshaders.com/ 218 | - https://vulkan-tutorial.com/Drawing_a_triangle/Graphics_pipeline_basics/Shader_modules 219 | - https://www.lunarg.com/faqs/how-vulkan-shaders-written/ 220 | - https://www.khronos.org/opengl/wiki/Core_Language_(GLSL) 221 | - https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.50.pdf 222 | - https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language 223 | - https://www.reddit.com/r/rust_gamedev/comments/bcjdl0/learning_wgpurs_coming_from_openwebgl/eku9bsr/ 224 | - mandelbrot https://vulkano.rs/guide/mandelbrot 225 | - https://stackoverflow.com/questions/16631981/what-is-the-difference-between-opengl-and-glsl 226 | - https://gamedev.stackexchange.com/questions/4234/what-are-the-pros-and-cons-of-hlsl-vs-glsl-vs-cg 227 | - https://community.khronos.org/t/glsl-and-hlsl-differences/53888/4 228 | - https://stackoverflow.com/questions/2508818/how-to-debug-a-glsl-shader 229 | - https://stackoverflow.com/questions/tagged/glsl?tab=Votes 230 | - https://riptutorial.com/glsl 231 | - http://nehe.gamedev.net/article/glsl_an_introduction/25007/index.html 232 | - https://docs.unity3d.com/2020.1/Documentation/Manual/SL-GLSLShaderPrograms.html 233 | - https://github.com/libretro/glsl-shaders 234 | 235 | ### HLSL 236 | 237 | >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 238 | 239 | - https://github.com/KhronosGroup/glslang/wiki/HLSL-FAQ 240 | - [Complete HLSL -> SPIR-V translator · Issue #362 · KhronosGroup/glslang](https://github.com/KhronosGroup/glslang/issues/362) 241 | - Make HLSL a first-class citizen for Vulkan https://www.khronos.org/assets/uploads/developers/library/2019-siggraph/Vulkan-06-DXC-Update_SIGGRAPH_Jul19.pdf 242 | - https://github.com/microsoft/DirectXShaderCompiler#spir-v-codegen 243 | - https://github.com/google/shaderc-rs 244 | - https://www.reddit.com/r/gamedev/comments/cpdtn6/looking_for_ressources_to_learn_hlsl/ 245 | 246 | ### GLSL vs HLSL 247 | 248 | - use of raw GLSL is only recommended for testing, or when you know you are only targeting Mac OS X, OpenGL ES mobile devices, or Linux. In all normal cases, Unity will cross-compile Cg/HLSL into optimized GLSL when needed. https://docs.unity3d.com/2020.1/Documentation/Manual/SL-GLSLShaderPrograms.html 249 | 250 | >My biggest concerns about using HLSL as the source are: 251 | > - poor specification, or the lack of it 252 | > - alien binding model: GLSL can easily specify descriptor sets and bindings, while HLSL was to resort to a parser-specific attribute magic to specify them. 253 | >https://www.reddit.com/r/rust_gamedev/comments/cgaeuu/graphics_programming_hlsl_vs_glsl/eukphqa/ 254 | 255 | 256 | ### WSL (formerly WHLSL) 257 | 258 | >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/ 259 | > 260 | >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. 261 | 262 | - [WHLSL: Web High Level Shading Language | Hacker News](https://news.ycombinator.com/item?id=18436961) 263 | - https://github.com/gpuweb/WSL 264 | 265 | ### CG 266 | 267 | >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 268 | 269 | ## OpenGL 270 | 271 | - OpenGL is never going to magically become an API that works everywhere portably https://www.reddit.com/r/rust/comments/eh7wkx/the_state_of_ggez_2020/fcj2hyq/ 272 | 273 | ## License 274 | 275 | [![CC0](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/) 276 | --------------------------------------------------------------------------------