Re: WebGPU polyfill using WebGL2 - would it be feasible and/or make sense?

All Web APIs are, of course, welcome to be pollyfilled to the extent that it's possible. Creating a 3D renderer which looks a lot like the WebGPU API, and has backends for WebGPU and WebGL, sounds like a valuable thing to have.

Beware, there are some places that are tricky to polyfill today. Chief among them is the fact that, in WebGL, textures and samplers are joined into a single API object, but in WebGPU, they are distinct objects. This set of difficult-or-impossible to pollyfill parts of WebGPU will likely increase over time, rather than decrease.

The standardization group discussed something similar in May; you can read the minutes at https://docs.google.com/document/d/1QCnrt5Dd563PQyCiP8UkVrWgsFCWVCLLMxiMx5Fl23A/edit# <https://docs.google.com/document/d/1QCnrt5Dd563PQyCiP8UkVrWgsFCWVCLLMxiMx5Fl23A/edit#> (see the section titled WebGPU compat). The discussion was about the possibility of reducing or eliminating these difficult parts, so WebGPU might be implementable on OpenGL, which would dramatically increase the possibility of polyfilling. However, I believe that discussion ended with the conclusion that it would be difficult to accomplish this without also limiting the ability for the WebGPU API to grow and improve beyond what OpenGL allows.

If you do come up with a library which acts similarly to the WebGPU API, and renders to WebGL, I’m sure this group would love to hear your findings and discoveries while making such a thing. This type of feedback is valuable when designing any kind of 3D graphics API, including WebGPU. I’m looking forward to hear back from you on your discoveries!

Thanks,
Myles

> On Nov 20, 2019, at 5:48 AM, Eamon O'Tuathail <eamon.otuathail@gmail.com> wrote:
> 
> WebGPU and WebGL2 do not provide the exact same feature set, but there is a good bit of overlap. For early adopter web application developers eager to get started with WebGPU now, would a polyfill of a subset of WebGPU features implemented using WebGL2 be feasible and/or make sense?
> 
> WebGL2 is widely available today in production web browsers:
>   https://caniuse.com/#feat=webgl2 <https://caniuse.com/#feat=webgl2>
> and WebGPU, though progressing nicely, still has a long way to go before that. 
> 
> So what are the options for web application developers who want to use some parts of WebGPU in production code today? A polyfill would seem the best. A polyfill will not give the same level of performance as a native WebGPU implementation or the full feature set, but may be sufficient for certain deployment scenarios - such as code samples in training courses, product demos, proof of concept projects. etc.. It would not be suitable for heavy-duty gaming or other intensive 3D rendering workloads - that is accepted.

Received on Thursday, 21 November 2019 19:40:25 UTC