Porting WebGL Shaders to WebGPU
41–50 of 64 posts
Re: Porting WebGL Shaders to WebGPU
#42> GLSL supports the ternary ?: operator. WGSL does not support this, but provides the built-in function select(falseValue, trueValue, condition) which does much the same thing (although mind that parameter order!). I'd really like to hear a justification for that parameter order. To me it seems like the 4th best option out of 6.
Re: Porting WebGL Shaders to WebGPU
#43> GLSL supports the ternary ?: operator. WGSL does not support this, but provides the built-in function select(falseValue, trueValue, condition) which does much the same thing (although mind that parameter order!). I'd really like to hear a justification for that parameter order. To me it seems like the 4th best option out of 6.
Re: Porting WebGL Shaders to WebGPU
#44> GLSL supports the ternary ?: operator. WGSL does not support this, but provides the built-in function select(falseValue, trueValue, condition) which does much the same thing (although mind that parameter order!). I'd really like to hear a justification for that parameter order. To me it seems like the 4th best option out of 6.
It could be because it matches the order of glsl's `mix()`. Not sure why glsl chose that order, though perhaps you might find it less unintuitive for an interpolation than a select. (Mix acts as a select rather than interpolation when the third argument is a boolean)
EDIT: I think I get it, there also a mix() with a different type signature but same parameter order.
Re: Porting WebGL Shaders to WebGPU
#45As someone who's never used this API: is there some kind of permission prompt for this before websites start trying to use my GPU for crypto mining? Most CPU crypto miners were basically worthless, but GPU power is a whole lot more powerful.
https://arxiv.org/pdf/1904.13071&ved=2ahUKEwipqPGblenzAhWDbs...
Re: Porting WebGL Shaders to WebGPU
#46Earlier quoted context omitted.
It is currently shipping behind a flag in desktop versions of Chrome (and all its derivatives), Safari, and Firefox. It is also shipping behind a flag in Firefox for Android. I don't think it's too far out from finally shipping. The biggest boon would be for mobile devs to help avoid the 30% store tax, but this is also the reason why mobile Chrome and mobile Safari (especially Safari) tend to lag behind in major ways…
What Safari is shipping behind a flag is not anything like the current version of WebGPU. I don't think it supports WGSL, for example. It's going to be a long time before all three browsers have shipped implementations that are interoperable and not behind flags. I don't think WebGPU is the biggest thing that's going to let mobile game devs start shipping on the web. WebGL 2 can do graphics well enough today. Other t…
Re: Porting WebGL Shaders to WebGPU
#47Our team is working to build out support for Unreal Engine 4 and Unreal Engine 5 to support WebGPU, so game developers and real-time 3D developers can export their creations to the web at near native performance and access features like computer shaders. Long term goal is to disrupt Steam and the App Stores. We're also working on WebXR support to enable UE VR apps on the web. If anyone is interested and wants to lear…
As a gamer though, why would I want to play any of these developers' games through the browser instead of Steam?
Re: Porting WebGL Shaders to WebGPU
#48Re: Porting WebGL Shaders to WebGPU
#49As someone new to the WebGL scene, can someone shed light on what are the motivations in porting WebGL to WebGPU?
Re: Porting WebGL Shaders to WebGPU
#50I took a very different approach for porting my WebGPU shaders over: I have far too many shaders to port (sometimes pretty massive ones! [0]), so I used Naga [1] at to runtime-translate my GLSL shaders to WGSL. I had to get involved a bit upstream to fix quite a few different bugs in the implementation, but once I got it working I was really happy with the result. It's quite fast, it compiles to a pretty light-weight…
Why do you do this translation at runtime--causing every user to have to re-execute it--instead of at compile-time? Is there some kind of per-user optimization this makes possible?