mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(CocoaGL) Move shared code to gl_shared file
This commit is contained in:
parent
b1c4bdf6f7
commit
74bddae86e
@ -27,25 +27,6 @@ static void *cocoagl_gfx_ctx_init(video_frame_info_t *video_info, void *video_dr
|
||||
return cocoa_ctx;
|
||||
}
|
||||
|
||||
static bool cocoagl_gfx_ctx_bind_api(void *data,
|
||||
enum gfx_ctx_api api, unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
if (api != GFX_CTX_OPENGL_ES_API)
|
||||
return false;
|
||||
#elif defined(HAVE_COCOA)
|
||||
if (api != GFX_CTX_OPENGL_API)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
cocoagl_api = api;
|
||||
g_minor = minor;
|
||||
g_major = major;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height, bool fullscreen)
|
||||
@ -142,22 +123,6 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void cocoagl_gfx_ctx_swap_buffers(void *data, void *data2)
|
||||
{
|
||||
if (!(--g_fast_forward_skips < 0))
|
||||
return;
|
||||
|
||||
#if defined(HAVE_COCOA)
|
||||
[g_context flushBuffer];
|
||||
[g_hw_ctx flushBuffer];
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
if (g_view)
|
||||
[g_view display];
|
||||
#endif
|
||||
|
||||
g_fast_forward_skips = g_is_syncing ? 0 : 3;
|
||||
}
|
||||
|
||||
const gfx_ctx_driver_t gfx_ctx_cocoagl = {
|
||||
cocoagl_gfx_ctx_init,
|
||||
cocoagl_gfx_ctx_destroy,
|
||||
|
@ -54,36 +54,6 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api,
|
||||
unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
switch (api)
|
||||
{
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
break;
|
||||
#elif defined(HAVE_COCOA_METAL)
|
||||
case GFX_CTX_OPENGL_API:
|
||||
break;
|
||||
#ifdef HAVE_VULKAN
|
||||
case GFX_CTX_VULKAN_API:
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
cocoagl_api = api;
|
||||
g_minor = minor;
|
||||
g_major = major;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
||||
video_frame_info_t *video_info,
|
||||
unsigned width, unsigned height, bool fullscreen)
|
||||
@ -219,42 +189,6 @@ static void *cocoagl_gfx_ctx_get_context_data(void *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void cocoagl_gfx_ctx_swap_buffers(void *data, void *data2)
|
||||
{
|
||||
#ifdef HAVE_VULKAN
|
||||
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data;
|
||||
#endif
|
||||
|
||||
switch (cocoagl_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
if (!(--g_fast_forward_skips < 0))
|
||||
return;
|
||||
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
[g_context flushBuffer];
|
||||
[g_hw_ctx flushBuffer];
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
if (g_view)
|
||||
[g_view display];
|
||||
#endif
|
||||
|
||||
g_fast_forward_skips = g_is_syncing ? 0 : 3;
|
||||
break;
|
||||
case GFX_CTX_VULKAN_API:
|
||||
#ifdef HAVE_VULKAN
|
||||
vulkan_present(&cocoa_ctx->vk, cocoa_ctx->vk.context.current_swapchain_index);
|
||||
vulkan_acquire_next_image(&cocoa_ctx->vk);
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool cocoagl_gfx_ctx_set_resize(void *data, unsigned width, unsigned height)
|
||||
{
|
||||
#ifdef HAVE_VULKAN
|
||||
|
@ -581,5 +581,68 @@ static void cocoagl_gfx_ctx_swap_interval(void *data, int i)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void cocoagl_gfx_ctx_swap_buffers(void *data, void *data2)
|
||||
{
|
||||
#ifdef HAVE_VULKAN
|
||||
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data;
|
||||
#endif
|
||||
|
||||
switch (cocoagl_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
if (!(--g_fast_forward_skips < 0))
|
||||
return;
|
||||
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
[g_context flushBuffer];
|
||||
[g_hw_ctx flushBuffer];
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
if (g_view)
|
||||
[g_view display];
|
||||
#endif
|
||||
|
||||
g_fast_forward_skips = g_is_syncing ? 0 : 3;
|
||||
break;
|
||||
case GFX_CTX_VULKAN_API:
|
||||
#ifdef HAVE_VULKAN
|
||||
vulkan_present(&cocoa_ctx->vk, cocoa_ctx->vk.context.current_swapchain_index);
|
||||
vulkan_acquire_next_image(&cocoa_ctx->vk);
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool cocoagl_gfx_ctx_bind_api(void *data, enum gfx_ctx_api api,
|
||||
unsigned major, unsigned minor)
|
||||
{
|
||||
(void)data;
|
||||
switch (api)
|
||||
{
|
||||
#if defined(HAVE_COCOATOUCH)
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
break;
|
||||
#elif defined(HAVE_COCOA_METAL)
|
||||
case GFX_CTX_OPENGL_API:
|
||||
break;
|
||||
#ifdef HAVE_VULKAN
|
||||
case GFX_CTX_VULKAN_API:
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
cocoagl_api = api;
|
||||
g_minor = minor;
|
||||
g_major = major;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user