I just came across this - that WebGL may use OpenGL style API, but it often runs on ANGLE now, translating commands to Vulkan, DirectX or Metal.
So on what platforms or browsers does it not run through ANGLE on?
Does this mean WebGPU will end the reliance on OpenGL on web?
Is OpenGL a dead end in future?
(no longer supported within Unity Editor BTW from 2023)
https://github.com/google/angle
“ANGLE is used as the default WebGL backend for both Google Chrome and Mozilla Firefox on Windows platforms.”
You’d have to direct that question to browser developers. The repository also lists the potentially supported platforms and renderers.
WebGPU makes translation layers like ANGLE superfluous. I’m sure this is one of the key areas where performance boosts are coming from.
WebGPU is essentially an amalgamation of OpenGL and ANGLE, two things put into one where you have a new API with new capabilities talking directly to native platform rendering APIs like Vulkan, Metal, DirectX.
For the web, eventually. Like in a decade or two. It depends on browsers actively stripping OpenGL support from their builds. As long as a fraction of the web still uses WebGL functionality it will be around as an API, just used less.
Chrome and Safari both implement WebGL using the ANGLE library on all platforms. Firefox has its own WebGL implementation library. ANGLE implements WebGL with different backends depending on the OS/device. It uses DX11 on Windows, Vulkan or GLES on Linux and Android, Metal or GLES on macOS and iOS. Firefox does something similar, but with its own library instead of ANGLE. Safari used to use its own library, but when they added WebGL2 support a couple years ago, they dropped their own implementation in favor of using the ANGLE library.
There is no direct relationship between WebGL and OpenGL, other than WebGL is designed to match the API of OpenGL ES 3.0…more or less.
In Unity, the WebGL graphics API is developed on top of the GLES graphics API. It does not directly use ANGLE or any other implementation library of WebGL, it emits WebGL commands from the GL commands, the browser gets the WebGL commands, and uses whatever implementation library it’s going to use internally.
WebGPU is a different API than WebGL, there’s no relationship between WebGL existing and WebGPU existing. WebGPU is implemented similarly to WebGL in that it translates to different backends depending on the OS/device. Chrome implements WebGPU with a library called Dawn, which has a lot of similarities to ANGLE in the way it works. Safari and Firefox both are developing their own implementation library for WebGPU and not using Dawn. In all cases, WebGPU is implemented by another backend API: Metal on macOS/iOS, Vulkan on Linux and Android, DX12 on Windows. WebGPU spec is also developing something called “compatibility mode”, which will be a GLES implementation of WebGPU that will run on devices that can’t run Vulkan, such as lower end Android.
Thanks for the info, I guess the take home is WebGL/WebGPU emits commands - browser deals with them however it wants to! Sounds like could be sub-optimal but really not a concern.
@andyz It’s the web, it has to be done this way for security and stability reasons. A lot of people out there want nothing more than to take over your computer. The browser needs to validate commands before sending them off to the GPU. And that’s not even the biggest impact. The rendering thread of the browser isn’t even in the same process as the page, it’s in a separate process an all commands and resulting render images have to be communicated via IPC. But they try to minimize the impact of all this as much as possible, the translation layer is pretty fast and they’ve been doing the IPC thing since the first version of Chrome. It’s kind of a miracle we get GPU graphics on the web, and that it runs as fast as it does, and I’m grateful we do.