mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
[aarch64] try to fix framebuffer bug
This commit is contained in:
parent
14f70b19df
commit
98877fd0b9
@ -74,5 +74,9 @@ public class CallbackBridge {
|
|||||||
|
|
||||||
private static native void nativeSendData(boolean isAndroid, int type, String data);
|
private static native void nativeSendData(boolean isAndroid, int type, String data);
|
||||||
public static native boolean nativeIsGrabbing();
|
public static native boolean nativeIsGrabbing();
|
||||||
|
|
||||||
|
static {
|
||||||
|
System.loadLibrary("pojavexec");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,27 +44,41 @@ void pojav_openGLOnUnload() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void terminateEgl() {
|
||||||
|
printf("EGLBridge: Terminating\n");
|
||||||
|
eglMakeCurrent(potatoBridge.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
eglDestroySurface(potatoBridge.eglDisplay, potatoBridge.eglSurface);
|
||||||
|
eglDestroyContext(potatoBridge.eglDisplay, potatoBridge.eglContext);
|
||||||
|
eglTerminate(potatoBridge.eglDisplay);
|
||||||
|
eglReleaseThread();
|
||||||
|
|
||||||
|
potatoBridge.eglContext = EGL_NO_CONTEXT;
|
||||||
|
potatoBridge.eglDisplay = EGL_NO_DISPLAY;
|
||||||
|
potatoBridge.eglSurface = EGL_NO_SURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglInit(JNIEnv* env, jclass clazz) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglInit(JNIEnv* env, jclass clazz) {
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv* env, jclass clazz) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv* env, jclass clazz) {
|
||||||
|
if (potatoBridge.eglContext != EGL_NO_CONTEXT) {
|
||||||
|
terminateEgl();
|
||||||
|
}
|
||||||
|
|
||||||
if (potatoBridge.eglDisplay == NULL || potatoBridge.eglDisplay == EGL_NO_DISPLAY) {
|
if (potatoBridge.eglDisplay == NULL || potatoBridge.eglDisplay == EGL_NO_DISPLAY) {
|
||||||
potatoBridge.eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
potatoBridge.eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
if (potatoBridge.eglDisplay == EGL_NO_DISPLAY) {
|
if (potatoBridge.eglDisplay == EGL_NO_DISPLAY) {
|
||||||
printf("Error: eglGetDefaultDisplay() failed: %p\n", eglGetError());
|
printf("EGLBridge: Error eglGetDefaultDisplay() failed: %p\n", eglGetError());
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eglMakeCurrent(potatoBridge.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
||||||
|
|
||||||
if (potatoBridge.eglContext == NULL || potatoBridge.eglContext == EGL_NO_CONTEXT) {
|
|
||||||
printf("EGLBridge: Initializing\n");
|
printf("EGLBridge: Initializing\n");
|
||||||
printf("ANativeWindow pointer = %p\n", potatoBridge.androidWindow);
|
printf("EGLBridge: ANativeWindow pointer = %p\n", potatoBridge.androidWindow);
|
||||||
|
|
||||||
if (!eglInitialize(potatoBridge.eglDisplay, NULL, NULL)) {
|
if (!eglInitialize(potatoBridge.eglDisplay, NULL, NULL)) {
|
||||||
printf("Error: eglInitialize() failed\n");
|
printf("EGLBridge: Error eglInitialize() failed\n");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +101,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||||||
EGLint vid;
|
EGLint vid;
|
||||||
|
|
||||||
if (!eglChooseConfig(potatoBridge.eglDisplay, attribs, &config, 1, &num_configs)) {
|
if (!eglChooseConfig(potatoBridge.eglDisplay, attribs, &config, 1, &num_configs)) {
|
||||||
printf("Error: couldn't get an EGL visual config\n");
|
printf("EGLBridge: Error couldn't get an EGL visual config\n");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +109,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||||||
assert(num_configs > 0);
|
assert(num_configs > 0);
|
||||||
|
|
||||||
if (!eglGetConfigAttrib(potatoBridge.eglDisplay, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
if (!eglGetConfigAttrib(potatoBridge.eglDisplay, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||||
printf("Error: eglGetConfigAttrib() failed\n");
|
printf("EGLBridge: Error eglGetConfigAttrib() failed\n");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +119,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||||||
|
|
||||||
potatoBridge.eglContext = eglCreateContext(potatoBridge.eglDisplay, config, EGL_NO_CONTEXT, ctx_attribs);
|
potatoBridge.eglContext = eglCreateContext(potatoBridge.eglDisplay, config, EGL_NO_CONTEXT, ctx_attribs);
|
||||||
if (!potatoBridge.eglContext) {
|
if (!potatoBridge.eglContext) {
|
||||||
printf("Error: eglCreateContext failed\n");
|
printf("EGLBridge: Error eglCreateContext failed\n");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,14 +127,14 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||||||
{
|
{
|
||||||
EGLint val;
|
EGLint val;
|
||||||
eglQueryContext(potatoBridge.eglDisplay, potatoBridge.eglContext, EGL_CONTEXT_CLIENT_VERSION, &val);
|
eglQueryContext(potatoBridge.eglDisplay, potatoBridge.eglContext, EGL_CONTEXT_CLIENT_VERSION, &val);
|
||||||
printf("OpenGL ES from eglQueryContext: %i\n", val);
|
printf("EGLBridge: OpenGL ES from eglQueryContext: %i\n", val);
|
||||||
// assert(val >= 2);
|
// assert(val >= 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
potatoBridge.eglSurface = eglCreateWindowSurface(potatoBridge.eglDisplay, config, potatoBridge.androidWindow, NULL);
|
potatoBridge.eglSurface = eglCreateWindowSurface(potatoBridge.eglDisplay, config, potatoBridge.androidWindow, NULL);
|
||||||
|
|
||||||
if (!potatoBridge.eglSurface) {
|
if (!potatoBridge.eglSurface) {
|
||||||
printf("Error: eglCreateWindowSurface failed: %p\n", eglGetError());
|
printf("EGLBridge: Error eglCreateWindowSurface failed: %p\n", eglGetError());
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,10 +145,9 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||||||
assert(val & EGL_WINDOW_BIT);
|
assert(val & EGL_WINDOW_BIT);
|
||||||
}
|
}
|
||||||
// return JNI_TRUE;
|
// return JNI_TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
printf("EGLBridge: Making current\n");
|
printf("EGLBridge: Making current\n");
|
||||||
printf("EGLContext=%p, EGLDisplay=%p, EGLSurface=%p\n",
|
printf("EGLBridge: EGLContext=%p, EGLDisplay=%p, EGLSurface=%p\n",
|
||||||
potatoBridge.eglContext,
|
potatoBridge.eglContext,
|
||||||
potatoBridge.eglDisplay,
|
potatoBridge.eglDisplay,
|
||||||
potatoBridge.eglSurface
|
potatoBridge.eglSurface
|
||||||
@ -157,17 +170,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglTerminate(JNIEnv* env, jclass clazz) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglTerminate(JNIEnv* env, jclass clazz) {
|
||||||
printf("EGLBridge: Terminating\n");
|
terminateEgl();
|
||||||
eglMakeCurrent(potatoBridge.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
||||||
eglDestroySurface(potatoBridge.eglDisplay, potatoBridge.eglSurface);
|
|
||||||
eglDestroyContext(potatoBridge.eglDisplay, potatoBridge.eglContext);
|
|
||||||
eglTerminate(potatoBridge.eglDisplay);
|
|
||||||
eglReleaseThread();
|
|
||||||
|
|
||||||
potatoBridge.eglContext = EGL_NO_CONTEXT;
|
|
||||||
potatoBridge.eglDisplay = EGL_NO_DISPLAY;
|
|
||||||
potatoBridge.eglSurface = EGL_NO_SURFACE;
|
|
||||||
|
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user