wined3d: When restoring pixel format in context_release(), mark the context as needing to be set on the next context_acquire().

If we had to restore the pixel format then we know it won't be what we need
when the app calls into wined3d again.  This helps avoid the GetPixelFormat()
in context_acquire().
This commit is contained in:
Ken Thomases 2014-03-23 22:46:04 -05:00 committed by Alexandre Julliard
parent ffb357b717
commit 57c51710e0
1 changed files with 6 additions and 3 deletions

View File

@ -719,9 +719,10 @@ void context_surface_update(struct wined3d_context *context, const struct wined3
}
}
static void context_restore_pixel_format(struct wined3d_context *ctx)
static BOOL context_restore_pixel_format(struct wined3d_context *ctx)
{
const struct wined3d_gl_info *gl_info = ctx->gl_info;
BOOL ret = FALSE;
if (ctx->restore_pf && IsWindow(ctx->restore_pf_win))
{
@ -730,7 +731,7 @@ static void context_restore_pixel_format(struct wined3d_context *ctx)
HDC dc = GetDC(ctx->restore_pf_win);
if (dc)
{
if (!GL_EXTCALL(wglSetPixelFormatWINE(dc, ctx->restore_pf)))
if (!(ret = GL_EXTCALL(wglSetPixelFormatWINE(dc, ctx->restore_pf))))
{
ERR("wglSetPixelFormatWINE failed to restore pixel format %d on window %p.\n",
ctx->restore_pf, ctx->restore_pf_win);
@ -746,6 +747,7 @@ static void context_restore_pixel_format(struct wined3d_context *ctx)
ctx->restore_pf = 0;
ctx->restore_pf_win = NULL;
return ret;
}
static BOOL context_set_pixel_format(struct wined3d_context *context, HDC dc, int format)
@ -1088,7 +1090,8 @@ void context_release(struct wined3d_context *context)
if (!--context->level)
{
context_restore_pixel_format(context);
if (context_restore_pixel_format(context))
context->needs_set = 1;
if (context->restore_ctx)
{
TRACE("Restoring GL context %p on device context %p.\n", context->restore_ctx, context->restore_dc);