From 06c6371e69564231b9af59b8a3e743685c66f972 Mon Sep 17 00:00:00 2001 From: mittorn Date: Fri, 27 Oct 2023 00:25:12 +0300 Subject: [PATCH] platform/eglutil: prevent rendering while no surface --- engine/platform/android/eglutil.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/platform/android/eglutil.c b/engine/platform/android/eglutil.c index c14886ab..1f276af7 100644 --- a/engine/platform/android/eglutil.c +++ b/engine/platform/android/eglutil.c @@ -239,6 +239,7 @@ must be called with valid context qboolean EGL_UpdateSurface( void *window ) { egl.MakeCurrent( eglstate.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); + host.status = HOST_SLEEP; if( eglstate.surface ) egl.DestroySurface( eglstate.dpy, eglstate.surface ); @@ -246,6 +247,7 @@ qboolean EGL_UpdateSurface( void *window ) if( !window ) { Con_Reportf( S_NOTE "EGL_UpdateSurface: missing native window, detaching context\n" ); + return false; } if(( eglstate.surface = egl.CreateWindowSurface( eglstate.dpy, eglstate.cfg, window, NULL )) == EGL_NO_SURFACE ) @@ -259,6 +261,8 @@ qboolean EGL_UpdateSurface( void *window ) Con_Reportf( S_ERROR "eglMakeCurrent returned error: 0x%x\n", egl.GetError() ); return false; } + Con_DPrintf( S_NOTE "restored current context\n" ); + host.status = HOST_FRAME; return true;