Support cached contexts on Win32.
Only tested on Wine, but works.
This commit is contained in:
parent
e18af77412
commit
feebb78f75
|
@ -83,7 +83,14 @@ static void create_gl_context(HWND hwnd)
|
||||||
g_hdc = GetDC(hwnd);
|
g_hdc = GetDC(hwnd);
|
||||||
setup_pixel_format(g_hdc);
|
setup_pixel_format(g_hdc);
|
||||||
|
|
||||||
|
if (!g_hrc)
|
||||||
g_hrc = wglCreateContext(g_hdc);
|
g_hrc = wglCreateContext(g_hdc);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RARCH_LOG("[WGL]: Using cached GL context.\n");
|
||||||
|
driver.video_cache_context_ack = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_hrc)
|
if (g_hrc)
|
||||||
{
|
{
|
||||||
if (wglMakeCurrent(g_hdc, g_hrc))
|
if (wglMakeCurrent(g_hdc, g_hrc))
|
||||||
|
@ -484,9 +491,13 @@ static void gfx_ctx_destroy(void)
|
||||||
if (g_hrc)
|
if (g_hrc)
|
||||||
{
|
{
|
||||||
wglMakeCurrent(NULL, NULL);
|
wglMakeCurrent(NULL, NULL);
|
||||||
|
|
||||||
|
if (!driver.video_cache_context)
|
||||||
|
{
|
||||||
wglDeleteContext(g_hrc);
|
wglDeleteContext(g_hrc);
|
||||||
g_hrc = NULL;
|
g_hrc = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (g_hwnd && g_hdc)
|
if (g_hwnd && g_hdc)
|
||||||
{
|
{
|
||||||
|
@ -514,6 +525,7 @@ static void gfx_ctx_destroy(void)
|
||||||
|
|
||||||
g_inited = false;
|
g_inited = false;
|
||||||
g_major = g_minor = 0;
|
g_major = g_minor = 0;
|
||||||
|
p_swap_interval = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
|
static void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
|
||||||
|
|
Loading…
Reference in New Issue