From 65e1436a23416a07efb2294befcdc96ca5296c9f Mon Sep 17 00:00:00 2001 From: Eric Warmenhoven Date: Thu, 13 Feb 2025 03:06:14 -0500 Subject: [PATCH] iOS: set up shared gl context correctly (#17565) --- gfx/drivers_context/cocoa_gl_ctx.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index 65899de61b30..bbe17c3f5a48 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -174,6 +174,7 @@ static void cocoa_gl_gfx_ctx_destroy(void *data) #else [EAGLContext setCurrentContext:nil]; #endif + g_hw_ctx = nil; g_ctx = nil; free(cocoa_ctx); @@ -481,12 +482,20 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data, #if defined(HAVE_OPENGLES3) if (cocoa_ctx->flags & COCOA_CTX_FLAG_USE_HW_CTX) + { g_hw_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; - g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; + g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3 sharegroup:g_hw_ctx.sharegroup]; + } + else + g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; #elif defined(HAVE_OPENGLES2) if (cocoa_ctx->flags & COCOA_CTX_FLAG_USE_HW_CTX) + { g_hw_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; - g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; + g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:g_hw_ctx.sharegroup]; + } + else + g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; #endif #ifdef OSX