diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java index 15b03ce34..f7c967c73 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java @@ -222,9 +222,11 @@ public class JREUtils { envMap.put("REGAL_GL_VERSION", "4.5"); if(LOCAL_RENDERER != null) { envMap.put("POJAV_RENDERER", LOCAL_RENDERER); - envMap.put("LIBGL_ES", Character.toString(LOCAL_RENDERER.charAt(8))); + if(LOCAL_RENDERER.equals("opengles3_desktopgl_angle_vulkan")) { + envMap.put("LIBGL_ES", "3"); + envMap.put("POJAVEXEC_EGL","libEGL_angle.so"); // Use ANGLE EGL + } } - if(LOCAL_RENDERER.equals("opengles3_desktopgl_angle_vulkan")) envMap.put("POJAVEXEC_EGL","libEGL_angle.so"); // use ANGLE egl envMap.put("AWTSTUB_WIDTH", Integer.toString(CallbackBridge.windowWidth > 0 ? CallbackBridge.windowWidth : CallbackBridge.physicalWidth)); envMap.put("AWTSTUB_HEIGHT", Integer.toString(CallbackBridge.windowHeight > 0 ? CallbackBridge.windowHeight : CallbackBridge.physicalHeight)); diff --git a/app_pojavlauncher/src/main/jni/ctxbridges/gl_bridge.c b/app_pojavlauncher/src/main/jni/ctxbridges/gl_bridge.c index ea58406f0..b317fec1b 100644 --- a/app_pojavlauncher/src/main/jni/ctxbridges/gl_bridge.c +++ b/app_pojavlauncher/src/main/jni/ctxbridges/gl_bridge.c @@ -40,42 +40,30 @@ bool gl_init() { render_window_t* gl_init_context(render_window_t *share) { render_window_t* bundle = malloc(sizeof(render_window_t)); memset(bundle, 0, sizeof(render_window_t)); - const EGLint egl_attributes[] = { EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_NONE }; - const EGLint egl_attributes2[] = { EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; + EGLint egl_attributes[] = { EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 24, EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_NONE }; EGLint num_configs = 0; + if(strncmp(getenv("POJAV_RENDERER"), "opengles3_desktopgl", 19) == 0) { - if (eglChooseConfig_p(g_EglDisplay, egl_attributes2, NULL, 0, &num_configs) != EGL_TRUE) { - __android_log_print(ANDROID_LOG_ERROR, g_LogTag, "eglChooseConfig_p() failed: %04x", - eglGetError_p()); - free(bundle); - return NULL; - } - if (num_configs == 0) { - __android_log_print(ANDROID_LOG_ERROR, g_LogTag, "%s", - "eglChooseConfig_p() found no matching config"); - free(bundle); - return NULL; - } - - // Get the first matching config - eglChooseConfig_p(g_EglDisplay, egl_attributes2, &bundle->config, 1, &num_configs); + egl_attributes[13] = EGL_OPENGL_BIT; } else { - if (eglChooseConfig_p(g_EglDisplay, egl_attributes, NULL, 0, &num_configs) != EGL_TRUE) { - __android_log_print(ANDROID_LOG_ERROR, g_LogTag, "eglChooseConfig_p() failed: %04x", - eglGetError_p()); - free(bundle); - return NULL; - } - if (num_configs == 0) { - __android_log_print(ANDROID_LOG_ERROR, g_LogTag, "%s", - "eglChooseConfig_p() found no matching config"); - free(bundle); - return NULL; - } - - // Get the first matching config - eglChooseConfig_p(g_EglDisplay, egl_attributes, &bundle->config, 1, &num_configs); + egl_attributes[13] = EGL_OPENGL_ES2_BIT; } + + if (eglChooseConfig_p(g_EglDisplay, egl_attributes, NULL, 0, &num_configs) != EGL_TRUE) { + __android_log_print(ANDROID_LOG_ERROR, g_LogTag, "eglChooseConfig_p() failed: %04x", + eglGetError_p()); + free(bundle); + return NULL; + } + if (num_configs == 0) { + __android_log_print(ANDROID_LOG_ERROR, g_LogTag, "%s", + "eglChooseConfig_p() found no matching config"); + free(bundle); + return NULL; + } + + // Get the first matching config + eglChooseConfig_p(g_EglDisplay, egl_attributes, &bundle->config, 1, &num_configs); eglGetConfigAttrib_p(g_EglDisplay, bundle->config, EGL_NATIVE_VISUAL_ID, &bundle->format); {