Are you a WebGL developer that's curious about what it will take to migrate to WebGPU in the future? My #1 tip for you is: Start using WebGL 2.0's Uniform Buffer Objects right away! (Basically: Storing your uniforms in buffers just like your vertex data.)
The reason is that uniform buffers are the ONLY way to pass uniforms to shaders in WebGPU (and Metal/Vulkan/D3D12, for that matter), so if your code is already preparing it's uniforms for that style of usage it'll be much easier to port. Oh, and they're more efficient too!
Admittedly, Uniform Buffers (commonly referred to as UBOs) don't have a particularly elegant API in OpenGL/WebGL, and as such their documentation can be pretty impenetrable at first glance. https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object
If you look at that link and feel your brain dribbling out your ears, don't feel bad. UBOs in OpenGL are very indirect and jargony stuff. Something like this video explains the concept/usage better.
Briefly, one benefit of using UBOs is that you can take data that's common to multiple programs (such as your projection/view matrix) and bind them once for *the entire frame*. Obviously that's going to be faster than setting multiple uniform values every time you switch shaders.
You can follow @Tojiro.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.