Merge egl_bridge_ios.m into egl_bridge.m

This commit is contained in:
Duy Tran Khanh committed 2021-07-08 16:11:18 +07:00
1 parent 1ed83f7908
commit a7866235af
5 files changed
+6 -60

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ set_target_properties(PojavLauncher PROPERTIES
MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/Info.plist")
add_library(pojavexec SHARED log.m AppDelegate.m SceneDelegate.m UILauncher.m LauncherViewController.m LauncherPreferencesViewController.m LauncherFAQViewController.m LoginViewController.m SurfaceViewController.m UpdateHistoryViewController.m AboutLauncherViewController.m egl_bridge_ios.m ios_uikit_bridge.m customcontrols/ControlButton.m egl_bridge.m input_bridge_v3.m utils.m)
add_library(pojavexec SHARED log.m AppDelegate.m SceneDelegate.m UILauncher.m LauncherViewController.m LauncherPreferencesViewController.m LauncherFAQViewController.m LoginViewController.m SurfaceViewController.m UpdateHistoryViewController.m AboutLauncherViewController.m ios_uikit_bridge.m customcontrols/ControlButton.m egl_bridge.m input_bridge_v3.m utils.m)
target_link_libraries(pojavexec
"-F'${CMAKE_CURRENT_LIST_DIR}/resources/Frameworks'"
"-framework UIKit"
+1 -1
View File
@@ -1,5 +1,5 @@
#import "SurfaceViewController.h"
#import "egl_bridge_ios.h"
#import "egl_bridge.h"
#import "ios_uikit_bridge.h"
#import "customcontrols/ControlButton.h"
@@ -8,8 +8,4 @@
MGLContext *glContext;
MGLKViewController *viewController;
jboolean makeSharedContext();
jboolean clearCurrentContext();
void swapBuffers();
#endif
+4 -4
View File
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include "egl_bridge_ios.h"
#include "egl_bridge.h"
#include "EGL/egl.h"
#include "GLES2/gl2.h"
@@ -174,7 +174,8 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
(EGLContext *) window
);
#else
success = makeSharedContext();
[MGLContext setCurrentContext:nil];
success = [MGLContext setCurrentContext:glContext] == YES;
#endif
if (success == EGL_FALSE) {
@@ -182,7 +183,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglMakeCurrent(JNIEnv*
}
debug("EGLBridge: Trigger an initial swapBuffers");
swapBuffers();
[viewController resume];
// Test
#ifdef GLES_TEST
@@ -260,7 +261,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_GLFW_nativeEglSwapBuffers(JNIEnv
return JNI_FALSE;
}
// swapBuffers();
jboolean result = (jboolean) eglSwapBuffers(potatoBridge.eglDisplay, eglGetCurrentSurface(EGL_DRAW));
if (!result) {
-50
View File
@@ -1,50 +0,0 @@
#ifndef USE_EGL
#import <UIKit/UIKit.h>
#import "MGLKit.h"
#import <dlfcn.h>
#import "AppDelegate.h"
#import "egl_bridge_ios.h"
#import "SurfaceViewController.h"
#include "GLES2/gl2.h"
#include "GLES2/gl2ext.h"
#if defined (_LP64)
# define jlong_to_ptr(a) ((void*)(a))
# define ptr_to_jlong(a) ((jlong)(a))
#else
# define jlong_to_ptr(a) ((void*)(int)(a))
# define ptr_to_jlong(a) ((jlong)(int)(a))
#endif
void *getCurrentContext() {
return (__bridge void*) glContext;
}
jboolean makeSharedContext() {
[MGLContext setCurrentContext:nil];
if ([MGLContext setCurrentContext:glContext] == YES) {
// glContext = ctx;
// glViewport(0, 0, width_c, height_c);
return JNI_TRUE;
}
return JNI_FALSE;
}
jboolean clearCurrentContext() {
if ([MGLContext setCurrentContext:nil] == YES) {
return JNI_TRUE;
}
return JNI_FALSE;
}
void swapBuffers() {
[viewController resume];
}
#endif