iOS: set up shared gl context correctly (#17565)

This commit is contained in:
Eric Warmenhoven 2025-02-13 03:06:14 -05:00 committed by GitHub
parent a6ea47df15
commit 65e1436a23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 2 deletions

View File

@ -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