Closed KnorpelSenf closed 4 months ago
I tired adding wgpu backend to surfman, but didn't get very far (I didn't have much time). I think that adding wgpu to surfamn shouldn't be that hard, but adding wgpu support would be a big project for itself. It was already attempted before, but with gfx-rs.
Somehow relevant is https://github.com/servo/servo/issues/21320, if we could somehow implement GLES on top of wgpu we get WR, surfman, webgl, ... everything we want. ANGLE already has wgpu (actually uses dawn, but I think wgpu and dawn can both be abstracted with wgpu-native ...) backend: https://github.com/google/angle/tree/main/src/libANGLE/renderer/wgpu
I tired adding wgpu backend to surfman, but didn't get very far (I didn't have much time).
Is this code still public?
I think that adding wgpu to surfamn shouldn't be that hard, but adding wgpu support would be a big project for itself.
What do you mean, it is not that hard but at the same time it is a big project for itself?
Somehow relevant is servo/servo#21320, if we could somehow implement GLES on top of wgpu we get WR, surfman, webgl, ... everything we want. ANGLE already has wgpu (actually uses dawn, but I think wgpu and dawn can both be abstracted with wgpu-native ...) backend: google/angle@
main
/src/libANGLE/renderer/wgpu
Does that mean that all of these libraries would have to be compiled to WebAssembly? Is that feasible?
Is this code still public?
I think it's lost, I do not have it on my machine nor my fork, but it was nothing so no real loss.
What do you mean, it is not that hard but at the same time it is a big project for itself?
Hard IMO.
I imagine that if I can have surfman work in a browser, WR will work there, too. I also don't know a lot about webrender—is there a flaw in this assumption?
I think that would not work like like that. Surfman only manages surfaces. WebRender does not depend on surfman to access GPU, it uses gleam to access OpenGL I think. Here is fork that has done gfx-rs work: https://github.com/szeged/webrender and they were paid by mozilla IIRC.
Does that mean that all of these libraries would have to be compiled to WebAssembly?
Not necessarily, you just need to link "gl-wgpu" with it. Something similar was done for vulkan: https://github.com/gfx-rs/portability.
I think that would not work like like that. Surfman only manages surfaces. WebRender does not depend on surfman to access GPU, it uses gleam to access OpenGL I think.
Oh alright. I guess then the scope of this is very different from what I assumed (which is not surprising). Thanks for explaining! <3
I am interested in browser support for surfman. The README section about future work states
I mainly have a number of questions about this. I have very limited experience with graphics libraries and virtually no experience with surfman, so bear with me if some questions have trivial answers or if the questions don't make sense :)
wgpu
which provides a graphics API and that runs in the browser. My naïve understanding is that surfman can “just” wrapwgpu
and thereby have browser support. How far off am I? What else is needed?So in summary, in a few weeks time, I would like to attempt the following. Please stop me and tell me why that's a bad idea:
surfman/src/platform
for browser support