top | item 41161980

(no title)

FragmentShader | 1 year ago

> WebGPU is super slow on GPU and all the official benchmarks only care about CPU performance.

omg I thought I was the only one that found that. I tried webgpu (On a native context) and it was slowwwww. Only 10k non-overlapping triangles can bring my RTX GPU to its knees. It's not the shader because it was only a color. It's not the overlapping (And I tried a depth prepass as well). It's not the draw calls. The API is slow, straight up.

In fact, you can try to open a WebGPU demo in your browser and check the GPU usage in the Task Manager. Close it, open a random webgl Unity game and you'll see how much a single WebGPU triangle takes compared to a full-fledged game.

On my computer, the average Unity game with shadows, shaders 'n stuff takes 5% GPU and a simple WebGPU demo takes 7%.

discuss

order

grovesNL|1 year ago

> Only 10k non-overlapping triangles can bring my RTX GPU to its knees

Your benchmark doesn't match the experience of people building games and applications on top of WebGPU, so something else is probably going on there. If your benchmark is set up well, you should be limited by the fill rate of your GPU, at which point you should see roughly the same performance across all APIs.

> On my computer, the average Unity game with shadows, shaders 'n stuff takes 5% GPU and a simple WebGPU demo takes 7%.

GPU usage isn't a great metric for performance comparisons in general because it can actually imply the inverse depending on the test case. For example, if the scenes were exactly the same, a lower GPU usage could actually suggest that you're bottlenecked by the CPU, so you can't submit commands fast enough to the GPU and the GPU is sitting idle for longer while it waits.

FragmentShader|1 year ago

> Your benchmark doesn't match the experience of people building games and applications on top of WebGPU

Here's an example of Bevy WebGL vs Bevy WebGPU:

I get 50 fps on 78k birds with WebGPU: https://bevyengine.org/examples-webgpu/stress-tests/bevymark...

I get 50 fps on 90k birds with WebGL: https://bevyengine.org/examples/stress-tests/bevymark/

So you test the difference between them with technically the same code.

(They can get 78k birds, which is way better than my triangles, because they batch 'em. I know 10k drawcalls doesn't seem good, but any 2024 computer can handle that load with ease.)

Older frameworks will get x10 better results , such as Kha (https://lemon07r.github.io/kha-html5-bunnymark/) or OpenFL (https://lemon07r.github.io/openfl-bunnymark/), but they run at lower res and this is a very CPU based benchmark, so I'm not gonna count them.

> be limited by the fill rate of your GPU

They're 10k triangles and they're not overlapping... There are no textures per se. No passes except the main one, with a 1080p render texture. No microtriangles. And I bet the shader is less than 0.25 ALU.

> at which point you should see roughly the same performance across all APIs.

Nah, ANGLE (OpenGL) does just fine. Unity as well.

> a lower GPU usage could actually suggest that you're bottlenecked by the CPU

No. I have yet to see a game on my computer that uses more than 0.5% of my CPU. Games are usually GPU bound.