From b5c4e249998b1d3c865a062533f68dd249cd2bcc Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh <40482367+khanhduytran0@users.noreply.github.com> Date: Sun, 21 Feb 2021 11:54:10 +0700 Subject: [PATCH] EGLBridge context changes - Detach current surface when context on makeCurrent is EGL_NO_CONTEXT - Temporary disbable create pbuffer --- app_pojavlauncher/src/main/jni/egl_bridge.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app_pojavlauncher/src/main/jni/egl_bridge.c b/app_pojavlauncher/src/main/jni/egl_bridge.c index 6b91fd225..b58f22809 100644 --- a/app_pojavlauncher/src/main/jni/egl_bridge.c +++ b/app_pojavlauncher/src/main/jni/egl_bridge.c @@ -151,6 +151,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv* EGLContext *currCtx = eglGetCurrentContext(); printf("EGLBridge: Comparing: thr=%d, this=%p, curr=%p\n", gettid(), window, currCtx); if (window != 0x1 && (window == 0x0 || currCtx == EGL_NO_CONTEXT || currCtx == (EGLContext *) window)) { +/* if (window != 0x0 && potatoBridge.eglContextOld != NULL && potatoBridge.eglContextOld != (void *) window) { // Create new pbuffer per thread // TODO get window size for 2nd+ window! @@ -165,13 +166,14 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv* potatoBridge.eglSurface = eglCreatePbufferSurface(potatoBridge.eglDisplay, config, surfaceAttr); printf("EGLBridge: created pbuffer surface %p for context %p\n", potatoBridge.eglSurface, window); } +*/ potatoBridge.eglContextOld = (void *) window; // eglMakeCurrent(potatoBridge.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); printf("EGLBridge: Making current on window %p on thread %d\n", window, gettid()); EGLBoolean success = eglMakeCurrent( potatoBridge.eglDisplay, - potatoBridge.eglSurface, - potatoBridge.eglSurface, + window==0 ? (EGLSurface *) 0 : potatoBridge.eglSurface, + window==0 ? (EGLSurface *) 0 : potatoBridge.eglSurface, /* window==0 ? EGL_NO_CONTEXT : */ (EGLContext *) window ); if (success == EGL_FALSE) {