Bug 161026 - [macOS] CGL virtual screen changes do not cause us to lose the WebGL context
Summary: [macOS] CGL virtual screen changes do not cause us to lose the WebGL context
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-08-19 20:12 PDT by Myles C. Maxfield
Modified: 2016-08-23 13:23 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2016-08-19 20:12:26 PDT
According to [1],

"A change in the virtual screen indicates a renderer change, a change in renderer capability, or both."

"When the renderer changes, the limits and extensions available to OpenGL may also change. Your application should retest the capabilities of the renderer and use these to choose its rendering algorithms appropriately."

This can be achieved by listening for NSWindowDidChangeScreenNotification. We currently do this and plumb it through to the web process, eventually ending up in WebPage::windowScreenDidChange() and Document::windowScreenDidChange(). We should make this function cause WebGL contexts to be lost. This will cause web content to re-investigate the current renderer capabilities.

[1] https://developer.apple.com/library/prerelease/content/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_contexts/opengl_contexts.html#//apple_ref/doc/uid/TP40001987-CH216-SW12
Comment 1 Radar WebKit Bug Importer 2016-08-23 12:05:12 PDT
<rdar://problem/27972612>
Comment 2 Myles C. Maxfield 2016-08-23 13:23:58 PDT
(In reply to comment #0)
> ... We should make this function cause WebGL
> contexts to be lost.

This only needs to happen if the virtual screen of the context changes. We don't need to do this every time the user drags a window to an external monitor.