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 8676 e217c66375e5
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
--- a/WhatsNew.txt	Mon Mar 24 07:12:26 2014 -0400
+++ b/WhatsNew.txt	Mon Mar 24 11:04:42 2014 -0300
@@ -2,6 +2,15 @@
 This is a list of major changes in SDL's version history.
 
 ---------------------------------------------------------------------------
+2.0.4:
+---------------------------------------------------------------------------
+
+General:
+* Added an event SDL_RENDER_DEVICE_RESET that is sent from the D3D renderers 
+  when the D3D device is lost, and from Android's event loop when the GLES
+  context had to be re created.
+
+---------------------------------------------------------------------------
 2.0.3:
 ---------------------------------------------------------------------------
 
--- a/src/video/android/SDL_androidevents.c	Mon Mar 24 07:12:26 2014 -0400
+++ b/src/video/android/SDL_androidevents.c	Mon Mar 24 11:04:42 2014 -0300
@@ -35,12 +35,14 @@
 void 
 android_egl_context_restore() 
 {
+    SDL_Event event;
     SDL_WindowData *data = (SDL_WindowData *) Android_Window->driverdata;
     if (SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context) < 0) {
         /* The context is no longer valid, create a new one */
-        /* FIXME: Notify the user that the context changed and textures need to be re created */
         data->egl_context = (EGLContext) SDL_GL_CreateContext(Android_Window);
         SDL_GL_MakeCurrent(Android_Window, (SDL_GLContext) data->egl_context);
+        event.type = SDL_RENDER_DEVICE_RESET;
+        SDL_PushEvent(&event);
     }
 }