platform/eglutil: prevent rendering while no surface

This commit is contained in:
mittorn 2023-10-27 00:25:12 +03:00 committed by Alibek Omarov
parent 7b4fd3bcad
commit 06c6371e69
1 changed files with 4 additions and 0 deletions

View File

@ -239,6 +239,7 @@ must be called with valid context
qboolean EGL_UpdateSurface( void *window ) qboolean EGL_UpdateSurface( void *window )
{ {
egl.MakeCurrent( eglstate.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); egl.MakeCurrent( eglstate.dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
host.status = HOST_SLEEP;
if( eglstate.surface ) if( eglstate.surface )
egl.DestroySurface( eglstate.dpy, eglstate.surface ); egl.DestroySurface( eglstate.dpy, eglstate.surface );
@ -246,6 +247,7 @@ qboolean EGL_UpdateSurface( void *window )
if( !window ) if( !window )
{ {
Con_Reportf( S_NOTE "EGL_UpdateSurface: missing native window, detaching context\n" ); 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 ) 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() ); Con_Reportf( S_ERROR "eglMakeCurrent returned error: 0x%x\n", egl.GetError() );
return false; return false;
} }
Con_DPrintf( S_NOTE "restored current context\n" );
host.status = HOST_FRAME;
return true; return true;