You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reported in version: HG 2.1 Reported for operating system, platform: All, All
Comments on the original bug report:
On 2015-04-09 12:06:45 +0000, wrote:
As per the EGL spec eglBindApi needs to be called for each thread.
Currently eglBindApi is only called at window/context creation. This means if SDL_GL_CreateContext is called on a different thread to SDL_GL_MakeCurrent it is possible that there would be no bound egl api.
I was trying to track down an error where my OpenGL application will produce an EGL_BAD_SURFACE in SDL_GL_SwapWindow even though the context is current and this lead me to this error.
To fix this I would suggest calls to SDL_GL_MakeCurrent check if eglBindApi has been called on that thread and is also set to the same api of that context. If not it will call eglBindApi. This would require storing an egl_api value with the SDL_GLContext. I will create a patch if I get time.
A quote from the EGL spec:
"eglBindAPI defines the current rendering API for EGL in the thread it is called from."
On 2015-04-10 12:37:07 +0000, wrote:
Created attachment 2116
EGL Threaded API Patch
I have created a quick patch to bind the API per thread.
It compiles but I have not tested it fully yet.
Currently it uses eglQueryAPI but if you would like it not to call down to egl even though this is probably not an expensive call then it would need to use TLS.
On 2015-04-11 02:34:50 +0000, wrote:
Created attachment 2117
EGL Threaded API Patch
Updated to bind the correct api for OpenGL.
On 2017-08-13 00:46:35 +0000, Sam Lantinga wrote:
Ryan, this seems reasonable offhand. Is this something we want to add?
The text was updated successfully, but these errors were encountered:
I think we're going to try this without tracking the currently-bound API. If you call MakeCurrent, and SDL decides the context needs to be set for the thread, it'll bind the API too. This is likely not an expensive call, and calling MakeCurrent is a rare event anyhow.
This bug report was migrated from our old Bugzilla tracker.
These attachments are available in the static archive:
EGL Threaded API Patch (egl_threaded_api.patch, text/plain, 2015-04-10 12:37:07 +0000, 7013 bytes)Reported in version: HG 2.1
Reported for operating system, platform: All, All
Comments on the original bug report:
On 2015-04-09 12:06:45 +0000, wrote:
On 2015-04-10 12:37:07 +0000, wrote:
On 2015-04-11 02:34:50 +0000, wrote:
On 2017-08-13 00:46:35 +0000, Sam Lantinga wrote:
The text was updated successfully, but these errors were encountered: