mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -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
|
||||
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());
|
||||
|
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 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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user