This is a real killer feature that will dramatically slow adoption of non-Chromium browsers, even with Google defanging ad blockers.
This is a real killer feature that will dramatically slow adoption of non-Chromium browsers, even with Google defanging ad blockers.
And when it becomes widespread, just like WebGL 2.0, it will be a decade behind of what native APIs are capable of.
And in both cases, good luck debugging, other than replicating the content on native APIs, as means to use proper GPU debuggers, because even Chrome has yet to offer any developer tooling for GPU debugging.
I've recently been shocked trying out the WebGL aquarium demo [0] on Chrome and Firefox after running into some really odd performance issues on a project. You'd expect them to behave about the same with GPU acceleration, but FF barely gets half the framerate at the same load. Like, what?! On Linux FF is also several times slower at canvas rendering.
You absolutely could do this using WebGL2 compute shaders too, but I thought it would be fun to try this newer API.
Here is a very basic shader for what you want:
float freq1 = 2.0;
float freq2 = 3.0;
float amp = 0.5;
pos.z += sin(pos.x * freq1 + uTime) * amp;
pos.z += cos(pos.y * freq2 + uTime) * amp;
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
I will grant that it's a slightly odd distro, but is it any weirder than NixOS or Fedora Silverblue?
let newEz = Ez0[me] + calcEzDiff(vec2u(id.x, id.y), dx, dy, aspect);
let newEzAbove = Ez0[above] + calcEzDiff(vec2u(id.x, id.y + 1), dx, dy, aspect);
let newEzRight = Ez0[right] + calcEzDiff(vec2u(id.x + 1, id.y), dx, dy, aspect);
Hx1[me] = Hx0[me] - (uniforms.dt/mu0)*(newEzAbove - newEz) / dy;
Hy1[me] = Hy0[me] + (uniforms.dt/mu0)*(newEzRight - newEz) / dx;
Ez1[me] = newEz;
let localDelta = delta[me];
let fac = 1 + uniforms.omega * uniforms.dt * (delta[me] / eps[me] / 2);
Ez1[me] = Ez1[me] / fac;
Hx1[me] = Hx1[me] / fac;
Hy1[me] = Hy1[me] / fac;
and then a bunch of other GPU code. You can find this with little effort from the bundle, if you care, by base64-decoding the Pt("xxx") parts.Though I do imagine it indeed could be implementable with WebGL shaders, but I also wouldn't start a new compute-based on it, unless I had a particular need to support older systems. And this I say as a Firefox user..