diff --git a/app_pojavlauncher/src/main/jni/egl_bridge.c b/app_pojavlauncher/src/main/jni/egl_bridge.c index 27d284eb1..d6765cb7b 100644 --- a/app_pojavlauncher/src/main/jni/egl_bridge.c +++ b/app_pojavlauncher/src/main/jni/egl_bridge.c @@ -579,15 +579,15 @@ typedef struct osmesa_context }; // endregion OSMESA internals struct PotatoBridge { - /*ANativeWindow */ void* androidWindow; - - /* EGLContext */ void* eglContextOld; - /* EGLContext */ void* eglContext; - /* EGLDisplay */ void* eglDisplay; - /* EGLSurface */ void* eglSurface; + /*ANativeWindow */ void* androidWindow; + + /* EGLContext */ void* eglContextOld; + /* EGLContext */ void* eglContext; + /* EGLDisplay */ void* eglDisplay; + /* EGLSurface */ void* eglSurface; /* - void* eglSurfaceRead; - void* eglSurfaceDraw; + void* eglSurfaceRead; + void* eglSurfaceDraw; */ }; EGLConfig config; @@ -617,6 +617,7 @@ EGLBoolean (*eglInitialize_p) (EGLDisplay dpy, EGLint *major, EGLint *minor); EGLBoolean (*eglChooseConfig_p) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); EGLBoolean (*eglGetConfigAttrib_p) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); EGLBoolean (*eglBindAPI_p) (EGLenum api); +EGLSurface (*eglCreatePbufferSurface_p) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); EGLSurface (*eglCreateWindowSurface_p) (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list); EGLBoolean (*eglSwapBuffers_p) (EGLDisplay dpy, EGLSurface draw); EGLint (*eglGetError_p) (void); @@ -686,6 +687,7 @@ void dlsym_EGL(void* dl_handle) { eglBindAPI_p = dlsym(dl_handle,"eglBindAPI"); eglChooseConfig_p = dlsym(dl_handle, "eglChooseConfig"); eglCreateContext_p = dlsym(dl_handle, "eglCreateContext"); + eglCreatePbufferSurface_p = dlsym(dl_handle, "eglCreatePbufferSurface"); eglCreateWindowSurface_p = dlsym(dl_handle, "eglCreateWindowSurface"); eglDestroyContext_p = dlsym(dl_handle, "eglDestroyContext"); eglDestroySurface_p = dlsym(dl_handle, "eglDestroySurface"); @@ -834,7 +836,19 @@ int pojavInit() { eglBindAPI_p(EGL_OPENGL_ES_API); - potatoBridge.eglSurface = eglCreateWindowSurface_p(potatoBridge.eglDisplay, config, potatoBridge.androidWindow, NULL); + // VirGL TODO: switch to WindowSurface once fingure out how to call eglSwapBuffers from the loop + if (config_renderer == RENDERER_VIRGL) { + const EGLint pbufferAttribs[] = { + EGL_WIDTH, + savedWidth, + EGL_HEIGHT, + savedHeight, + EGL_NONE, + }; + potatoBridge.eglSurface = eglCreatePbufferSurface_p(potatoBridge.eglDisplay, pbufferConfig); + } else { + potatoBridge.eglSurface = eglCreateWindowSurface_p(potatoBridge.eglDisplay, config, potatoBridge.androidWindow, NULL); + } if (!potatoBridge.eglSurface) { printf("EGLBridge: Error eglCreateWindowSurface failed: %p\n", eglGetError_p()); diff --git a/app_pojavlauncher/src/main/jniLibs/x86_64/libvirgl_test_server.so b/app_pojavlauncher/src/main/jniLibs/x86_64/libvirgl_test_server.so index 9ef99ecab..731977689 100644 Binary files a/app_pojavlauncher/src/main/jniLibs/x86_64/libvirgl_test_server.so and b/app_pojavlauncher/src/main/jniLibs/x86_64/libvirgl_test_server.so differ diff --git a/app_pojavlauncher/src/main/jniLibs/x86_64/libvirglrenderer_1.so b/app_pojavlauncher/src/main/jniLibs/x86_64/libvirglrenderer_1.so index f3d31b7ce..19e66c7cb 100644 Binary files a/app_pojavlauncher/src/main/jniLibs/x86_64/libvirglrenderer_1.so and b/app_pojavlauncher/src/main/jniLibs/x86_64/libvirglrenderer_1.so differ diff --git a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java index da45dfbd9..bc7ba98fd 100644 --- a/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java +++ b/jre_lwjgl3glfw/src/main/java/org/lwjgl/glfw/GLFW.java @@ -569,8 +569,6 @@ public class GLFW */ } - public static native long nativeEglCreateContext(long contextSrc); - private static native long nglfwSetCharCallback(long window, long ptr); private static native long nglfwSetCharModsCallback(long window, long ptr); private static native long nglfwSetCursorEnterCallback(long window, long ptr); @@ -609,6 +607,7 @@ public class GLFW /** Function address. */ public static final long Init = apiGetFunctionAddress(GLFW, "pojavInit"), + CreateContext = apiGetFunctionAddress(GLFW, "pojavCreateContext"), GetCurrentContext = apiGetFunctionAddress(GLFW, "pojavGetCurrentContext"), //DetachOnCurrentThread = apiGetFunctionAddress(GLFW, "pojavDetachOnCurrentThread"), MakeContextCurrent = apiGetFunctionAddress(GLFW, "pojavMakeCurrent"), @@ -991,9 +990,6 @@ public class GLFW public static void glfwSwapBuffers(@NativeType("GLFWwindow *") long window) { long __functionAddress = Functions.SwapBuffers; - if (CHECKS) { - check(window); - } invokePV(window, __functionAddress); } @@ -1021,27 +1017,26 @@ public class GLFW // FIXME set correct value!! return 60; } - - // GLFW Window functions + + // GLFW Window functions public static long glfwCreateWindow(int width, int height, CharSequence title, long monitor, long share) { EventLoop.OffScreen.check(); - // Create an ACTUAL EGL context - long ptr = nativeEglCreateContext(share); - //nativeEglMakeCurrent(ptr); - GLFWWindowProperties win = new GLFWWindowProperties(); - // win.width = width; - // win.height = height; + // Create an ACTUAL EGL context + long ptr = invokePP(window, Functions.CreateContext); + //nativeEglMakeCurrent(ptr); + GLFWWindowProperties win = new GLFWWindowProperties(); + // win.width = width; + // win.height = height; - win.width = mGLFWWindowWidth; - win.height = mGLFWWindowHeight; + win.width = mGLFWWindowWidth; + win.height = mGLFWWindowHeight; - win.title = title; + win.title = title; - mGLFWWindowMap.put(ptr, win); - mainContext = ptr; - return ptr; + mGLFWWindowMap.put(ptr, win); + mainContext = ptr; + return ptr; //Return our context - } public static void glfwDestroyWindow(long window) {