- 
                Notifications
    
You must be signed in to change notification settings  - Fork 535
 
Description
Intro
Looking more at our current issues with GL presentation (#3353), at surfman code (servo/surfman#202), and around, I think we need to approach this from the ground up again.
First of all, surfman (used in #3375) brings a lot of friction:
- it's a big 3rd party dependency
 - it has a questionable code base (strange choice of features, many dependencies, hugely outdated code style)
 - assumptions don't always match (Panic in destroy_surface on GL #3467)
 - close to be unmaintained now
 - needs to be rewritten largely, due to Decouple surfaces from GL contexts servo/surfman#202
 
We contributed a bit to it, but it takes a lot of effort to truly become fluent enough to land the changes we need. But we know what OpenGL backend of gfx-rs needs. What if we could reduce the scope of work here?
On Windows, we have Vulkan, D3D12 and D3D11. There is no need for OpenGL there. On macOS, OpenGL has been deprecated for a while already, and Metal is widely supported. This leaves us with only non-Apple unix systems, including Android. All of them, if I understand correctly, are designed to support EGL as the main context/window manager for GL.
Proposal
Therefore, what if we can just directly depend on EGL unconditionally (on non-wasm targets)? No need for optional glutin, surfman, etc, features. Just make it so our GL backend uses EGL for context creation.
Instance=egl::Display, created byeglGetDisplay. We could choose the default one - I think this is the most tricky part in the proposal so far.Surface=egl::Surface, created byeglCreateWindowSurfaceAdapter=egl::Config. Whenenumerate_adaptersis called, we could get all the contexts supported by the display, and then query their attributes to find out which are software renderers, which support presentation, etcDevice=egl::Context, created byeglCreateContext.
Note: this elaboration doesn't include WebGL target. I don't know how to properly fit it in here, just yet.