Skip to content

Commit

Permalink
WIP - OpenGL ES 3 on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
warmenhoven committed Nov 26, 2023
1 parent 14b49a2 commit b8f767f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
10 changes: 6 additions & 4 deletions gfx/drivers/gl2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2085,10 +2085,12 @@ static bool gl2_renderchain_init_hw_render(
{
GLenum status;
gl2_bind_fb(gl->hw_render_fbo[i]);
gl2_fb_texture_2d(RARCH_GL_FRAMEBUFFER,
RARCH_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->texture[i], 0);

if (depth)
if (!depth)
{
gl2_fb_texture_2d(RARCH_GL_FRAMEBUFFER,
RARCH_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gl->texture[i], 0);
}
else
{
gl2_bind_rb(RARCH_GL_RENDERBUFFER, chain->hw_render_depth[i]);
gl2_rb_storage(RARCH_GL_RENDERBUFFER,
Expand Down
7 changes: 4 additions & 3 deletions gfx/drivers_context/cocoa_gl_ctx.m
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,17 @@ 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];
#else
[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;
Expand Down
2 changes: 1 addition & 1 deletion griffin/griffin_objc.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2088,8 +2088,9 @@
"-DHAVE_NETWORKING",
"-DHAVE_ONLINE_UPDATER",
"-DHAVE_OPENGL",
"-DHAVE_OPENGL_CORE",
"-DHAVE_OPENGLES",
"-DHAVE_OPENGLES2",
"-DHAVE_OPENGLES3",
"-DHAVE_OZONE",
"-DHAVE_PATCH",
"-DHAVE_RBMP",
Expand Down Expand Up @@ -2205,8 +2206,9 @@
"-DHAVE_NETWORKING",
"-DHAVE_ONLINE_UPDATER",
"-DHAVE_OPENGL",
"-DHAVE_OPENGL_CORE",
"-DHAVE_OPENGLES",
"-DHAVE_OPENGLES2",
"-DHAVE_OPENGLES3",
"-DHAVE_OZONE",
"-DHAVE_PATCH",
"-DHAVE_RBMP",
Expand Down
4 changes: 2 additions & 2 deletions retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b8f767f

Please sign in to comment.