TGUI icon indicating copy to clipboard operation
TGUI copied to clipboard

Suggestion: WebGPU backend support

Open Nathan-M-code opened this issue 7 months ago • 2 comments

Although SDL_GPU is good and supports many platforms, it lack support on a significant number of Android phones, as it requires quite modern Vulkan extensions. SDL_RENDERER and SFML_GRAPHICS doesn't have shader support on android. (My attempts to use the SFML fork which uses OpenGLES2, have been unsuccessful). RAYLIB works on android and allow shader customization, but honestly I don't like to use it.

I suggest the WebGPU as new backend. WebGPU is close to SDL_GPU in its API, it's also modern and will persist for some years. More importantly, it fills the gap in Android support. Since SDL_GPU has already been added, I guess WebGPU wouldn't be a big refactoring.

Nathan-M-code avatar Jul 15 '25 16:07 Nathan-M-code

I don't really like adding new backends because it is a huge amount of work. I'd have to learn how to use WebGPU before I can even begin with this.

Another big hurdle is also making it work together in cmake. It doesn't help that the first page on WebGPU that I opened already began talking about choosing between wgpu-native and Dawn. TGUI needs the same choice as your project, meaning I'll probably end up having to support both (and in a cross-platform way that needs to be tested on every platforms). For SDL_GPU I didn't need more work in cmake because it was part of SDL which could already be linked because of the earlier backends.

That being said, I've been aware of the existence of WebGPU for a while and if there was one backend that I would still be willing to implement then it's WebGPU. I just don't want to do it right now. You could always accelerate the process by already porting the SDL_GPU to WebGPU code yourself 😉

texus avatar Jul 15 '25 17:07 texus

Your answer makes sense. I don't have time and skill to code it myself so I'll be patient. I let you close the issue or assign any tag you think is better, so people can see WebGPU is something they could see in the future. Thank you !

Nathan-M-code avatar Jul 15 '25 17:07 Nathan-M-code