Support cached contexts on Win32.

Only tested on Wine, but works.
This commit is contained in:
Themaister 2013-06-23 23:18:05 +02:00
parent e18af77412
commit feebb78f75

View File

@ -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)