Bug 1579664 Comment 2 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Recreating the GLContext would mean that we'd also need to recompile shaders on GPU switch, which is, in some ways, the opposite of what bug 1494763 wants to achieve. Maybe we could keep around two GLContexts, one for each GPU, and reuse them.
Switching GPUs changes a window's `CGDirectDisplayID` (`[[[[window screen] deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]`). 
I think the following might be a nice solution:
 1. Create one GLContext per `CGDirectDisplayID`. For compositing into a window, use the GLContext for that window's screen.
 2. When a `CGDirectDisplayID` becomes unused, because no window is on a screen with that ID any more, keep around the GLContext if that display ID is for the internal display (CGDisplayIsBuiltin), otherwise throw the GLContext away.
Recreating the GLContext would mean that we'd also need to recompile shaders on GPU switch, which is, in some ways, the opposite of what bug 1494763 wants to achieve. Maybe we could keep around two GLContexts, one for each GPU, and reuse them.
Switching GPUs changes a window's `CGDirectDisplayID` (`[[[[window screen] deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue]`). 
I think the following might be a nice solution:
 1. Create one GLContext per `CGDirectDisplayID`. For compositing into a window, use the GLContext for that window's screen.
 2. When a `CGDirectDisplayID` becomes unused, because no window is on a screen with that ID any more, keep around the GLContext if that display ID is for the internal display (`CGDisplayIsBuiltin`), otherwise throw the GLContext away.

Back to Bug 1579664 Comment 2