Live data from Hacker News

WebGPU – All of the cores, none of the canvas

surma.dev

71–80 of 137 posts

Re: WebGPU – All of the cores, none of the canvas

#71

Earlier quoted context omitted.

Yes, in fact GPUs are perfect for this. Here is a Monte Carlo financial simulation I built in WebGL 2. https://james.darpinian.com/money/ (Warning, programmer UI) It performs one million Monte Carlo runs instantly every time you move a slider. Each run is one execution of a pixel shader and they all happen in parallel. WebGPU will make this kind of thing more accessible. It's kind of a pain to do it in WebGL, but eve…

Hmm the UI is super unresponsive for me. As in, I try to move a slider, I can't tell where it's moving to... then I let go and it's somewhere I didn't expect. Latest Firefox, Windows 10, Radeon RX 6700XT 16GB.

Do other WebGL 2 demos work well for you? Does it work in Chromium?

I haven't tested the code extensively so I'm sure it's broken in some configurations. It's just a proof of concept demo for now.

Re: WebGPU – All of the cores, none of the canvas

#72

Earlier quoted context omitted.

Yes, in fact GPUs are perfect for this. Here is a Monte Carlo financial simulation I built in WebGL 2. https://james.darpinian.com/money/ (Warning, programmer UI) It performs one million Monte Carlo runs instantly every time you move a slider. Each run is one execution of a pixel shader and they all happen in parallel. WebGPU will make this kind of thing more accessible. It's kind of a pain to do it in WebGL, but eve…

Hmm the UI is super unresponsive for me. As in, I try to move a slider, I can't tell where it's moving to... then I let go and it's somewhere I didn't expect. Latest Firefox, Windows 10, Radeon RX 6700XT 16GB.

I'm on Windows 11 with a Radeon RX570 8gb and it runs fine under Edge.

On Firefox it's way laggier but still usable.

Re: WebGPU – All of the cores, none of the canvas

#74

Am I understanding this right, that websites can now run a crypto miner in the background when I visit them?

No. Crypto miners have always been possible and WebGPU does not make them faster than they would be in WebGL 2 which has been available for a long time already.

I’m not up to date on the latest mining algorithms but is it true that they’re all embarrassingly parallel to the point the WebGPU makes no difference? Fast inter-thread communication is the big addition here.

Re: WebGPU – All of the cores, none of the canvas

#75
post #74

Earlier quoted context omitted.

No. Crypto miners have always been possible and WebGPU does not make them faster than they would be in WebGL 2 which has been available for a long time already.

I’m not up to date on the latest mining algorithms but is it true that they’re all embarrassingly parallel to the point the WebGPU makes no difference? Fast inter-thread communication is the big addition here.

I guess it depends on the specific cryptocurrency. I don't think the big ones would benefit. Maybe some niche ones could see some kind of benefit, but making mining somewhat more efficient isn't going to change the incentives for drive by miners that much because efficiency doesn't matter when it's someone else's electricity you're wasting.

Re: WebGPU – All of the cores, none of the canvas

#76
I've busted my ass on webgl a few times, and I am not really seeing how WebGPU is a substantially better API looking at the samples in the wild:

https://webkit.org/demos/webgpu/scripts/hello-triangle.js

The advantages of WebGPU vs WebGL probably make sense to experts in this area, but I still find most of it to be completely impenetrable at first glance as a relative novice.

Re: WebGPU – All of the cores, none of the canvas

#77
post #76

I've busted my ass on webgl a few times, and I am not really seeing how WebGPU is a substantially better API looking at the samples in the wild: https://webkit.org/demos/webgpu/scripts/hello-triangle.js The advantages of WebGPU vs WebGL probably make sense to experts in this area, but I still find most of it to be completely impenetrable at first glance as a relative novice.

I think one of the big changes will allow for async gpu uploads. Currently those happen on the main thread and lock UI.

Re: WebGPU – All of the cores, none of the canvas

#78

If I'm already familiar with Rust, how is WebGPU as an introduction to graphics programming if you aren't already familiar with any of the backends that it wraps? Should I try just learning Vulcan first? Is the abstraction layer just going to introduce additional confusion for a newbie?

"Is the abstraction layer just going to introduce additional confusion for a newbie?" As a newbie you probably don't want to deal with WebGPU directly, but rather use (wait for) a framework, that takes care of the details.

Exactly. It's going to be much more productive for someone totally new to 3D graphics to play with three.js and learn all about models, meshes, textures, shaders, coordinate spaces, cameras, etc. If you're starting with webgpu or even webgl you're going to get mired in eccentricities of buffer management, byte formats, etc. which are important plumbing but just that--plumbing.

Re: WebGPU – All of the cores, none of the canvas

#79

So now there are three incompatible graphics APIs in the browsers which are also incomplete in different ways. Each of them is a huge chunk of code that needs to maintained and updated.

There's at least five now: DOM, canvas, SVG, webgl, webgpu. Could maybe make an argument that fonts are an entirely separate rendering engine with quirks and issues too. CSS Houdini might even be another new one.

Re: WebGPU – All of the cores, none of the canvas

#80

If I'm already familiar with Rust, how is WebGPU as an introduction to graphics programming if you aren't already familiar with any of the backends that it wraps? Should I try just learning Vulcan first? Is the abstraction layer just going to introduce additional confusion for a newbie?

Start with WebGPU. There's a great resource here: https://sotrh.github.io/learn-wgpu/.
Post reply on HN