Skip to content

Commit

Permalink
iOS: set up shared gl context correctly (#17565)
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven authored Feb 13, 2025
1 parent a6ea47d commit 65e1436
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gfx/drivers_context/cocoa_gl_ctx.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 65e1436

Please sign in to comment.