This repository is now archived as I don't have time to track WebGPU changes...
Worry not :) I see that WebGPU enthusiast are starting to provide simple and updated WebGPU starters, check this one for example: https://github.com/monfera/minimal-webgpu-triangle
An example of how to render a triangle with WebGPU using WebGPU Shading Language - the "Hello World!" of computer graphics. Details in blog post: https://en.morzel.net/post/webgpu-wgsl-hello-triangle
If your browser supports WebGPU and WGSL, you should be able to see a gray square with a green triangle in the center. And that's it.
Live example: https://morzel85.github.io/webgpu-wgsl-hello-triangle/index.html
Please mind that WebGPU and WGSL specs are not finalized and implementations are changing! Visit webgpu.io to check current status.
WebGPU is a low-level API so its “Hello World!” can’t be a one-liner, nevertheless this repo is meant to be as simple as possible. Just two files: one for HTML and one for JavaScript - no Node.js, Webpack etc.
Is it possible to simplify the code further? Teach me how! :)
- Renders properly and without warnings in Chrome Canary v91.0.4457.2 x64 Win 10 with --enable-unsafe-webgpu flag set.
Code is based on https://github.com/austinEng/webgpu-samples