Android SwapInterval functions

Hi all,
SDL_GL_GetSwapInterval and SDL_GL_SetSwapInterval aren’t working for me currently on Android. It looks like the initial checks in SDL_EGL_SetSwapInterval and SDL_EGL_GetSwapInterval have had their logic reversed since commit, 93187f7f7d5d, and now only bail when they would have succeeded (and presumably crash at times when the rendering context is not set up). Anyone else seeing this?
Cheers,
John

2013/8/24 jmcfarlane

**
Hi all,
SDL_GL_GetSwapInterval and SDL_GL_SetSwapInterval aren’t working for me
currently on Android. It looks like the initial checks in
SDL_EGL_SetSwapInterval and SDL_EGL_GetSwapInterval have had their logic
reversed since commit, 93187f7f7d5d, and now only bail when they would have
succeeded (and presumably crash at times when the rendering context is not
set up). Anyone else seeing this?
Cheers,
John

I’m afraid I don’t quite understand what you mean. This rev you mention,
http://hg.libsdl.org/SDL/rev/93187f7f7d5d , is from more than a year ago.
Further, the Android SetSwapInterval and GetSwapInterval were stubs until
recently, and now they have actual functionality. Also, calling
http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/eglSwapInterval.html
without
a context or surface set results in an error, but not in a crash (at least
on a sensible EGL implementation, which is more than you can expect on the
Android emulator, which likes to crash on eglMakeCurrent for no apparent
reason).–
Gabriel.

Apologies if my information is inaccurate; my knowledge of Mercurial and the innards of SDL are both very limited so I can only speculate and report my own experiences.

It looks like the GLES code for X11 and Android was recently consolidated, introducing a long-standing bug in X11_GLES_SetSwapInterval and X11_GLES_GetSwapInterval [see this diff (http://hg.libsdl.org/SDL/diff/93187f7f7d5d/src/video/x11/SDL_x11opengles.c)] to Android for the first time. Currently, those functions are called SDL_EGL_SetSwapInterval and SDL_EGL_GetSwapInterval.

If you examine these functions, you will see that they start with a null check. If the pointer is not NULL then the function returns early. I suspect that this is the opposite of the desired behavior. Only if the data member is NULL will the function continue. In this case, I fear it will likely crash in SDL code before it able to call any GL code.

Apologies if my information is inaccurate; my knowledge of Mercurial and the innards of SDL are both very limited so I can only speculate and report my own experiences.

It looks like the GLES code for X11 and Android was recently consolidated, introducing a long-standing bug in X11_GLES_SetSwapInterval and X11_GLES_GetSwapInterval [see this diff (http://hg.libsdl.org/SDL/diff/93187f7f7d5d/src/video/x11/SDL_x11opengles.c)] to Android for the first time. Currently, those functions are called SDL_EGL_SetSwapInterval and SDL_EGL_GetSwapInterval.

If you examine these functions, you will see that they start with a null check. If the pointer is not NULL then the function returns early. I suspect that this is the opposite of the desired behavior. Only if the data member is NULL will the function continue. In this case, I fear it will likely crash in SDL code before any call to GL code is made.

Fixed, thanks! http://hg.libsdl.org/SDL/rev/83878644c8e6

2013/8/26 jmcfarlane > **

Apologies if my information is inaccurate; my knowledge of Mercurial and
the innards of SDL are both very limited so I can only speculate and report
my own experiences.

It looks like the GLES code for X11 and Android was recently consolidated,
introducing a long-standing bug in X11_GLES_SetSwapInterval and
X11_GLES_GetSwapInterval [see this diffhttp://hg.libsdl.org/SDL/diff/93187f7f7d5d/src/video/x11/SDL_x11opengles.c]
to Android for the first time. Currently, those functions are called
SDL_EGL_SetSwapInterval and SDL_EGL_GetSwapInterval.

If you examine these functions, you will see that they start with a null
check. If the pointer is not NULL then the function returns early. I
suspect that this is the opposite of the desired behavior. Only if the data
member is NULL will the function continue. In this case, I fear it will
likely crash in SDL code before any call to GL code is made.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.