diff --git a/gfx/common/egl_common.c b/gfx/common/egl_common.c index 1e121b72e7..a0bfa48034 100644 --- a/gfx/common/egl_common.c +++ b/gfx/common/egl_common.c @@ -18,6 +18,12 @@ #include "egl_common.h" +EGLContext g_egl_ctx; +EGLContext g_egl_hw_ctx; +EGLSurface g_egl_surf; +EGLDisplay g_egl_dpy; +EGLConfig g_egl_config; + void egl_report_error(void) { EGLint error = eglGetError(); diff --git a/gfx/common/egl_common.h b/gfx/common/egl_common.h index a13c1d630a..726b8bf2da 100644 --- a/gfx/common/egl_common.h +++ b/gfx/common/egl_common.h @@ -21,6 +21,12 @@ #include "../video_context_driver.h" +extern EGLContext g_egl_ctx; +extern EGLContext g_egl_hw_ctx; +extern EGLSurface g_egl_surf; +extern EGLDisplay g_egl_dpy; +extern EGLConfig g_egl_config; + void egl_report_error(void); gfx_ctx_proc_t egl_get_proc_address(const char *symbol); diff --git a/gfx/drivers_context/androidegl_ctx.c b/gfx/drivers_context/androidegl_ctx.c index c58dc40be1..580353ec38 100644 --- a/gfx/drivers_context/androidegl_ctx.c +++ b/gfx/drivers_context/androidegl_ctx.c @@ -34,11 +34,6 @@ int system_property_get(const char *cmd, const char *args, char *value); typedef struct gfx_ctx_android_data { bool g_use_hw_ctx; - EGLContext g_egl_hw_ctx; - EGLContext g_egl_ctx; - EGLSurface g_egl_surf; - EGLDisplay g_egl_dpy; - EGLConfig g_egl_config; } gfx_ctx_android_data_t; static bool g_es3; @@ -54,7 +49,7 @@ static void android_gfx_ctx_set_swap_interval(void *data, unsigned interval) if (!android) return; - eglSwapInterval(android->g_egl_dpy, interval); + eglSwapInterval(g_egl_dpy, interval); } static void android_gfx_ctx_destroy_resources(gfx_ctx_android_data_t *android) @@ -62,30 +57,30 @@ static void android_gfx_ctx_destroy_resources(gfx_ctx_android_data_t *android) if (!android) return; - if (android->g_egl_dpy) + if (g_egl_dpy) { - if (android->g_egl_ctx) + if (g_egl_ctx) { - eglMakeCurrent(android->g_egl_dpy, + eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(android->g_egl_dpy, android->g_egl_ctx); + eglDestroyContext(g_egl_dpy, g_egl_ctx); } - if (android->g_egl_hw_ctx) - eglDestroyContext(android->g_egl_dpy, android->g_egl_hw_ctx); + if (g_egl_hw_ctx) + eglDestroyContext(g_egl_dpy, g_egl_hw_ctx); - if (android->g_egl_surf) - eglDestroySurface(android->g_egl_dpy, android->g_egl_surf); - eglTerminate(android->g_egl_dpy); + if (g_egl_surf) + eglDestroySurface(g_egl_dpy, g_egl_surf); + eglTerminate(g_egl_dpy); } /* Be as careful as possible in deinit. */ - android->g_egl_ctx = NULL; - android->g_egl_hw_ctx = NULL; - android->g_egl_surf = NULL; - android->g_egl_dpy = NULL; - android->g_egl_config = 0; + g_egl_ctx = NULL; + g_egl_hw_ctx = NULL; + g_egl_surf = NULL; + g_egl_dpy = NULL; + g_egl_config = 0; } static void android_gfx_ctx_destroy(void *data) @@ -121,13 +116,13 @@ static void android_gfx_ctx_get_video_size(void *data, if (!android) return; - if (!android->g_egl_dpy) + if (!g_egl_dpy) return; - eglQuerySurface(android->g_egl_dpy, - android->g_egl_surf, EGL_WIDTH, &gl_width); - eglQuerySurface(android->g_egl_dpy, - android->g_egl_surf, EGL_HEIGHT, &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; } @@ -165,26 +160,26 @@ static bool android_gfx_ctx_init(void *data) RARCH_LOG("Android EGL: GLES version = %d.\n", g_es3 ? 3 : 2); - android->g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); + g_egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (!android->g_egl_dpy) + if (!g_egl_dpy) { RARCH_ERR("[Android/EGL]: Couldn't get EGL display.\n"); goto error; } - if (!eglInitialize(android->g_egl_dpy, + if (!eglInitialize(g_egl_dpy, &egl_version_major, &egl_version_minor)) goto error; RARCH_LOG("[ANDROID/EGL]: EGL version: %d.%d\n", egl_version_major, egl_version_minor); - if (!eglChooseConfig(android->g_egl_dpy, - attribs, &android->g_egl_config, 1, &num_config)) + if (!eglChooseConfig(g_egl_dpy, + attribs, &g_egl_config, 1, &num_config)) goto error; - var = eglGetConfigAttrib(android->g_egl_dpy, android->g_egl_config, + var = eglGetConfigAttrib(g_egl_dpy, g_egl_config, EGL_NATIVE_VISUAL_ID, &format); if (!var) @@ -195,31 +190,31 @@ static bool android_gfx_ctx_init(void *data) ANativeWindow_setBuffersGeometry(android_app->window, 0, 0, format); - android->g_egl_ctx = eglCreateContext(android->g_egl_dpy, - android->g_egl_config, EGL_NO_CONTEXT, context_attributes); + g_egl_ctx = eglCreateContext(g_egl_dpy, + g_egl_config, EGL_NO_CONTEXT, context_attributes); - if (android->g_egl_ctx == EGL_NO_CONTEXT) + if (g_egl_ctx == EGL_NO_CONTEXT) goto error; if (android->g_use_hw_ctx) { - android->g_egl_hw_ctx = eglCreateContext(android->g_egl_dpy, - android->g_egl_config, android->g_egl_ctx, + g_egl_hw_ctx = eglCreateContext(g_egl_dpy, + g_egl_config, g_egl_ctx, context_attributes); RARCH_LOG("[Android/EGL]: Created shared context: %p.\n", - (void*)android->g_egl_hw_ctx); + (void*)g_egl_hw_ctx); - if (android->g_egl_hw_ctx == EGL_NO_CONTEXT) + if (g_egl_hw_ctx == EGL_NO_CONTEXT) goto error; } - android->g_egl_surf = eglCreateWindowSurface(android->g_egl_dpy, - android->g_egl_config, android_app->window, 0); - if (!android->g_egl_surf) + g_egl_surf = eglCreateWindowSurface(g_egl_dpy, + g_egl_config, android_app->window, 0); + if (!g_egl_surf) goto error; - if (!eglMakeCurrent(android->g_egl_dpy, android->g_egl_surf, - android->g_egl_surf, android->g_egl_ctx)) + if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, + g_egl_surf, g_egl_ctx)) goto error; driver->video_context_data = android; @@ -245,7 +240,7 @@ static void android_gfx_ctx_swap_buffers(void *data) (void)data; if (android) - eglSwapBuffers(android->g_egl_dpy, android->g_egl_surf); + eglSwapBuffers(g_egl_dpy, g_egl_surf); } static void android_gfx_ctx_check_window(void *data, bool *quit, @@ -363,14 +358,14 @@ static void android_gfx_ctx_bind_hw_render(void *data, bool enable) android->g_use_hw_ctx = enable; - if (!android->g_egl_dpy) + if (!g_egl_dpy) return; - if (!android->g_egl_surf) + if (!g_egl_surf) return; - eglMakeCurrent(android->g_egl_dpy, android->g_egl_surf, - android->g_egl_surf, enable ? - android->g_egl_hw_ctx : android->g_egl_ctx); + eglMakeCurrent(g_egl_dpy, g_egl_surf, + g_egl_surf, enable ? + g_egl_hw_ctx : g_egl_ctx); } static void dpi_get_density(char *s, size_t len) diff --git a/gfx/drivers_context/bbqnx_ctx.c b/gfx/drivers_context/bbqnx_ctx.c index c5fa486c3f..cf6da07854 100644 --- a/gfx/drivers_context/bbqnx_ctx.c +++ b/gfx/drivers_context/bbqnx_ctx.c @@ -36,11 +36,6 @@ #define WINDOW_BUFFERS 2 static bool g_use_hw_ctx; -static EGLContext g_egl_hw_ctx; -static EGLContext g_egl_ctx; -static EGLSurface g_egl_surf; -static EGLDisplay g_egl_dpy; -static EGLConfig g_egl_config; static bool g_resize; screen_context_t screen_ctx; diff --git a/gfx/drivers_context/drm_egl_ctx.c b/gfx/drivers_context/drm_egl_ctx.c index dfb422630f..f3d122ba32 100644 --- a/gfx/drivers_context/drm_egl_ctx.c +++ b/gfx/drivers_context/drm_egl_ctx.c @@ -71,11 +71,6 @@ typedef struct gfx_ctx_drm_egl_data struct gbm_bo *g_bo; struct gbm_bo *g_next_bo; - EGLContext g_egl_hw_ctx; - EGLContext g_egl_ctx; - EGLSurface g_egl_surf; - EGLDisplay g_egl_dpy; - EGLConfig g_egl_config; struct gbm_device *g_gbm_dev; struct gbm_surface *g_gbm_surface; } gfx_ctx_drm_egl_data_t; @@ -272,7 +267,7 @@ static void gfx_ctx_drm_egl_swap_buffers(void *data) (void)data; - eglSwapBuffers(drm->g_egl_dpy, drm->g_egl_surf); + eglSwapBuffers(g_egl_dpy, g_egl_surf); /* I guess we have to wait for flip to have taken * place before another flip can be queued up. */ @@ -376,32 +371,32 @@ static void gfx_ctx_drm_egl_destroy_resources(gfx_ctx_drm_egl_data_t *drm) if (waiting_for_flip) wait_flip(true); - if (drm->g_egl_dpy) + if (g_egl_dpy) { - if (drm->g_egl_ctx) + if (g_egl_ctx) { - eglMakeCurrent(drm->g_egl_dpy, + eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(drm->g_egl_dpy, drm->g_egl_ctx); + eglDestroyContext(g_egl_dpy, g_egl_ctx); } - if (drm->g_egl_hw_ctx) - eglDestroyContext(drm->g_egl_dpy, drm->g_egl_hw_ctx); + if (g_egl_hw_ctx) + eglDestroyContext(g_egl_dpy, g_egl_hw_ctx); - if (drm->g_egl_surf) - eglDestroySurface(drm->g_egl_dpy, drm->g_egl_surf); - eglTerminate(drm->g_egl_dpy); + if (g_egl_surf) + eglDestroySurface(g_egl_dpy, g_egl_surf); + eglTerminate(g_egl_dpy); } /* Be as careful as possible in deinit. * If we screw up, the KMS tty will not restore. */ - drm->g_egl_ctx = NULL; - drm->g_egl_hw_ctx = NULL; - drm->g_egl_surf = NULL; - drm->g_egl_dpy = NULL; - drm->g_egl_config = 0; + g_egl_ctx = NULL; + g_egl_hw_ctx = NULL; + g_egl_surf = NULL; + g_egl_dpy = NULL; + g_egl_config = 0; /* Restore original CRTC. */ if (drm->g_orig_crtc) @@ -792,48 +787,48 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data, goto error; } - drm->g_egl_dpy = eglGetDisplay((EGLNativeDisplayType)drm->g_gbm_dev); - if (!drm->g_egl_dpy) + g_egl_dpy = eglGetDisplay((EGLNativeDisplayType)drm->g_gbm_dev); + if (!g_egl_dpy) { RARCH_ERR("[KMS/EGL]: Couldn't get EGL display.\n"); goto error; } - if (!eglInitialize(drm->g_egl_dpy, &major, &minor)) + if (!eglInitialize(g_egl_dpy, &major, &minor)) goto error; - if (!eglChooseConfig(drm->g_egl_dpy, attrib_ptr, &drm->g_egl_config, 1, &n) || n != 1) + if (!eglChooseConfig(g_egl_dpy, attrib_ptr, &g_egl_config, 1, &n) || n != 1) goto error; attr = egl_fill_attribs(egl_attribs); - drm->g_egl_ctx = eglCreateContext(drm->g_egl_dpy, drm->g_egl_config, EGL_NO_CONTEXT, + g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT, attr != egl_attribs ? egl_attribs : NULL); - if (drm->g_egl_ctx == EGL_NO_CONTEXT) + if (g_egl_ctx == EGL_NO_CONTEXT) goto error; if (drm->g_use_hw_ctx) { - drm->g_egl_hw_ctx = eglCreateContext(drm->g_egl_dpy, drm->g_egl_config, drm->g_egl_ctx, + g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_egl_config, g_egl_ctx, attr != egl_attribs ? egl_attribs : NULL); - RARCH_LOG("[KMS/EGL]: Created shared context: %p.\n", (void*)drm->g_egl_hw_ctx); + RARCH_LOG("[KMS/EGL]: Created shared context: %p.\n", (void*)g_egl_hw_ctx); - if (drm->g_egl_hw_ctx == EGL_NO_CONTEXT) + if (g_egl_hw_ctx == EGL_NO_CONTEXT) goto error; } - drm->g_egl_surf = eglCreateWindowSurface(drm->g_egl_dpy, - drm->g_egl_config, (EGLNativeWindowType)drm->g_gbm_surface, NULL); - if (!drm->g_egl_surf) + g_egl_surf = eglCreateWindowSurface(g_egl_dpy, + g_egl_config, (EGLNativeWindowType)drm->g_gbm_surface, NULL); + if (!g_egl_surf) goto error; - if (!eglMakeCurrent(drm->g_egl_dpy, - drm->g_egl_surf, drm->g_egl_surf, drm->g_egl_ctx)) + if (!eglMakeCurrent(g_egl_dpy, + g_egl_surf, g_egl_surf, g_egl_ctx)) goto error; glClear(GL_COLOR_BUFFER_BIT); - eglSwapBuffers(drm->g_egl_dpy, drm->g_egl_surf); + eglSwapBuffers(g_egl_dpy, g_egl_surf); drm->g_bo = gbm_surface_lock_front_buffer(drm->g_gbm_surface); fb = drm_fb_get_from_bo(drm, drm->g_bo); @@ -951,14 +946,14 @@ static void gfx_ctx_drm_egl_bind_hw_render(void *data, bool enable) drm->g_use_hw_ctx = enable; - if (!drm->g_egl_dpy) + if (!g_egl_dpy) return; - if (!drm->g_egl_surf) + if (!g_egl_surf) return; - eglMakeCurrent(drm->g_egl_dpy, drm->g_egl_surf, - drm->g_egl_surf, - enable ? drm->g_egl_hw_ctx : drm->g_egl_ctx); + eglMakeCurrent(g_egl_dpy, g_egl_surf, + g_egl_surf, + enable ? g_egl_hw_ctx : g_egl_ctx); } const gfx_ctx_driver_t gfx_ctx_drm_egl = { diff --git a/gfx/drivers_context/emscriptenegl_ctx.c b/gfx/drivers_context/emscriptenegl_ctx.c index 2ca71724ff..2de71cb81e 100644 --- a/gfx/drivers_context/emscriptenegl_ctx.c +++ b/gfx/drivers_context/emscriptenegl_ctx.c @@ -30,11 +30,6 @@ #include "../../config.h" #endif -static EGLContext g_egl_ctx; -static EGLSurface g_egl_surf; -static EGLDisplay g_egl_dpy; -static EGLConfig g_egl_config; - static bool g_inited; static unsigned g_fb_width; diff --git a/gfx/drivers_context/mali_fbdev_ctx.c b/gfx/drivers_context/mali_fbdev_ctx.c index 102ec61c56..bcbbfe07e1 100644 --- a/gfx/drivers_context/mali_fbdev_ctx.c +++ b/gfx/drivers_context/mali_fbdev_ctx.c @@ -32,10 +32,6 @@ #include "../common/gl_common.h" struct fbdev_window native_window; -static EGLContext g_egl_ctx; -static EGLSurface g_egl_surf; -static EGLDisplay g_egl_dpy; -static EGLConfig g_egl_config; static bool g_resize; static unsigned g_width, g_height; diff --git a/gfx/drivers_context/vc_egl_ctx.c b/gfx/drivers_context/vc_egl_ctx.c index 820eb8e6ae..2713b9f307 100644 --- a/gfx/drivers_context/vc_egl_ctx.c +++ b/gfx/drivers_context/vc_egl_ctx.c @@ -39,11 +39,6 @@ #endif static bool g_use_hw_ctx; -static EGLContext g_egl_hw_ctx; -static EGLContext g_egl_ctx; -static EGLSurface g_egl_surf; -static EGLDisplay g_egl_dpy; -static EGLConfig g_egl_config; static volatile sig_atomic_t g_quit; static bool g_inited; diff --git a/gfx/drivers_context/vivante_fbdev_ctx.c b/gfx/drivers_context/vivante_fbdev_ctx.c index 762552ffe8..9f58aa5c35 100644 --- a/gfx/drivers_context/vivante_fbdev_ctx.c +++ b/gfx/drivers_context/vivante_fbdev_ctx.c @@ -23,10 +23,6 @@ #include "../common/egl_common.h" #include "../common/gl_common.h" -static EGLContext g_egl_ctx; -static EGLSurface g_egl_surf; -static EGLDisplay g_egl_dpy; -static EGLConfig g_egl_config; static bool g_resize; static unsigned g_width, g_height; diff --git a/gfx/drivers_context/wayland_ctx.c b/gfx/drivers_context/wayland_ctx.c index 5b07e9e8d5..cdabc63359 100644 --- a/gfx/drivers_context/wayland_ctx.c +++ b/gfx/drivers_context/wayland_ctx.c @@ -30,11 +30,6 @@ typedef struct gfx_ctx_wayland_data { - EGLContext g_egl_ctx; - EGLContext g_egl_hw_ctx; - EGLSurface g_egl_surf; - EGLDisplay g_egl_dpy; - EGLConfig g_egl_config; bool g_resize; bool g_use_hw_ctx; int g_fd; @@ -150,28 +145,28 @@ static void gfx_ctx_wl_destroy_resources(gfx_ctx_wayland_data_t *wl) if (!wl) return; - if (wl->g_egl_dpy) + if (g_egl_dpy) { - if (wl->g_egl_ctx) + if (g_egl_ctx) { - eglMakeCurrent(wl->g_egl_dpy, + eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroyContext(wl->g_egl_dpy, wl->g_egl_ctx); + eglDestroyContext(g_egl_dpy, g_egl_ctx); } - if (wl->g_egl_hw_ctx) - eglDestroyContext(wl->g_egl_dpy, wl->g_egl_hw_ctx); + if (g_egl_hw_ctx) + eglDestroyContext(g_egl_dpy, g_egl_hw_ctx); - if (wl->g_egl_surf) - eglDestroySurface(wl->g_egl_dpy, wl->g_egl_surf); - eglTerminate(wl->g_egl_dpy); + if (g_egl_surf) + eglDestroySurface(g_egl_dpy, g_egl_surf); + eglTerminate(g_egl_dpy); } - wl->g_egl_ctx = NULL; - wl->g_egl_hw_ctx = NULL; - wl->g_egl_surf = NULL; - wl->g_egl_dpy = NULL; - wl->g_egl_config = 0; + g_egl_ctx = NULL; + g_egl_hw_ctx = NULL; + g_egl_surf = NULL; + g_egl_dpy = NULL; + g_egl_config = 0; if (wl->g_win) wl_egl_window_destroy(wl->g_win); @@ -217,10 +212,10 @@ static void gfx_ctx_wl_swap_interval(void *data, unsigned interval) wl->g_interval = interval; - if (wl->g_egl_dpy && eglGetCurrentContext()) + if (g_egl_dpy && eglGetCurrentContext()) { RARCH_LOG("[Wayland/EGL]: eglSwapInterval(%u)\n", wl->g_interval); - if (!eglSwapInterval(wl->g_egl_dpy, wl->g_interval)) + if (!eglSwapInterval(g_egl_dpy, wl->g_interval)) { RARCH_ERR("[Wayland/EGL]: eglSwapInterval() failed.\n"); egl_report_error(); @@ -289,7 +284,7 @@ static void gfx_ctx_wl_swap_buffers(void *data) (void)data; - eglSwapBuffers(wl->g_egl_dpy, wl->g_egl_surf); + eglSwapBuffers(g_egl_dpy, g_egl_surf); } static void gfx_ctx_wl_set_resize(void *data, unsigned width, unsigned height) @@ -436,15 +431,15 @@ static bool gfx_ctx_wl_init(void *data) wl->g_fd = wl_display_get_fd(wl->g_dpy); - wl->g_egl_dpy = eglGetDisplay((EGLNativeDisplayType)wl->g_dpy); + g_egl_dpy = eglGetDisplay((EGLNativeDisplayType)wl->g_dpy); - if (!wl->g_egl_dpy) + if (!g_egl_dpy) { RARCH_ERR("Failed to create EGL window.\n"); goto error; } - if (!eglInitialize(wl->g_egl_dpy, &egl_major, &egl_minor)) + if (!eglInitialize(g_egl_dpy, &egl_major, &egl_minor)) { RARCH_ERR("Failed to initialize EGL.\n"); goto error; @@ -452,13 +447,13 @@ static bool gfx_ctx_wl_init(void *data) RARCH_LOG("[Wayland/EGL]: EGL version: %d.%d\n", egl_major, egl_minor); - if (!eglChooseConfig(wl->g_egl_dpy, attrib_ptr, &wl->g_egl_config, 1, &num_configs)) + 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 || !wl->g_egl_config) + if (num_configs == 0 || !g_egl_config) { RARCH_ERR("[Wayland/EGL]: No EGL configurations available.\n"); goto error; @@ -590,29 +585,29 @@ static bool gfx_ctx_wl_set_video_mode(void *data, wl_shell_surface_set_class(wl->g_shell_surf, "RetroArch"); wl_shell_surface_set_title(wl->g_shell_surf, "RetroArch"); - wl->g_egl_ctx = eglCreateContext(wl->g_egl_dpy, wl->g_egl_config, EGL_NO_CONTEXT, + g_egl_ctx = eglCreateContext(g_egl_dpy, g_egl_config, EGL_NO_CONTEXT, attr != egl_attribs ? egl_attribs : NULL); - RARCH_LOG("[Wayland/EGL]: Created context: %p.\n", (void*)wl->g_egl_ctx); - if (wl->g_egl_ctx == EGL_NO_CONTEXT) + RARCH_LOG("[Wayland/EGL]: Created context: %p.\n", (void*)g_egl_ctx); + if (g_egl_ctx == EGL_NO_CONTEXT) goto error; if (wl->g_use_hw_ctx) { - wl->g_egl_hw_ctx = eglCreateContext(wl->g_egl_dpy, wl->g_egl_config, wl->g_egl_ctx, + g_egl_hw_ctx = eglCreateContext(g_egl_dpy, g_egl_config, g_egl_ctx, attr != egl_attribs ? egl_attribs : NULL); - RARCH_LOG("[Wayland/EGL]: Created shared context: %p.\n", (void*)wl->g_egl_hw_ctx); + RARCH_LOG("[Wayland/EGL]: Created shared context: %p.\n", (void*)g_egl_hw_ctx); - if (wl->g_egl_hw_ctx == EGL_NO_CONTEXT) + if (g_egl_hw_ctx == EGL_NO_CONTEXT) goto error; } - wl->g_egl_surf = eglCreateWindowSurface(wl->g_egl_dpy, wl->g_egl_config, + g_egl_surf = eglCreateWindowSurface(g_egl_dpy, g_egl_config, (EGLNativeWindowType)wl->g_win, NULL); - if (!wl->g_egl_surf) + if (!g_egl_surf) goto error; - if (!eglMakeCurrent(wl->g_egl_dpy, wl->g_egl_surf, wl->g_egl_surf, wl->g_egl_ctx)) + if (!eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, g_egl_ctx)) goto error; RARCH_LOG("[Wayland/EGL]: Current context: %p.\n", (void*)eglGetCurrentContext()); @@ -704,11 +699,11 @@ static void gfx_ctx_wl_bind_hw_render(void *data, bool enable) wl->g_use_hw_ctx = enable; - if (!wl->g_egl_dpy || !wl->g_egl_surf) + if (!g_egl_dpy || !g_egl_surf) return; - eglMakeCurrent(wl->g_egl_dpy, wl->g_egl_surf, wl->g_egl_surf, - enable ? wl->g_egl_hw_ctx : wl->g_egl_ctx); + eglMakeCurrent(g_egl_dpy, g_egl_surf, g_egl_surf, + enable ? g_egl_hw_ctx : g_egl_ctx); } static void keyboard_handle_keymap(void* data, diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index 2c1917684d..b55eb6b1bd 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -31,11 +31,6 @@ static unsigned g_screen; static bool g_use_hw_ctx; -static EGLContext g_egl_hw_ctx; -static EGLContext g_egl_ctx; -static EGLSurface g_egl_surf; -static EGLDisplay g_egl_dpy; -static EGLConfig g_egl_config; static XF86VidModeModeInfo g_desktop_mode; static bool g_should_reset_mode;