EGL Threading Issues

I just wanted to notify anyone currently having issues with the EGL OpenGL
api that I found a bug

If the context is created on one thread and then made current on another
SDL will not call eglBindApi for that thread and the egl api on that thread
will be whatever the default is. It could be undefined or could be GLES for

You can still render to the context using gl functions but it will causes
an issue later in operations such as eglSwapBuffers which on mesa will
check to see if the context is current based on the currently bound api and
so will report an EGL_BAD_SURFACE.

In summary eglBindApi needs to be called per thread. It should also be
called if the context is created with a different api type such as mixing
GLES and OpenGL contexts.

Also there will be no errors and the window will just remain
empty/transparent as SDL does not provide any error checking for
Another issue I reported

If I get time I will try to make patches for these but if someone else may
get round to it first.