Is WebGPU something that can actually be tested right now?

1.1k Views Asked by At

I have a hobby project that could use some gpu compute, I figured it would also be a great time to test out the new WebGPU API. So far I tried looking at various WebGPU demos on latest versions of both chrome canary and firefox dev edition, both having webgpu flag enabled beforehand but nothing works. In console I get various errors about some vertex buffer or some context not existing, big piles of red.

So.. I was under the impression that I could actually check it out? Does this work for anyone? Is it broken rn?

Possibly relevant system information: Windows 10, Nvidia M3000M

4

There are 4 best solutions below

0
On

Can you show me the error message? If it's your own example, I guess you may not have configured how to introduce it .wgsl file.

webpack4: rules: [{ test: /\.wgsl$/, use: "raw-loader" }]

webpack5: rules: [{ test: /\.wgsl$/, type: "asset/source" }]

vite: import xxx from './xx.wgsl?raw

0
On

As of January 2023 you can enable WebGPU in Canary builds of Chrome if you enable the feature through about://flags.

It's also possible to view some examples (e.g. the ones here) in shipping versions of Chrome. You can request a site token for the origin trial, which will make the feature available for your site--however the site says "The origin trial is expected to end in Chrome 109 (Feb 1, 2023)."

Beta and Nightly builds of Firefox have an implementation of WebGPU that's not as fully featured.

As other answers suggest though, at time of writing it's still pretty experimental and there are very few good demos beyond spinning cubes and some basic particle systems.

0
On

I've been toying with WebGPU in Chrome and it seems to be possible to test without major issues.

It does seem that a number of demos out there are outdated, using an older API or syntax for WSGL, but most of the time I'm just getting warnings and not errors. Those warnings are quite informative and have been straightforward to fix too (eg: replacing [[location(0)]] with @location(0)).

As a tip, I've been using it with TypeScript and combining it with @webgpu/types makes the development way easier.

1
On

Here an answer to the main question, if webgpu can be tested yet:

As @Rob mentioned as well, caniuse.com/webgpu shows that

no browser has it activated by default yet

but you CAN TEST IT by activating it as experimental feature, there just won't be many users able to see your work if you were to publish the site.

(august 2022)