The EGL_ANGLE_power_preference extension advertised by ANGLE, and used by the ANGLE backend for WebGL to implement the powerPreference attribute, has some deficiencies preventing it from working as desired.
1) ANGLE never calls CGLSetVirtualScreen against its internal CGLContextObj when either activating or deactivating the discrete GPU. This means that the "high-performance" power preference is effectively a no-op, even though the discrete GPU is actually being activated via the allocation of a CGLPixelFormatObj that doesn't support offline renderers.
2) If this started being called, multisampled renderbuffers would stop working which were allocated on the "other" GPU. This behavior was discovered in Chromium and has just been worked around in https://bugs.chromium.org/p/chromium/issues/detail?id=681341#c58 . The symptom is that content with antialias:true (the default) stops rendering.
In order to fix these issues, it appears the following changes are needed:
A) ANGLE's implementation of EGL_ANGLE_power_preference needs to be improved to actually call CGLSetVirtualScreen appropriately.
B) Some sort of callback notification about GPU switching needs to be dispatched out of ANGLE back to WebKit.
C) WebKit needs to respond to these notifications:
C1) For WebGL 1.0 contexts with preserveDrawingBuffer:false, or WebGL 2.0 contexts with preserveDrawingBuffer:false *and* no user-allocated multisampled renderbuffers, silently reallocate the multisampled renderbuffers associated with the antialiasing implementation.
C2) For any contexts with preserveDrawingBuffer:true, *or* WebGL 2.0 contexts in which the user has allocated a multisampled renderbuffer, force a context lost and context restored event pair.
Any feedback on whether this appears to be the correct approach is greatly appreciated.
Note: this applies only to ANGLE's OpenGL backend. Since Apple's probably not going to ship that, this may be able to be closed as WontFix.
I believe we only intend to support Metal for new features, so indeed marking as WONTFIX.