From 4e075e09ad5cc967819c20cae0eea0c4edf9d206 Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Sun, 12 Nov 2023 18:06:53 -0500 Subject: [PATCH] iOS/tvOS: create gl context as gles3 iOS 7+ supports gles3, which is backwards compatible with gles2. This doesn't enable the glcore driver (which isn't working on ios yet), it just changes the underlying context. This fixes some of the rendering performance problems on mupen64plus_next. --- gfx/drivers_context/cocoa_gl_ctx.m | 7 ++++--- griffin/griffin_objc.m | 2 +- pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj | 4 ++-- retroarch.c | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index 840f9d0978f..2449cadb2e7 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -473,9 +473,8 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data, cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data; if (cocoa_ctx->flags & COCOA_CTX_FLAG_USE_HW_CTX) - g_hw_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - glk_view.context = g_ctx; + g_hw_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; + g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; #ifdef OSX [g_ctx makeCurrentContext]; @@ -483,6 +482,8 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data, [EAGLContext setCurrentContext:g_ctx]; #endif + glk_view.context = g_ctx; + /* TODO: Maybe iOS users should be able to * show/hide the status bar here? */ return true; diff --git a/griffin/griffin_objc.m b/griffin/griffin_objc.m index 4a5853f48d4..ec64a64803f 100644 --- a/griffin/griffin_objc.m +++ b/griffin/griffin_objc.m @@ -30,7 +30,7 @@ #if defined(HAVE_COCOATOUCH) || defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL) #include "../ui/drivers/cocoa/cocoa_common.m" -#if defined(HAVE_OPENGL) || defined(HAVE_OPENGL_ES) +#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) #include "../gfx/drivers_context/cocoa_gl_ctx.m" #endif #if defined(HAVE_VULKAN) diff --git a/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj index c762bdf503b..254e70aff3e 100644 --- a/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj @@ -2082,7 +2082,7 @@ "-DHAVE_ONLINE_UPDATER", "-DHAVE_OPENGL", "-DHAVE_OPENGLES", - "-DHAVE_OPENGLES2", + "-DHAVE_OPENGLES3", "-DHAVE_OZONE", "-DHAVE_PATCH", "-DHAVE_RBMP", @@ -2199,7 +2199,7 @@ "-DHAVE_ONLINE_UPDATER", "-DHAVE_OPENGL", "-DHAVE_OPENGLES", - "-DHAVE_OPENGLES2", + "-DHAVE_OPENGLES3", "-DHAVE_OZONE", "-DHAVE_PATCH", "-DHAVE_RBMP", diff --git a/retroarch.c b/retroarch.c index 7e95f870956..3245e03474a 100644 --- a/retroarch.c +++ b/retroarch.c @@ -6525,7 +6525,7 @@ bool retroarch_main_init(int argc, char *argv[]) { RARCH_ERR("%s: \"%s\"\n", msg_hash_to_str(MSG_FATAL_ERROR_RECEIVED_IN), - global->error_string); + global_get_ptr()->error_string); goto error; } @@ -6835,7 +6835,7 @@ bool retroarch_main_init(int argc, char *argv[]) error: command_event(CMD_EVENT_CORE_DEINIT, NULL); - runloop_st->flags &= ~RUNLOOP_FLAG_IS_INITED; + runloop_state_get_ptr()->flags &= ~RUNLOOP_FLAG_IS_INITED; return false; }