mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-19 09:39:25 -04:00
Use pbuffer for now for testing first
This commit is contained in:
parent
0967dae16c
commit
d6ecad04d4
@ -579,15 +579,15 @@ typedef struct osmesa_context
|
|||||||
};
|
};
|
||||||
// endregion OSMESA internals
|
// endregion OSMESA internals
|
||||||
struct PotatoBridge {
|
struct PotatoBridge {
|
||||||
/*ANativeWindow */ void* androidWindow;
|
/*ANativeWindow */ void* androidWindow;
|
||||||
|
|
||||||
/* EGLContext */ void* eglContextOld;
|
/* EGLContext */ void* eglContextOld;
|
||||||
/* EGLContext */ void* eglContext;
|
/* EGLContext */ void* eglContext;
|
||||||
/* EGLDisplay */ void* eglDisplay;
|
/* EGLDisplay */ void* eglDisplay;
|
||||||
/* EGLSurface */ void* eglSurface;
|
/* EGLSurface */ void* eglSurface;
|
||||||
/*
|
/*
|
||||||
void* eglSurfaceRead;
|
void* eglSurfaceRead;
|
||||||
void* eglSurfaceDraw;
|
void* eglSurfaceDraw;
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
EGLConfig config;
|
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 (*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 (*eglGetConfigAttrib_p) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
|
||||||
EGLBoolean (*eglBindAPI_p) (EGLenum api);
|
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);
|
EGLSurface (*eglCreateWindowSurface_p) (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
|
||||||
EGLBoolean (*eglSwapBuffers_p) (EGLDisplay dpy, EGLSurface draw);
|
EGLBoolean (*eglSwapBuffers_p) (EGLDisplay dpy, EGLSurface draw);
|
||||||
EGLint (*eglGetError_p) (void);
|
EGLint (*eglGetError_p) (void);
|
||||||
@ -686,6 +687,7 @@ void dlsym_EGL(void* dl_handle) {
|
|||||||
eglBindAPI_p = dlsym(dl_handle,"eglBindAPI");
|
eglBindAPI_p = dlsym(dl_handle,"eglBindAPI");
|
||||||
eglChooseConfig_p = dlsym(dl_handle, "eglChooseConfig");
|
eglChooseConfig_p = dlsym(dl_handle, "eglChooseConfig");
|
||||||
eglCreateContext_p = dlsym(dl_handle, "eglCreateContext");
|
eglCreateContext_p = dlsym(dl_handle, "eglCreateContext");
|
||||||
|
eglCreatePbufferSurface_p = dlsym(dl_handle, "eglCreatePbufferSurface");
|
||||||
eglCreateWindowSurface_p = dlsym(dl_handle, "eglCreateWindowSurface");
|
eglCreateWindowSurface_p = dlsym(dl_handle, "eglCreateWindowSurface");
|
||||||
eglDestroyContext_p = dlsym(dl_handle, "eglDestroyContext");
|
eglDestroyContext_p = dlsym(dl_handle, "eglDestroyContext");
|
||||||
eglDestroySurface_p = dlsym(dl_handle, "eglDestroySurface");
|
eglDestroySurface_p = dlsym(dl_handle, "eglDestroySurface");
|
||||||
@ -834,7 +836,19 @@ int pojavInit() {
|
|||||||
|
|
||||||
eglBindAPI_p(EGL_OPENGL_ES_API);
|
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) {
|
if (!potatoBridge.eglSurface) {
|
||||||
printf("EGLBridge: Error eglCreateWindowSurface failed: %p\n", eglGetError_p());
|
printf("EGLBridge: Error eglCreateWindowSurface failed: %p\n", eglGetError_p());
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -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 nglfwSetCharCallback(long window, long ptr);
|
||||||
private static native long nglfwSetCharModsCallback(long window, long ptr);
|
private static native long nglfwSetCharModsCallback(long window, long ptr);
|
||||||
private static native long nglfwSetCursorEnterCallback(long window, long ptr);
|
private static native long nglfwSetCursorEnterCallback(long window, long ptr);
|
||||||
@ -609,6 +607,7 @@ public class GLFW
|
|||||||
/** Function address. */
|
/** Function address. */
|
||||||
public static final long
|
public static final long
|
||||||
Init = apiGetFunctionAddress(GLFW, "pojavInit"),
|
Init = apiGetFunctionAddress(GLFW, "pojavInit"),
|
||||||
|
CreateContext = apiGetFunctionAddress(GLFW, "pojavCreateContext"),
|
||||||
GetCurrentContext = apiGetFunctionAddress(GLFW, "pojavGetCurrentContext"),
|
GetCurrentContext = apiGetFunctionAddress(GLFW, "pojavGetCurrentContext"),
|
||||||
//DetachOnCurrentThread = apiGetFunctionAddress(GLFW, "pojavDetachOnCurrentThread"),
|
//DetachOnCurrentThread = apiGetFunctionAddress(GLFW, "pojavDetachOnCurrentThread"),
|
||||||
MakeContextCurrent = apiGetFunctionAddress(GLFW, "pojavMakeCurrent"),
|
MakeContextCurrent = apiGetFunctionAddress(GLFW, "pojavMakeCurrent"),
|
||||||
@ -991,9 +990,6 @@ public class GLFW
|
|||||||
|
|
||||||
public static void glfwSwapBuffers(@NativeType("GLFWwindow *") long window) {
|
public static void glfwSwapBuffers(@NativeType("GLFWwindow *") long window) {
|
||||||
long __functionAddress = Functions.SwapBuffers;
|
long __functionAddress = Functions.SwapBuffers;
|
||||||
if (CHECKS) {
|
|
||||||
check(window);
|
|
||||||
}
|
|
||||||
invokePV(window, __functionAddress);
|
invokePV(window, __functionAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,27 +1017,26 @@ public class GLFW
|
|||||||
// FIXME set correct value!!
|
// FIXME set correct value!!
|
||||||
return 60;
|
return 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW Window functions
|
// GLFW Window functions
|
||||||
public static long glfwCreateWindow(int width, int height, CharSequence title, long monitor, long share) {
|
public static long glfwCreateWindow(int width, int height, CharSequence title, long monitor, long share) {
|
||||||
EventLoop.OffScreen.check();
|
EventLoop.OffScreen.check();
|
||||||
// Create an ACTUAL EGL context
|
// Create an ACTUAL EGL context
|
||||||
long ptr = nativeEglCreateContext(share);
|
long ptr = invokePP(window, Functions.CreateContext);
|
||||||
//nativeEglMakeCurrent(ptr);
|
//nativeEglMakeCurrent(ptr);
|
||||||
GLFWWindowProperties win = new GLFWWindowProperties();
|
GLFWWindowProperties win = new GLFWWindowProperties();
|
||||||
// win.width = width;
|
// win.width = width;
|
||||||
// win.height = height;
|
// win.height = height;
|
||||||
|
|
||||||
win.width = mGLFWWindowWidth;
|
win.width = mGLFWWindowWidth;
|
||||||
win.height = mGLFWWindowHeight;
|
win.height = mGLFWWindowHeight;
|
||||||
|
|
||||||
win.title = title;
|
win.title = title;
|
||||||
|
|
||||||
mGLFWWindowMap.put(ptr, win);
|
mGLFWWindowMap.put(ptr, win);
|
||||||
mainContext = ptr;
|
mainContext = ptr;
|
||||||
return ptr;
|
return ptr;
|
||||||
//Return our context
|
//Return our context
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void glfwDestroyWindow(long window) {
|
public static void glfwDestroyWindow(long window) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user