Skip to content

Commit

Permalink
iOS: set up shared gl context correctly (libretro#17565)
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Mattiello <git@joemattiello.com>
  • Loading branch information
warmenhoven authored and JoeMatt committed Feb 21, 2025
1 parent d858fd5 commit 1b6fc51
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 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 @@ -480,21 +481,21 @@ static bool cocoa_gl_gfx_ctx_set_video_mode(void *data,
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)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 sharegroup:g_hw_ctx.sharegroup];
}
else
g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
if (cocoa_ctx->flags & COCOA_CTX_FLAG_USE_HW_CTX)
{
g_hw_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 sharegroup:g_hw_ctx.sharegroup];
}
else
g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
g_ctx = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
#endif

#ifdef OSX
Expand Down

0 comments on commit 1b6fc51

Please sign in to comment.