Common EGL code

I’ve commited the revised EGL code here [1] . A few comments for those
interested:

  • The X11 and Android backends where reorganized to share common code to
    set up and manage GL ES contexts.

  • The Java side handling of GL contexts on Android is removed entirely and
    is much more streamlined, another tiny step towards getting rid of it all :slight_smile:

  • You should be able to have multiple contexts on Android.

  • This commit starts to separate EGL from OpenGL ES. Internally SDL handled
    both as equivalents, when they are not (for instance, you can create a
    OpenGL ES context using GLX). Eventually SDL_GL_CONTEXT_EGL is going to go
    away, and it’ll be replaced by the more apt, and currently
    existing, SDL_GL_CONTEXT_PROFILE_MASK

  • A side benefit, if you have nVidia binary drivers installed and X11,
    asking for a GL ES context is now not only possible, but the resulting
    context will be hardware accelerated. I used to get 30FPS with
    testrendercopyex on full screen with the Mesa software implementation of
    EGL, now I get upwards of 1100FPS!

  • On a related note, steer away from nVidia’s GL ES 1.x contexts! Most of
    the useful extensions are not there. ES 2.x seems to work great though.

  • A caveat on X11 is that on certain systems (such as those with nVidia
    binaries) you could use GL and GL ES contexts at the same time (as
    everything goes through the GLX code path), but as a general rule you can’t
    use regular GL and GL ES contexts concurrently with the X11 backend. This
    was already the case, and I think it’ll take an API change (adding
    something such as SDL_GL_ResetContext, and prevent SDL_GL_MakeCurrent from
    taking NULL contexts) to implement this. Not sure if anyone has a use for
    such craziness.

  • There can be bugs. I tested this as much as I could, but it’s a good
    chunk of new code so there can be surprises! I’ve got at least one report
    of issues on Android, but then again this seemed to be present already in
    the 2.0.0 release and it’s not 100% clear yet if the problem is in SDL.

  • The upcoming Raspberry Pi, Mir, Wayland backends use EGL, so they’ll
    hopefully benefit from this reorganization.

  1. http://hg.libsdl.org/SDL/rev/ac4ce59c40e7--
    Gabriel.

Hi,

nice that this makes it into the repo already. I’m not sure, about all
the places, but the plain c compilation might be broken, because some
variables are defined after some statements. e.g. in SDL_egl.c

Regards
MartinAm 19.08.2013 21:49, schrieb Gabriel Jacobo:

I’ve commited the revised EGL code here [1] . A few comments for those
interested:

  • The X11 and Android backends where reorganized to share common code
    to set up and manage GL ES contexts.

  • The Java side handling of GL contexts on Android is removed entirely
    and is much more streamlined, another tiny step towards getting rid of
    it all :slight_smile:

  • You should be able to have multiple contexts on Android.

  • This commit starts to separate EGL from OpenGL ES. Internally SDL
    handled both as equivalents, when they are not (for instance, you can
    create a OpenGL ES context using GLX). Eventually SDL_GL_CONTEXT_EGL
    is going to go away, and it’ll be replaced by the more apt, and
    currently existing, SDL_GL_CONTEXT_PROFILE_MASK

  • A side benefit, if you have nVidia binary drivers installed and X11,
    asking for a GL ES context is now not only possible, but the resulting
    context will be hardware accelerated. I used to get 30FPS with
    testrendercopyex on full screen with the Mesa software implementation
    of EGL, now I get upwards of 1100FPS!

  • On a related note, steer away from nVidia’s GL ES 1.x contexts! Most
    of the useful extensions are not there. ES 2.x seems to work great though.

  • A caveat on X11 is that on certain systems (such as those with
    nVidia binaries) you could use GL and GL ES contexts at the same time
    (as everything goes through the GLX code path), but as a general rule
    you can’t use regular GL and GL ES contexts concurrently with the X11
    backend. This was already the case, and I think it’ll take an API
    change (adding something such as SDL_GL_ResetContext, and prevent
    SDL_GL_MakeCurrent from taking NULL contexts) to implement this. Not
    sure if anyone has a use for such craziness.

  • There can be bugs. I tested this as much as I could, but it’s a good
    chunk of new code so there can be surprises! I’ve got at least one
    report of issues on Android, but then again this seemed to be present
    already in the 2.0.0 release and it’s not 100% clear yet if the
    problem is in SDL.

  • The upcoming Raspberry Pi, Mir, Wayland backends use EGL, so they’ll
    hopefully benefit from this reorganization.

  1. http://hg.libsdl.org/SDL/rev/ac4ce59c40e7

