Skip to content

Commit

Permalink
Emit SDL_RENDER_DEVICE_RESET on Android when the GLES context is recr…
Browse files Browse the repository at this point in the history
…eated
  • Loading branch information
gabomdq committed Mar 24, 2014
1 parent dd81dad commit 1f92c9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions WhatsNew.txt
@@ -1,6 +1,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:
---------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/video/android/SDL_androidevents.c
Expand Up @@ -35,12 +35,14 @@ void android_egl_context_restore();
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);
}
}

Expand Down

0 comments on commit 1f92c9d

Please sign in to comment.