The implementation was removed with the migration to ANGLE. This
reimplements it. This is required by Stimulation Clicker on neal.fun,
which does not clear the framebuffer itself, instead relying on the
browser doing it.
This is used to put together the list of supported WebGL extensions
based on the available extensions, per-extension required extensions
and WebGL version.
This causes it to enforce the sections "Differences Between WebGL and
OpenGL ES 2.0" from the WebGL 1 specification and "Differences Between
WebGL and OpenGL ES 3.0" from the WebGL 2 specification. It also
disables a bunch of extensions by default, which we must now request
with glRequestExtensionANGLE.
By doing that we eliminate the need for the vertical flip flag.
As a side effect it fixes the bug when doing:
`canvasContext2d.drawImage(canvasWithWebGLContext, 0, 0);`
produced a flipped image because we didn't account for different origin
while serializing PaintingSurface into Gfx::Bitmap.
Visual progress on https://ciechanow.ski/curves-and-surfaces/
OpenGL's origin is at the bottom-left corner, while Skia's origin is at
the top-left corner. This change adds a transformation to compensate for
this difference when rendering PaintingSurface attached to WebGL
context.
For now only macOS is supported.
IOSurface is used as a backing store because it will allow us to read
it from Skia and write to it from OpenGL without any extra copying:
- ANGLE_metal_texture_client_buffer extension is used to create
EGLSurface from IOSurface.
- Then the same IOSurface is wrapped into Metal texture and passed to
Skia allowing to share the same memory between Skia Metal backend and
ANGLE.