diff --git a/gfx/context/wgl_ctx.c b/gfx/context/wgl_ctx.c index 912a50ff71..52f3be9e20 100644 --- a/gfx/context/wgl_ctx.c +++ b/gfx/context/wgl_ctx.c @@ -83,7 +83,14 @@ static void create_gl_context(HWND hwnd) g_hdc = GetDC(hwnd); setup_pixel_format(g_hdc); - g_hrc = wglCreateContext(g_hdc); + if (!g_hrc) + g_hrc = wglCreateContext(g_hdc); + else + { + RARCH_LOG("[WGL]: Using cached GL context.\n"); + driver.video_cache_context_ack = true; + } + if (g_hrc) { if (wglMakeCurrent(g_hdc, g_hrc)) @@ -484,8 +491,12 @@ static void gfx_ctx_destroy(void) if (g_hrc) { wglMakeCurrent(NULL, NULL); - wglDeleteContext(g_hrc); - g_hrc = NULL; + + if (!driver.video_cache_context) + { + wglDeleteContext(g_hrc); + g_hrc = NULL; + } } if (g_hwnd && g_hdc) @@ -514,6 +525,7 @@ static void gfx_ctx_destroy(void) g_inited = false; g_major = g_minor = 0; + p_swap_interval = NULL; } static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)