wined3d: Restore the thread's previous GL context in WineD3D_ReleaseFakeGLContext().
This commit is contained in:
parent
94509f85b5
commit
30d2660d99
|
@ -217,6 +217,8 @@ struct wined3d_fake_gl_ctx
|
||||||
HDC dc;
|
HDC dc;
|
||||||
HWND wnd;
|
HWND wnd;
|
||||||
HGLRC gl_ctx;
|
HGLRC gl_ctx;
|
||||||
|
HDC restore_dc;
|
||||||
|
HGLRC restore_gl_ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void WineD3D_ReleaseFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
|
static void WineD3D_ReleaseFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
|
||||||
|
@ -236,6 +238,11 @@ static void WineD3D_ReleaseFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
|
||||||
|
|
||||||
ReleaseDC(ctx->wnd, ctx->dc);
|
ReleaseDC(ctx->wnd, ctx->dc);
|
||||||
DestroyWindow(ctx->wnd);
|
DestroyWindow(ctx->wnd);
|
||||||
|
|
||||||
|
if (ctx->restore_gl_ctx && !pwglMakeCurrent(ctx->restore_dc, ctx->restore_gl_ctx))
|
||||||
|
{
|
||||||
|
ERR_(d3d_caps)("Failed to restore previous GL context.\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
|
static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
|
||||||
|
@ -245,6 +252,9 @@ static BOOL WineD3D_CreateFakeGLContext(struct wined3d_fake_gl_ctx *ctx)
|
||||||
|
|
||||||
TRACE("getting context...\n");
|
TRACE("getting context...\n");
|
||||||
|
|
||||||
|
ctx->restore_dc = pwglGetCurrentDC();
|
||||||
|
ctx->restore_gl_ctx = pwglGetCurrentContext();
|
||||||
|
|
||||||
/* We need a fake window as a hdc retrieved using GetDC(0) can't be used for much GL purposes. */
|
/* We need a fake window as a hdc retrieved using GetDC(0) can't be used for much GL purposes. */
|
||||||
ctx->wnd = CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME, "WineD3D fake window",
|
ctx->wnd = CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME, "WineD3D fake window",
|
||||||
WS_OVERLAPPEDWINDOW, 10, 10, 10, 10, NULL, NULL, NULL, NULL);
|
WS_OVERLAPPEDWINDOW, 10, 10, 10, 10, NULL, NULL, NULL, NULL);
|
||||||
|
@ -309,6 +319,10 @@ fail:
|
||||||
ctx->dc = NULL;
|
ctx->dc = NULL;
|
||||||
if (ctx->wnd) DestroyWindow(ctx->wnd);
|
if (ctx->wnd) DestroyWindow(ctx->wnd);
|
||||||
ctx->wnd = NULL;
|
ctx->wnd = NULL;
|
||||||
|
if (ctx->restore_gl_ctx && !pwglMakeCurrent(ctx->restore_dc, ctx->restore_gl_ctx))
|
||||||
|
{
|
||||||
|
ERR_(d3d_caps)("Failed to restore previous GL context.\n");
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue