Skip to content

gaeldevdev/WebGPU-03-Triangle

Repository files navigation

WebGPU-03-Triangle

Example of Vite + WebGPU + TypeScript

Draws a simple triangle

Run on Chrome Canary

Download Chrome Canary https://www.google.com/chrome/canary/

And enable WebGPU by typing chrome://flags/#enable-unsafe-webgpu in the address bar

Run the development version

For the development version, run the following command int the main directory:

npm install

and then run

npm run dev

Vite js will then serve locally the page:

  VITE v4.1.1  ready in 200 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help

Browse the address above in Chrome Canary

Make a build

To make a build run the following command in the main directory:

npm run build

The page is generated in dist/index.html