nice that this makes it into the repo already. I’m not sure, about all the places, but the plain c compilation might be broken, because some variables are defined after some statements. e.g. in SDL_egl.c

Unless the C compiler is in ultra-strict ISO C 89 mode it will probably
work just as C++ // comments work in just about all C compilers.
Those are two C++ features that have been in C long before
they were standardised in C99 (in fact before they were standardised
in C++).On 20/08/2013, at 4:45 PM, Martin Gerhardy wrote:


john skaller
@john_skaller
http://felix-lang.org

Only one word: visualc ;)Am 20.08.2013 09:38 schrieb “john skaller” :

On 20/08/2013, at 4:45 PM, Martin Gerhardy wrote:

nice that this makes it into the repo already. I’m not sure, about all
the places, but the plain c compilation might be broken, because some
variables are defined after some statements. e.g. in SDL_egl.c

Unless the C compiler is in ultra-strict ISO C 89 mode it will probably
work just as C++ // comments work in just about all C compilers.
Those are two C++ features that have been in C long before
they were standardised in C99 (in fact before they were standardised
in C++).


john skaller
skaller at users.sourceforge.net
http://felix-lang.org


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

2013/8/20 M. Gerhardy <martin.gerhardy at gmail.com>

Only one word: visualc :wink:
Am 20.08.2013 09:38 schrieb “john skaller” <skaller at users.sourceforge.net

:

nice that this makes it into the repo already. I’m not sure, about all
the places, but the plain c compilation might be broken, because some
variables are defined after some statements. e.g. in SDL_egl.c

Unless the C compiler is in ultra-strict ISO C 89 mode it will probably
work just as C++ // comments work in just about all C compilers.
Those are two C++ features that have been in C long before
they were standardised in C99 (in fact before they were standardised
in C++).


john skaller
skaller at users.sourceforge.net
http://felix-lang.org

The changes are restricted to Android and the auto tools world, so we
should be ok in that sense. There’s Buildbot to double check, which is a
great tool! http://buildbot.libsdl.org/waterfall>> On 20/08/2013, at 4:45 PM, Martin Gerhardy wrote:


Gabriel.

Gabriel, can you fix the code so it complies with C89? That’s the SDL
style so people don’t see that and think they can use newer variable
declaration style elsewhere in the code base.

Thanks!On Tue, Aug 20, 2013 at 5:09 AM, Gabriel Jacobo wrote:

2013/8/20 M. Gerhardy <martin.gerhardy at gmail.com>

Only one word: visualc :wink:

Am 20.08.2013 09:38 schrieb “john skaller” <skaller at users.sourceforge.net

:

On 20/08/2013, at 4:45 PM, Martin Gerhardy wrote:

nice that this makes it into the repo already. I’m not sure, about all
the places, but the plain c compilation might be broken, because some
variables are defined after some statements. e.g. in SDL_egl.c

Unless the C compiler is in ultra-strict ISO C 89 mode it will probably
work just as C++ // comments work in just about all C compilers.
Those are two C++ features that have been in C long before
they were standardised in C99 (in fact before they were standardised
in C++).


john skaller
skaller at users.sourceforge.net
http://felix-lang.org

The changes are restricted to Android and the auto tools world, so we
should be ok in that sense. There’s Buildbot to double check, which is a
great tool! http://buildbot.libsdl.org/waterfall


Gabriel.


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