mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-26 20:51:57 -04:00
fix(main): destroy temp egl context on init
This commit is contained in:
parent
1aab5931ba
commit
9ae00d7bb2
@ -12,10 +12,12 @@
|
|||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
|
|
||||||
|
|
||||||
|
static EGLDisplay eglDisplay = EGL_NO_DISPLAY;
|
||||||
|
static EGLSurface eglSurface = EGL_NO_SURFACE;
|
||||||
|
static EGLContext eglContext = EGL_NO_CONTEXT;
|
||||||
|
|
||||||
void init_target_egl() {
|
void init_target_egl() {
|
||||||
EGLDisplay eglDisplay = EGL_NO_DISPLAY;
|
|
||||||
EGLSurface eglSurface = EGL_NO_SURFACE;
|
|
||||||
EGLContext eglContext = EGL_NO_CONTEXT;
|
|
||||||
|
|
||||||
LOAD_EGL(eglGetProcAddress);
|
LOAD_EGL(eglGetProcAddress);
|
||||||
LOAD_EGL(eglBindAPI);
|
LOAD_EGL(eglBindAPI);
|
||||||
@ -115,4 +117,17 @@ cleanup:
|
|||||||
egl_eglTerminate(eglDisplay);
|
egl_eglTerminate(eglDisplay);
|
||||||
}
|
}
|
||||||
LOG_E("EGL initialization failed");
|
LOG_E("EGL initialization failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
void destroy_temp_egl_ctx() {
|
||||||
|
LOAD_EGL(eglDestroySurface);
|
||||||
|
LOAD_EGL(eglDestroyContext);
|
||||||
|
LOAD_EGL(eglMakeCurrent);
|
||||||
|
LOAD_EGL(eglTerminate);
|
||||||
|
|
||||||
|
egl_eglMakeCurrent(eglDisplay, 0, 0, EGL_NO_CONTEXT);
|
||||||
|
egl_eglDestroySurface(eglDisplay, eglSurface);
|
||||||
|
egl_eglDestroyContext(eglDisplay, eglContext);
|
||||||
|
|
||||||
|
egl_eglTerminate(eglDisplay);
|
||||||
}
|
}
|
@ -173,6 +173,7 @@ EGLBoolean mglues_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface rea
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void init_target_egl();
|
void init_target_egl();
|
||||||
|
void destroy_temp_egl_ctx();
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -85,5 +85,7 @@ void proc_init() {
|
|||||||
init_perfetto();
|
init_perfetto();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
destroy_temp_egl_ctx();
|
||||||
g_initialized = 1;
|
g_initialized = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user