Well since we have a forum for these topics now, might as well.
Current status
Our current renderer, Clyde, is an old OpenGL 3 renderer I wrote when I didn’t know what I was doing. It is plagued by many issues:
- Internals are extremely messy.
- Advanced rendering things have to be made directly in Robust, not flexible enough for content.
- The shader parsing is a pretty crappy handrolled thing.
- OpenGL is a broken API and causes tons of platform integration issues.
The problem space
Platform native graphics APIs are a mess:
- Direct3D 11 is decently nice to use, has good hardware support, but is Windows only.
- Direct3D 12 is still Windows only and very complicated.
- OpenGL is utterly broken and terrible in every way, but “works everywhere” for some definition of “works”.
- Vulkan is native only on Linux. On Windows it is supported by drivers, but I don’t trust it enough to rely upon. MoltenVK is also ehhh. And it’s still too complicated like D3D12.
- Metal is Apple-only but apparently pretty nice.
We would like to not have to make multiple graphics backends to support all these platforms. Furthermore, we’d need to design a powerful API that content can use to render custom graphics without the constraints of our existing AP.
The plan
The plan (that I started working on 2 years ago and didn’t finish) is to move the renderer to WebGPU. Despite being designed web-first and having a lot of stupid moments in their standards process, it is looking like a decent option all things considered.
One of the core ideas I have is that we should directly expose WebGPU’s API to content. It should be safe given that it is after all designed to run in web browsers. It’ll be a very powerful API suitable for many things we currently have to hardcode into the engine.
The entire plan will involve a lot of Rust code to tie everything into wgpu. This is something I want to do anyways.
For shaders, it’s probably best to use WESL or something.
Possible issues
Native library stability
WebGPU and wgpu are not yet ABI stable. This means future upgrades may break older engine versions. Likely the sanest way to solve this is to have the launcher dynamically download the native library build like it does the engine, but it will require signing the binaries for me to be comfortable with that. We’d kinda want this for better HWID in the future anyways though.
Hardware support
wgpu supports OpenGL 3.3+, D3D12 FL 11_1, Vulkan, and Metal. The tightest part is that this may mean we’d be dropping 10+ year old Intel iGPUs. According to Steam’s HW Survey, there’s some 1% of people that do not have proper D3D12 GPU. Some of those may be able to play with the D3D12 backend regardless (due to the way FLs work) but the Intel players can’t becase Intel removed the support from their driver due to a vulnerability.
I honestly don’t know if we want to drop this or not, honestly.