mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-29 19:20:48 +00:00
(Android) Try to move this code to set_video_mode
This commit is contained in:
parent
4850af8eac
commit
a3f216ba86
@ -107,13 +107,6 @@ static void *android_gfx_ctx_init(video_frame_info_t *video_info, void *video_dr
|
||||
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
|
||||
bool debug = hwr->debug_context;
|
||||
#endif
|
||||
EGLint context_attributes[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, g_es3 ? 3 : 2,
|
||||
#if 0
|
||||
EGL_CONTEXT_FLAGS_KHR, debug ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0,
|
||||
#endif
|
||||
EGL_NONE
|
||||
};
|
||||
EGLint attribs[] = {
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
@ -175,16 +168,6 @@ static void *android_gfx_ctx_init(video_frame_info_t *video_info, void *video_dr
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
ANativeWindow_setBuffersGeometry(android_app->window, 0, 0, format);
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
if (!egl_create_context(&and->egl, context_attributes))
|
||||
{
|
||||
egl_report_error();
|
||||
goto unlock_error;
|
||||
}
|
||||
|
||||
if (!egl_create_surface(&and->egl, android_app->window))
|
||||
goto unlock_error;
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_NONE:
|
||||
default:
|
||||
@ -320,6 +303,15 @@ static bool android_gfx_ctx_set_video_mode(void *data,
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
android_ctx_data_t *and = (android_ctx_data_t*)data;
|
||||
#endif
|
||||
#if defined(HAVE_OPENGLES) && defined(HAVE_EGL)
|
||||
EGLint context_attributes[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, g_es3 ? 3 : 2,
|
||||
#if 0
|
||||
EGL_CONTEXT_FLAGS_KHR, debug ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0,
|
||||
#endif
|
||||
EGL_NONE
|
||||
};
|
||||
#endif
|
||||
|
||||
(void)width;
|
||||
(void)height;
|
||||
@ -327,6 +319,20 @@ static bool android_gfx_ctx_set_video_mode(void *data,
|
||||
|
||||
switch (android_api)
|
||||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
break;
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
#if defined(HAVE_OPENGLES) && defined(HAVE_EGL)
|
||||
if (!egl_create_context(&and->egl, context_attributes))
|
||||
{
|
||||
egl_report_error();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!egl_create_surface(&and->egl, android_app->window))
|
||||
return false;
|
||||
#endif
|
||||
break;
|
||||
case GFX_CTX_VULKAN_API:
|
||||
#ifdef HAVE_VULKAN
|
||||
and->width = ANativeWindow_getWidth(android_app->window);
|
||||
|
Loading…
Reference in New Issue
Block a user