Emit SDL_RENDER_DEVICE_RESET on Android when the GLES context is recreated
authorGabriel Jacobo <gabomdq@gmail.com>
Mon, 24 Mar 2014 11:04:42 -0300
changeset 8676e217c66375e5
parent 8675 7680f784d850
child 8677 ce3c968f7340
Emit SDL_RENDER_DEVICE_RESET on Android when the GLES context is recreated
WhatsNew.txt
src/video/android/SDL_androidevents.c
     1.1 --- a/WhatsNew.txt	Mon Mar 24 07:12:26 2014 -0400
     1.2 +++ b/WhatsNew.txt	Mon Mar 24 11:04:42 2014 -0300
     1.3 @@ -2,6 +2,15 @@
     1.4  This is a list of major changes in SDL's version history.
     1.5  
     1.6  ---------------------------------------------------------------------------
     1.7 +2.0.4:
     1.8 +---------------------------------------------------------------------------
     1.9 +
    1.10 +General:
    1.11 +* Added an event SDL_RENDER_DEVICE_RESET that is sent from the D3D renderers 
    1.12 +  when the D3D device is lost, and from Android's event loop when the GLES
    1.13 +  context had to be re created.
    1.14 +
    1.15 +---------------------------------------------------------------------------
    1.16  2.0.3:
    1.17  ---------------------------------------------------------------------------
    1.18  
     2.1 --- a/src/video/android/SDL_androidevents.c	Mon Mar 24 07:12:26 2014 -0400
     2.2 +++ b/src/video/android/SDL_androidevents.c	Mon Mar 24 11:04:42 2014 -0300
     2.3 @@ -35,12 +35,14 @@
     2.4  void 
     2.5  android_egl_context_restore() 
     2.6  {
     2.7 +    SDL_Event event;
     2.8      SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata;
     2.9      if (SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context) < 0) {
    2.10          /* The context is no longer valid, create a new one */
    2.11 -        /* FIXME: Notify the user that the context changed and textures need to be re created */
    2.12          data->egl_context = (EGLContext) SDL_GL_CreateContext(Android_Window);
    2.13          SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context);
    2.14 +        event.type = SDL_RENDER_DEVICE_RESET;
    2.15 +        SDL_PushEvent(&event);
    2.16      }
    2.17  }
    2.18