mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-10-29 12:15:30 +00:00
Android: restore main-window EGL surface recreation (#4055)
Use the main swap-chain native window on Android EGL reset so a replacement ANativeWindow can receive a new EGLSurface without destroying the existing EGLContext and GPU resources.
Forward native-window lifecycle events through the Android example event queue and include the current window in its reset descriptor. Document Android main-window rebinding support.
Restores the intent of #796 after the example harness platform-data removal (72cbe8327) and swap-chain API refactor (#3959).
This commit is contained in:
@@ -226,6 +226,7 @@ namespace entry
|
||||
|
||||
DBG("ANativeWindow width %d, height %d", width, height);
|
||||
WindowHandle defaultWindow = { 0 };
|
||||
m_eventQueue.postWindowEvent(defaultWindow, m_window);
|
||||
m_eventQueue.postSizeEvent(defaultWindow, width, height);
|
||||
|
||||
if (!m_thread.isRunning() )
|
||||
@@ -240,6 +241,8 @@ namespace entry
|
||||
// terminated. Upon receiving this command, android_app->window still
|
||||
// contains the existing window; after calling android_app_exec_cmd
|
||||
// it will be set to NULL.
|
||||
m_window = NULL;
|
||||
m_eventQueue.postWindowEvent({ 0 });
|
||||
break;
|
||||
|
||||
case APP_CMD_WINDOW_RESIZED:
|
||||
|
||||
Reference in New Issue
Block a user