Module: wine Branch: master Commit: 57c51710e0a4474872125cc54be7562ea8db6ccd URL: http://source.winehq.org/git/wine.git/?a=commit;h=57c51710e0a4474872125cc54b...
Author: Ken Thomases ken@codeweavers.com Date: Sun Mar 23 22:46:04 2014 -0500
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().
---
dlls/wined3d/context.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 3341ae2..8dbe001 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -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);