not-fl3 / macroquad

Cross-platform game engine in Rust.
Apache License 2.0
3.28k stars 318 forks source link

WGPU Backend #342

Open undersquire opened 2 years ago

undersquire commented 2 years ago

This isn't an urgent issue, however, Apple has deprecated OpenGL on all of their platforms, meaning that they could simply drop support for it at any time with any new release. This would break macroquad's support for these platforms.

So I am curious if there are any plans to add support for a WGPU backend, since it supports many various backends under the hood including OpenGL, DirectX, Metal, Vulkan, etc all under one unified API. This can allow the user to choose what backend to compile with in order to build for certain platforms, for example, using DirectX for windows, Metal for Apple's platforms, and OpenGL or Vulkan for everything else without macroquad having to manually add/support each of these backends.

alexmozaidze commented 2 years ago

wgpu has a best-effort support for OpenGL, which means that some OpenGL graphics cards that lack certain functionality cannot be supported by wgpu (aka my integrated graphics). It would be nice to have wgpu as a default option, and the old renderer as a fallback.

undersquire commented 2 years ago

I agree, I think having WGPU as the default with an OpenGL fallback would be the best way to go.

Edersteiner commented 2 years ago

Metal support would be greatly appreciated. OpenGL just doesn't have a bright future (or any future at all) on MacOS. Apple Silicon also runs Metal apps like a dream.

NHodgesVFX commented 2 years ago

I think a WGPU back end would also be good as well. People here have already mentioned the apple issues with OpenGL, so I wanted to look at some other reasons. Having WGPU as a backend options means it would be possible to do more advanced things like compute shaders, even if it doesn't get exposed directly I assume you would still be able to access it. WGPU could also bring better performace as well.

One thing I did notice though was the WGPU seems to be larger in size where macroquad with its current renderer on web seems to be around 500kb WGPU is around 2mb. So it would be nice to have both renderers available so you can pick and choose whats best for your project.

Granted having two renderers seems like it would be a lot to maintain though.

lenscas commented 1 year ago

One thing I did notice though was the WGPU seems to be larger in size where macroquad with its current renderer on web seems to be around 500kb WGPU is around 2mb. So it would be nice to have both renderers available so you can pick and choose whats best for your project.

I haven't looked at this at all yet but... is the size difference really that big on WASM, especially on browsers that support webgpu? (I know, still early but oh well). Sounds like all it would need to do in that environment is acting as bindings to the webgpu API...

miwarnec commented 6 months ago

Bump: macroquad for wgpu would be super valuable.