mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
(Android) Some initial context restoring in EGL context
This commit is contained in:
parent
46a4efd885
commit
610b54e3b2
@ -25,6 +25,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_GLSL
|
||||
#include "../shader_glsl.h"
|
||||
#endif
|
||||
|
||||
static EGLContext g_egl_ctx;
|
||||
static EGLSurface g_egl_surf;
|
||||
static EGLDisplay g_egl_dpy;
|
||||
@ -59,6 +63,21 @@ static void gfx_ctx_destroy(void)
|
||||
g_config = 0;
|
||||
}
|
||||
|
||||
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
(void)width;
|
||||
(void)height;
|
||||
|
||||
if (g_egl_dpy)
|
||||
{
|
||||
EGLint gl_width, gl_height;
|
||||
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
|
||||
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
|
||||
*width = gl_width;
|
||||
*height = gl_height;
|
||||
}
|
||||
}
|
||||
|
||||
static bool gfx_ctx_init(void)
|
||||
{
|
||||
RARCH_LOG("gfx_ctx_init().\n");
|
||||
@ -114,6 +133,32 @@ static bool gfx_ctx_init(void)
|
||||
!eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &height))
|
||||
goto error;
|
||||
|
||||
if (g_android.input_state & (1ULL << RARCH_REENTRANT))
|
||||
{
|
||||
RARCH_LOG("[ANDROID/EGL]: Setting up reentrant state.\n");
|
||||
|
||||
gl_t *gl = (gl_t*)driver.video_data;
|
||||
|
||||
// Get real known video size, which might have been altered by context.
|
||||
gfx_ctx_get_video_size(&gl->win_width, &gl->win_height);
|
||||
RARCH_LOG("GL: Using resolution %ux%u\n", gl->win_width, gl->win_height);
|
||||
|
||||
if (gl->full_x || gl->full_y) // We got bogus from gfx_ctx_get_video_size. Replace.
|
||||
{
|
||||
gl->full_x = gl->win_width;
|
||||
gl->full_y = gl->win_height;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GLSL
|
||||
gl_glsl_use(0);
|
||||
#endif
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
#ifdef HAVE_GLSL
|
||||
gl_glsl_use(1);
|
||||
#endif
|
||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
@ -175,20 +220,6 @@ static void gfx_ctx_update_window_title(bool reset)
|
||||
RARCH_LOG("%s.\n", buf);
|
||||
}
|
||||
|
||||
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
(void)width;
|
||||
(void)height;
|
||||
|
||||
if (g_egl_dpy)
|
||||
{
|
||||
EGLint gl_width, gl_height;
|
||||
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_WIDTH, &gl_width);
|
||||
eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &gl_height);
|
||||
*width = gl_width;
|
||||
*height = gl_height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static bool gfx_ctx_set_video_mode(
|
||||
|
Loading…
x
Reference in New Issue
Block a user