wined3d: Use a separate flag to track if the GL context needs to be made current.

The new needs_set flag can be cleared after it's been heeded whereas restore_ctx
must not be cleared until the context has been released back to level 0.
This commit is contained in:
Ken Thomases 2014-02-19 16:14:04 -06:00 committed by Alexandre Julliard
parent 2d1e67ee68
commit baa85a097a
2 changed files with 6 additions and 2 deletions

View File

@ -817,6 +817,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx)
ctx->valid = 1;
}
ctx->needs_set = 0;
return TRUE;
}
@ -1080,6 +1081,7 @@ static void context_enter(struct wined3d_context *context)
context->restore_ctx = current_gl;
context->restore_dc = wglGetCurrentDC();
context->restore_pf = GetPixelFormat(context->restore_dc);
context->needs_set = 1;
}
}
}
@ -1476,6 +1478,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
ret->win_handle = swapchain->win_handle;
ret->hdc = hdc;
ret->pixel_format = pixel_format;
ret->needs_set = 1;
/* Set up the context defaults */
if (!context_set_current(ret))
@ -3003,7 +3006,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->needs_set)
{
context_set_gl_context(context);
}

View File

@ -1085,7 +1085,8 @@ struct wined3d_context
DWORD fixed_function_usage_map : 8; /* MAX_TEXTURES, 8 */
DWORD lowest_disabled_stage : 4; /* Max MAX_TEXTURES, 8 */
DWORD rebind_fbo : 1;
DWORD padding : 19;
DWORD needs_set : 1;
DWORD padding : 18;
DWORD shader_update_mask;
DWORD constant_update_mask;
DWORD numbered_array_mask;