mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-21 10:20:21 +00:00
Start using egl_init_context for most GLES context drivers
This commit is contained in:
parent
4c1ac3222c
commit
c1e61f7ff0
@ -52,8 +52,8 @@ static void gfx_ctx_qnx_destroy(void *data)
|
|||||||
|
|
||||||
static bool gfx_ctx_qnx_init(void *data)
|
static bool gfx_ctx_qnx_init(void *data)
|
||||||
{
|
{
|
||||||
EGLint num_config;
|
EGLint n;
|
||||||
EGLint egl_version_major, egl_version_minor;
|
EGLint major, minor;
|
||||||
EGLint context_attributes[] = {
|
EGLint context_attributes[] = {
|
||||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
@ -98,30 +98,18 @@ static bool gfx_ctx_qnx_init(void *data)
|
|||||||
|
|
||||||
usage = SCREEN_USAGE_OPENGL_ES2 | SCREEN_USAGE_ROTATION;
|
usage = SCREEN_USAGE_OPENGL_ES2 | SCREEN_USAGE_ROTATION;
|
||||||
|
|
||||||
RARCH_LOG("Initializing context\n");
|
|
||||||
|
|
||||||
if ((g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY)
|
|
||||||
{
|
|
||||||
RARCH_ERR("eglGetDisplay failed.\n");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!eglInitialize(g_egl_dpy, &egl_version_major, &egl_version_minor))
|
|
||||||
{
|
|
||||||
RARCH_ERR("eglInitialize failed.\n");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
||||||
{
|
{
|
||||||
RARCH_ERR("eglBindAPI failed.\n");
|
RARCH_ERR("eglBindAPI failed.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
RARCH_LOG("[BLACKBERRY QNX/EGL]: EGL version: %d.%d\n", egl_version_major, egl_version_minor);
|
if (!egl_init_context(EGL_DEFAULT_DISPLAY, &major, &minor,
|
||||||
|
&n, attribs))
|
||||||
if (!eglChooseConfig(g_egl_dpy, attribs, &g_egl_config, 1, &num_config))
|
{
|
||||||
|
egl_report_error();
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT, context_attributes);
|
g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT, context_attributes);
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ static void gfx_ctx_emscripten_destroy(void *data);
|
|||||||
|
|
||||||
static bool gfx_ctx_emscripten_init(void *data)
|
static bool gfx_ctx_emscripten_init(void *data)
|
||||||
{
|
{
|
||||||
EGLint width, height, num_config;
|
EGLint width, height, n, major, minor;
|
||||||
static const EGLint attribute_list[] =
|
static const EGLint attribute_list[] =
|
||||||
{
|
{
|
||||||
EGL_RED_SIZE, 8,
|
EGL_RED_SIZE, 8,
|
||||||
@ -124,26 +124,18 @@ static bool gfx_ctx_emscripten_init(void *data)
|
|||||||
|
|
||||||
(void)data;
|
(void)data;
|
||||||
|
|
||||||
RARCH_LOG("[EMSCRIPTEN/EGL]: Initializing...\n");
|
|
||||||
|
|
||||||
if (g_inited)
|
if (g_inited)
|
||||||
{
|
{
|
||||||
RARCH_LOG("[EMSCRIPTEN/EGL]: Attempted to re-initialize driver.\n");
|
RARCH_LOG("[EMSCRIPTEN/EGL]: Attempted to re-initialize driver.\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get an EGL display connection. */
|
if (!egl_init_context(EGL_DEFAULT_DISPLAY, &major, &minor,
|
||||||
g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
&n, attribute_list))
|
||||||
if (!g_egl_dpy)
|
{
|
||||||
goto error;
|
egl_report_error();
|
||||||
|
|
||||||
/* Initialize the EGL display connection. */
|
|
||||||
if (!eglInitialize(g_egl_dpy, NULL, NULL))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
/* Get an appropriate EGL frame buffer configuration. */
|
|
||||||
if (!eglChooseConfig(g_egl_dpy, attribute_list, &g_egl_config, 1, &num_config))
|
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create an EGL rendering context. */
|
/* Create an EGL rendering context. */
|
||||||
g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT, context_attributes);
|
g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT, context_attributes);
|
||||||
|
@ -64,9 +64,8 @@ static void gfx_ctx_mali_fbdev_get_video_size(void *data,
|
|||||||
|
|
||||||
static bool gfx_ctx_mali_fbdev_init(void *data)
|
static bool gfx_ctx_mali_fbdev_init(void *data)
|
||||||
{
|
{
|
||||||
|
EGLint n;
|
||||||
EGLint num_config;
|
EGLint major, minor;
|
||||||
EGLint egl_version_major, egl_version_minor;
|
|
||||||
EGLint format;
|
EGLint format;
|
||||||
static const EGLint attribs[] = {
|
static const EGLint attribs[] = {
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||||
@ -83,26 +82,10 @@ static bool gfx_ctx_mali_fbdev_init(void *data)
|
|||||||
/* Disable cursor blinking so it's not visible in RetroArch. */
|
/* Disable cursor blinking so it's not visible in RetroArch. */
|
||||||
system("setterm -cursor off");
|
system("setterm -cursor off");
|
||||||
|
|
||||||
RARCH_LOG("[Mali fbdev]: Initializing context\n");
|
if (!egl_init_context(EGL_DEFAULT_DISPLAY,
|
||||||
|
&major, &minor, &n, attribs))
|
||||||
if ((g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY)
|
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Mali fbdev]: eglGetDisplay failed.\n");
|
egl_report_error();
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!eglInitialize(g_egl_dpy, &egl_version_major, &egl_version_minor))
|
|
||||||
{
|
|
||||||
RARCH_ERR("[Mali fbdev]: eglInitialize failed.\n");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
RARCH_LOG("[Mali fbdev]: EGL version: %d.%d\n",
|
|
||||||
egl_version_major, egl_version_minor);
|
|
||||||
|
|
||||||
if (!eglChooseConfig(g_egl_dpy, attribs, &g_egl_config, 1, &num_config))
|
|
||||||
{
|
|
||||||
RARCH_ERR("[Mali fbdev]: eglChooseConfig failed.\n");
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ static void gfx_ctx_vc_destroy(void *data);
|
|||||||
static bool gfx_ctx_vc_init(void *data)
|
static bool gfx_ctx_vc_init(void *data)
|
||||||
{
|
{
|
||||||
VC_DISPMANX_ALPHA_T alpha;
|
VC_DISPMANX_ALPHA_T alpha;
|
||||||
EGLint num_config;
|
EGLint n, major, minor;
|
||||||
static EGL_DISPMANX_WINDOW_T nativewindow;
|
static EGL_DISPMANX_WINDOW_T nativewindow;
|
||||||
|
|
||||||
DISPMANX_ELEMENT_HANDLE_T dispman_element;
|
DISPMANX_ELEMENT_HANDLE_T dispman_element;
|
||||||
@ -164,7 +164,6 @@ static bool gfx_ctx_vc_init(void *data)
|
|||||||
};
|
};
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
|
|
||||||
RARCH_LOG("[VC/EGL]: Initializing...\n");
|
|
||||||
if (g_inited)
|
if (g_inited)
|
||||||
{
|
{
|
||||||
RARCH_ERR("[VC/EGL]: Attempted to re-initialize driver.\n");
|
RARCH_ERR("[VC/EGL]: Attempted to re-initialize driver.\n");
|
||||||
@ -173,18 +172,12 @@ static bool gfx_ctx_vc_init(void *data)
|
|||||||
|
|
||||||
bcm_host_init();
|
bcm_host_init();
|
||||||
|
|
||||||
/* Get an EGL display connection. */
|
if (!egl_init_context(EGL_DEFAULT_DISPLAY,
|
||||||
g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
&major, &minor, &n, attribute_list))
|
||||||
if (!g_egl_dpy)
|
{
|
||||||
goto error;
|
egl_report_error();
|
||||||
|
|
||||||
/* Initialize the EGL display connection. */
|
|
||||||
if (!eglInitialize(g_egl_dpy, NULL, NULL))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
/* Get an appropriate EGL frame buffer configuration. */
|
|
||||||
if (!eglChooseConfig(g_egl_dpy, attribute_list, &g_egl_config, 1, &num_config))
|
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create an EGL rendering context. */
|
/* Create an EGL rendering context. */
|
||||||
g_egl_ctx = eglCreateContext(
|
g_egl_ctx = eglCreateContext(
|
||||||
|
@ -35,8 +35,8 @@ static void gfx_ctx_vivante_destroy(void *data)
|
|||||||
|
|
||||||
static bool gfx_ctx_vivante_init(void *data)
|
static bool gfx_ctx_vivante_init(void *data)
|
||||||
{
|
{
|
||||||
EGLint num_config;
|
EGLint n;
|
||||||
EGLint egl_version_major, egl_version_minor;
|
EGLint major, minor;
|
||||||
EGLint format;
|
EGLint format;
|
||||||
static const EGLint attribs[] = {
|
static const EGLint attribs[] = {
|
||||||
#if 0
|
#if 0
|
||||||
@ -55,26 +55,10 @@ static bool gfx_ctx_vivante_init(void *data)
|
|||||||
|
|
||||||
egl_install_sighandlers();
|
egl_install_sighandlers();
|
||||||
|
|
||||||
RARCH_LOG("[Vivante fbdev]: Initializing context\n");
|
if (!egl_init_context(EGL_DEFAULT_DISPLAY, &major, &minor,
|
||||||
|
&n, attribs))
|
||||||
if ((g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY)
|
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Vivante fbdev]: eglGetDisplay failed.\n");
|
egl_report_error();
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!eglInitialize(g_egl_dpy, &egl_version_major, &egl_version_minor))
|
|
||||||
{
|
|
||||||
RARCH_ERR("[Vivante fbdev]: eglInitialize failed.\n");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
RARCH_LOG("[Vivante fbdev]: EGL version: %d.%d\n",
|
|
||||||
egl_version_major, egl_version_minor);
|
|
||||||
|
|
||||||
if (!eglChooseConfig(g_egl_dpy, attribs, &g_egl_config, 1, &num_config))
|
|
||||||
{
|
|
||||||
RARCH_ERR("[Vivante fbdev]: eglChooseConfig failed.\n");
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,8 +303,8 @@ static bool gfx_ctx_wl_init(void *data)
|
|||||||
EGL_NONE,
|
EGL_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
EGLint egl_major = 0, egl_minor = 0;
|
EGLint major = 0, minor = 0;
|
||||||
EGLint num_configs;
|
EGLint n;
|
||||||
const EGLint *attrib_ptr;
|
const EGLint *attrib_ptr;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
|
|
||||||
@ -365,29 +365,14 @@ static bool gfx_ctx_wl_init(void *data)
|
|||||||
|
|
||||||
wl->g_fd = wl_display_get_fd(wl->g_dpy);
|
wl->g_fd = wl_display_get_fd(wl->g_dpy);
|
||||||
|
|
||||||
g_egl_dpy = eglGetDisplay((EGLNativeDisplayType)wl->g_dpy);
|
if (!egl_init_context((EGLNativeDisplayType)wl->g_dpy,
|
||||||
|
&major, &minor, &n, attrib_ptr))
|
||||||
if (!g_egl_dpy)
|
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to create EGL window.\n");
|
egl_report_error();
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglInitialize(g_egl_dpy, &egl_major, &egl_minor))
|
if (n == 0 || !g_egl_config)
|
||||||
{
|
|
||||||
RARCH_ERR("Failed to initialize EGL.\n");
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
RARCH_LOG("[Wayland/EGL]: EGL version: %d.%d\n", egl_major, egl_minor);
|
|
||||||
|
|
||||||
if (!eglChooseConfig(g_egl_dpy, attrib_ptr, &g_egl_config, 1, &num_configs))
|
|
||||||
{
|
|
||||||
RARCH_ERR("[Wayland/EGL]: eglChooseConfig failed with 0x%x.\n", eglGetError());
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_configs == 0 || !g_egl_config)
|
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Wayland/EGL]: No EGL configurations available.\n");
|
RARCH_ERR("[Wayland/EGL]: No EGL configurations available.\n");
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user