On Feb 18, 2014, at 5:40 PM, Henri Verbeet wrote:
After thinking about it for a bit, I think the issue is essentially that context_acquire() depends on context_enter() to set context->restore_ctx when context_set_gl_context() needs to be called. If only the pixel format is different context_set_gl_context() will not be called.
OK, I can see how that would happen. However, my wined3d patch didn't change that part of the logic. I think my test just exposed a pre-existing bug. It doesn't show up without my wined3d patch applied because, in that case, wined3d fails to restore the window's pixel format and leaves it with a double-buffered pixel format. The two bugs cancel each other out and fixing one allowed the other to be revealed.
This fixes it, although it may be more crude than we'd like:
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 4679b25..3d11c16 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -3051,7 +3056,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str if (!context_set_current(context)) ERR("Failed to activate the new context.\n"); } - else if (context->restore_ctx) + else if (context->restore_ctx || context->pixel_format != GetPixelFormat(wglGetCurrentDC())) { context_set_gl_context(context); }
-Ken