I have an important question about webgpu

  1. What Graphics API does Babylon.js use when using Webgpu?

  2. What Graphics API do you usually use?

  3. Is there a function to choose options…? ( Graphics API select function)

  4. Three.js also supports Webgpu
    Is there a difference in WebGPU driving between Three.js and Babylon.js?
    What would be the difference if there was a difference?

For general explanations about WebGPU, I would refer to: WebGPU - Chrome Developers, WebGPU Explainer (gpuweb.github.io) and mikbry/awesome-webgpu: :sunglasses: Curated list of awesome things around WebGPU ecosystem. (github.com). In short, WebGPU is itself a graphics API that can communicate with the underlying system GPU in an uniform way. WebGPU doesn’t care about which Graphics API the underlying system uses, it just sends commands to the GPU and expects it to execute:

You can read more about the WebGPU suport in Babylon here: WebGPU Support | Babylon.js Documentation (babylonjs.com)

Both Three and Babylon use the same WebGPU API.

4 Likes

In the webGL environment,
Is there any option to select and use the Graphics API?

It is said that the functionality was improved through Vulkan, but does the functional improvement work the same way when using DirectX and Metal?

Yes, WebGPU is an API on top of Vulkan/DirectX/Metal, so depending on your computer and your settings, one of these backends will be used by the browser.

You can choose which backend the browser is using (at least in Chrome and Edge) in chrome://flags:

6 Likes

Wow, thank you so much It’s the answer I’ve been looking for!

Can’t I use Vulkan? You can use it in browser, but if you use WebGPU and Vulkan together, you will get an error

When using Directx
Do I use Vulkan by detour?

Can I have or implement a demo using Vulkan, Babylon.js in my web environment?

It’s up to the browser to support a graphics API or not, depending on your hardware. Though it’s strange it does not work with Vulkan if the option is available… What is the error message you get?

2 Likes

Test Result
Chrome canary Vulkan X Webgpu O
Edge canary Vulkna X Webgpu O
Chrome Vulkan O Webgpu X
Edge Vulkan O Webgpu X
Firefox Nightly Webgpu X
Opera Webgpu X
Naver Whale beta Webgpu X

My enviroment
NVIDIA GeForce RTX 3060
Intel(R) Core™ i7-12700KF
x64
Windows 10 Pro

I want to test Babylon.js My project using Vulkan in my entire web environment!
WebGL DirectX, OpenGL Babylon.js VS WebGPU Bulkan Babylon.js
I want to do it, but I have a lot of difficulties. Can you help me?

:boom:If I use DirectX when I use Webgpu, do I bypass the Vulkan function?

I want to do a test similar to this. If I can’t use Vulkan, I want to know why…

If you are browser based, you should not be concerned about which underlying API the browser is using because you won’t be able to use it directly. I guess that your example is a native example and has direct calls to either OpenGL or Vulkan APIs.

On some platform, you will be able to choose an API (as shown in one of my post above), but normally you don’t need to do that and the “default” setting should be the right setting.

Yes.

DirectX (12), Vulkan and Metal are the 3 APIs used for state of the art graphics these days. Broadly speaking, DirectX is for Windows, Vulkan for Linux and Metal for Mac OS. Of course, Vulkan can be used in Windows too, but DirectX is the primary API in Windows.

The browser will use the appropriate API depending on your hardware and settings.

We have a Ocean WebGPU demo in Babylon.js if you are interested:

Note that WebGPU is not yet released and won’t be released for a few months, so a number of things are still likely to change before v1 is released.

2 Likes

Thank you so much!!
Lastly, may I know how to bypass the Graphics API?

What do you mean by bypassing the graphics API? The browser has to use a graphics API to render things. What you can do is choosing the one it should use in the list provided (it also depends on the browser, I guess, I only checked in Chrome).

Yeah there’s no way to force the user’s browser to use a specific API, and it shouldn’t matter to a WebGPU developer anyway as its entire point is to be independent of them

I’m sorry. This is the only place I can ask…
By bypassing it means turning around like a VPN and using Vulkan on DirectX!

As said above, in Chrome / Edge you can force the browser to use a specific API here:

There’s probably the same possibility in Firefox.

I know that I can choose from a browser, but what I’m curious about is that even if I select DirectX from a browser, do I bring and use the Vulkan function?It is.

If I choose DirectX, I don’t use Vulkan at all?

DirectX, Vulkan and Metal are 3 different APIs to do graphics. If you choose one, you don’t use the others.

So, when using DirectX, you don’t use Vulkan nor Metal.

3 Likes

Oh, I see. Thank you.