mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
EGL Bridge does NOT need to be changed
This commit is contained in:
parent
7b801ca0dd
commit
72ec03e403
@ -30,20 +30,20 @@ struct pipe_screen;
|
|||||||
//only get what we need to access/modify
|
//only get what we need to access/modify
|
||||||
struct st_manager
|
struct st_manager
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen;
|
struct pipe_screen *screen;
|
||||||
};
|
};
|
||||||
struct st_context_iface
|
struct st_context_iface
|
||||||
{
|
{
|
||||||
void *st_context_private;
|
void *st_context_private;
|
||||||
};
|
};
|
||||||
struct zink_device_info
|
struct zink_device_info
|
||||||
{
|
{
|
||||||
bool have_EXT_conditional_rendering;
|
bool have_EXT_conditional_rendering;
|
||||||
bool have_EXT_transform_feedback;
|
bool have_EXT_transform_feedback;
|
||||||
};
|
};
|
||||||
struct zink_screen
|
struct zink_screen
|
||||||
{
|
{
|
||||||
struct zink_device_info info;
|
struct zink_device_info info;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum st_attachment_type {
|
enum st_attachment_type {
|
||||||
@ -615,7 +615,7 @@ void pojav_openGLOnUnload() {
|
|||||||
|
|
||||||
void pojavTerminate() {
|
void pojavTerminate() {
|
||||||
printf("EGLBridge: Terminating\n");
|
printf("EGLBridge: Terminating\n");
|
||||||
|
|
||||||
switch (pojav_environ->config_renderer) {
|
switch (pojav_environ->config_renderer) {
|
||||||
case RENDERER_GL4ES: {
|
case RENDERER_GL4ES: {
|
||||||
eglMakeCurrent_p(potatoBridge.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent_p(potatoBridge.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
@ -623,13 +623,13 @@ void pojavTerminate() {
|
|||||||
eglDestroyContext_p(potatoBridge.eglDisplay, potatoBridge.eglContext);
|
eglDestroyContext_p(potatoBridge.eglDisplay, potatoBridge.eglContext);
|
||||||
eglTerminate_p(potatoBridge.eglDisplay);
|
eglTerminate_p(potatoBridge.eglDisplay);
|
||||||
eglReleaseThread_p();
|
eglReleaseThread_p();
|
||||||
|
|
||||||
potatoBridge.eglContext = EGL_NO_CONTEXT;
|
potatoBridge.eglContext = EGL_NO_CONTEXT;
|
||||||
potatoBridge.eglDisplay = EGL_NO_DISPLAY;
|
potatoBridge.eglDisplay = EGL_NO_DISPLAY;
|
||||||
potatoBridge.eglSurface = EGL_NO_SURFACE;
|
potatoBridge.eglSurface = EGL_NO_SURFACE;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
//case RENDERER_VIRGL:
|
//case RENDERER_VIRGL:
|
||||||
case RENDERER_VK_ZINK: {
|
case RENDERER_VK_ZINK: {
|
||||||
// Nothing to do here
|
// Nothing to do here
|
||||||
} break;
|
} break;
|
||||||
@ -806,6 +806,7 @@ int pojavInit() {
|
|||||||
eglBindAPI_p(EGL_OPENGL_ES_API);
|
eglBindAPI_p(EGL_OPENGL_ES_API);
|
||||||
|
|
||||||
potatoBridge.eglSurface = eglCreateWindowSurface_p(potatoBridge.eglDisplay, config, pojav_environ->pojavWindow, NULL);
|
potatoBridge.eglSurface = eglCreateWindowSurface_p(potatoBridge.eglDisplay, config, pojav_environ->pojavWindow, 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());
|
||||||
//(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
|
//(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
|
||||||
@ -834,8 +835,8 @@ int pojavInit() {
|
|||||||
if (pojav_environ->config_renderer == RENDERER_VIRGL) {
|
if (pojav_environ->config_renderer == RENDERER_VIRGL) {
|
||||||
// Init EGL context and vtest server
|
// Init EGL context and vtest server
|
||||||
const EGLint ctx_attribs[] = {
|
const EGLint ctx_attribs[] = {
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 3,
|
EGL_CONTEXT_CLIENT_VERSION, 3,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
EGLContext* ctx = eglCreateContext_p(potatoBridge.eglDisplay, config, NULL, ctx_attribs);
|
EGLContext* ctx = eglCreateContext_p(potatoBridge.eglDisplay, config, NULL, ctx_attribs);
|
||||||
printf("VirGL: created EGL context %p\n", ctx);
|
printf("VirGL: created EGL context %p\n", ctx);
|
||||||
@ -850,9 +851,9 @@ int pojavInit() {
|
|||||||
printf("OSMDroid: %s\n",dlerror());
|
printf("OSMDroid: %s\n",dlerror());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("OSMDroid: width=%i;height=%i, reserving %i bytes for frame buffer\n", savedWidth, savedHeight,
|
printf("OSMDroid: width=%i;height=%i, reserving %i bytes for frame buffer\n", savedWidth, savedHeight,
|
||||||
savedWidth * 4 * savedHeight);
|
savedWidth * 4 * savedHeight);
|
||||||
gbuffer = malloc(savedWidth * 4 * savedHeight+1);
|
gbuffer = malloc(savedWidth * 4 * savedHeight+1);
|
||||||
if (gbuffer) {
|
if (gbuffer) {
|
||||||
printf("OSMDroid: created frame buffer\n");
|
printf("OSMDroid: created frame buffer\n");
|
||||||
@ -862,7 +863,7 @@ int pojavInit() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ANativeWindow_Buffer buf;
|
ANativeWindow_Buffer buf;
|
||||||
@ -876,7 +877,7 @@ void pojavSwapBuffers() {
|
|||||||
case RENDERER_GL4ES: {
|
case RENDERER_GL4ES: {
|
||||||
gl_swap_buffers();
|
gl_swap_buffers();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case RENDERER_VIRGL: {
|
case RENDERER_VIRGL: {
|
||||||
glFinish_p();
|
glFinish_p();
|
||||||
vtest_swap_buffers_p();
|
vtest_swap_buffers_p();
|
||||||
@ -899,10 +900,10 @@ void pojavSwapBuffers() {
|
|||||||
|
|
||||||
void* egl_make_current(void* window) {
|
void* egl_make_current(void* window) {
|
||||||
EGLBoolean success = eglMakeCurrent_p(
|
EGLBoolean success = eglMakeCurrent_p(
|
||||||
potatoBridge.eglDisplay,
|
potatoBridge.eglDisplay,
|
||||||
window==0 ? (EGLSurface *) 0 : potatoBridge.eglSurface,
|
window==0 ? (EGLSurface *) 0 : potatoBridge.eglSurface,
|
||||||
window==0 ? (EGLSurface *) 0 : potatoBridge.eglSurface,
|
window==0 ? (EGLSurface *) 0 : potatoBridge.eglSurface,
|
||||||
/* window==0 ? EGL_NO_CONTEXT : */ (EGLContext *) window
|
/* window==0 ? EGL_NO_CONTEXT : */ (EGLContext *) window
|
||||||
);
|
);
|
||||||
|
|
||||||
if (success == EGL_FALSE) {
|
if (success == EGL_FALSE) {
|
||||||
@ -928,27 +929,27 @@ void pojavMakeCurrent(void* window) {
|
|||||||
gl_make_current((render_window_t*)window);
|
gl_make_current((render_window_t*)window);
|
||||||
}
|
}
|
||||||
if (pojav_environ->config_renderer == RENDERER_VK_ZINK || pojav_environ->config_renderer == RENDERER_VIRGL) {
|
if (pojav_environ->config_renderer == RENDERER_VK_ZINK || pojav_environ->config_renderer == RENDERER_VIRGL) {
|
||||||
printf("OSMDroid: making current\n");
|
printf("OSMDroid: making current\n");
|
||||||
OSMesaMakeCurrent_p((OSMesaContext)window,gbuffer,GL_UNSIGNED_BYTE,savedWidth,savedHeight);
|
OSMesaMakeCurrent_p((OSMesaContext)window,gbuffer,GL_UNSIGNED_BYTE,savedWidth,savedHeight);
|
||||||
if (pojav_environ->config_renderer == RENDERER_VK_ZINK) {
|
if (pojav_environ->config_renderer == RENDERER_VK_ZINK) {
|
||||||
ANativeWindow_lock(pojav_environ->pojavWindow,&buf,NULL);
|
ANativeWindow_lock(pojav_environ->pojavWindow,&buf,NULL);
|
||||||
OSMesaPixelStore_p(OSMESA_ROW_LENGTH,buf.stride);
|
OSMesaPixelStore_p(OSMESA_ROW_LENGTH,buf.stride);
|
||||||
stride = buf.stride;
|
stride = buf.stride;
|
||||||
//ANativeWindow_unlockAndPost(pojav_environ->pojavWindow);
|
//ANativeWindow_unlockAndPost(pojav_environ->pojavWindow);
|
||||||
OSMesaPixelStore_p(OSMESA_Y_UP,0);
|
OSMesaPixelStore_p(OSMESA_Y_UP,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("OSMDroid: vendor: %s\n",glGetString_p(GL_VENDOR));
|
printf("OSMDroid: vendor: %s\n",glGetString_p(GL_VENDOR));
|
||||||
printf("OSMDroid: renderer: %s\n",glGetString_p(GL_RENDERER));
|
printf("OSMDroid: renderer: %s\n",glGetString_p(GL_RENDERER));
|
||||||
glClear_p(GL_COLOR_BUFFER_BIT);
|
glClear_p(GL_COLOR_BUFFER_BIT);
|
||||||
glClearColor_p(0.4f, 0.4f, 0.4f, 1.0f);
|
glClearColor_p(0.4f, 0.4f, 0.4f, 1.0f);
|
||||||
|
|
||||||
// Trigger a texture creation, which then set VIRGL_TEXTURE_ID
|
// Trigger a texture creation, which then set VIRGL_TEXTURE_ID
|
||||||
int pixelsArr[4];
|
int pixelsArr[4];
|
||||||
glReadPixels_p(0, 0, 1, 1, GL_RGB, GL_INT, &pixelsArr);
|
glReadPixels_p(0, 0, 1, 1, GL_RGB, GL_INT, &pixelsArr);
|
||||||
|
|
||||||
pojavSwapBuffers();
|
pojavSwapBuffers();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -972,23 +973,23 @@ Java_org_lwjgl_glfw_GLFW_nativeEglDetachOnCurrentThread(JNIEnv *env, jclass claz
|
|||||||
|
|
||||||
void* pojavCreateContext(void* contextSrc) {
|
void* pojavCreateContext(void* contextSrc) {
|
||||||
if (pojav_environ->config_renderer == RENDERER_GL4ES) {
|
if (pojav_environ->config_renderer == RENDERER_GL4ES) {
|
||||||
/*const EGLint ctx_attribs[] = {
|
/*const EGLint ctx_attribs[] = {
|
||||||
EGL_CONTEXT_CLIENT_VERSION, atoi(getenv("LIBGL_ES")),
|
EGL_CONTEXT_CLIENT_VERSION, atoi(getenv("LIBGL_ES")),
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
EGLContext* ctx = eglCreateContext_p(potatoBridge.eglDisplay, config, (void*)contextSrc, ctx_attribs);
|
EGLContext* ctx = eglCreateContext_p(potatoBridge.eglDisplay, config, (void*)contextSrc, ctx_attribs);
|
||||||
potatoBridge.eglContext = ctx;
|
potatoBridge.eglContext = ctx;
|
||||||
printf("EGLBridge: Created CTX pointer = %p\n",ctx);
|
printf("EGLBridge: Created CTX pointer = %p\n",ctx);
|
||||||
//(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
|
//(*env)->ThrowNew(env,(*env)->FindClass(env,"java/lang/Exception"),"Trace exception");
|
||||||
return (long)ctx;*/
|
return (long)ctx;*/
|
||||||
return gl_init_context(contextSrc);
|
return gl_init_context(contextSrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pojav_environ->config_renderer == RENDERER_VK_ZINK || pojav_environ->config_renderer == RENDERER_VIRGL) {
|
if (pojav_environ->config_renderer == RENDERER_VK_ZINK || pojav_environ->config_renderer == RENDERER_VIRGL) {
|
||||||
printf("OSMDroid: generating context\n");
|
printf("OSMDroid: generating context\n");
|
||||||
void* ctx = OSMesaCreateContext_p(OSMESA_RGBA,contextSrc);
|
void* ctx = OSMesaCreateContext_p(OSMESA_RGBA,contextSrc);
|
||||||
printf("OSMDroid: context=%p\n",ctx);
|
printf("OSMDroid: context=%p\n",ctx);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,7 +998,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL_nativeRegalMakeCurrent(JNIEnv *e
|
|||||||
|
|
||||||
RegalMakeCurrent_func *RegalMakeCurrent = (RegalMakeCurrent_func *) dlsym(RTLD_DEFAULT, "RegalMakeCurrent");
|
RegalMakeCurrent_func *RegalMakeCurrent = (RegalMakeCurrent_func *) dlsym(RTLD_DEFAULT, "RegalMakeCurrent");
|
||||||
RegalMakeCurrent(potatoBridge.eglContext);*/
|
RegalMakeCurrent(potatoBridge.eglContext);*/
|
||||||
|
|
||||||
printf("regal removed\n");
|
printf("regal removed\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user