Commit 6b94fb1e authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

wined3d: Always check if context window needs to be updated.

Fixes a regression introduced by commit 8673dca8. Signed-off-by: 's avatarJózef Kucia <jkucia@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 56040aca
......@@ -1114,18 +1114,21 @@ static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HD
}
}
static void context_update_window(struct wined3d_context *context, HWND win_handle)
static void context_update_window(struct wined3d_context *context)
{
if (context->win_handle == win_handle)
if (!context->swapchain)
return;
if (context->win_handle == context->swapchain->win_handle)
return;
TRACE("Updating context %p window from %p to %p.\n",
context, context->win_handle, win_handle);
context, context->win_handle, context->swapchain->win_handle);
if (context->hdc)
wined3d_release_dc(context->win_handle, context->hdc);
context->win_handle = win_handle;
context->win_handle = context->swapchain->win_handle;
context->hdc_is_private = FALSE;
context->hdc_has_format = FALSE;
context->needs_set = 1;
......@@ -3616,7 +3619,6 @@ static void context_setup_target(struct wined3d_context *context,
struct wined3d_context *context_acquire(const struct wined3d_device *device, struct wined3d_surface *target)
{
struct wined3d_context *current_context = context_get_current();
struct wined3d_swapchain *swapchain = NULL;
struct wined3d_texture *target_texture;
unsigned int target_sub_resource_idx;
struct wined3d_context *context;
......@@ -3656,11 +3658,11 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str
{
context = current_context;
}
else if ((swapchain = target_texture->swapchain))
else if (target_texture->swapchain)
{
TRACE("Rendering onscreen.\n");
context = swapchain_get_context(swapchain);
context = swapchain_get_context(target_texture->swapchain);
}
else
{
......@@ -3669,19 +3671,13 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str
/* Stay with the current context if possible. Otherwise use the
* context for the primary swapchain. */
if (current_context && current_context->device == device)
{
context = current_context;
}
else
{
swapchain = device->swapchains[0];
context = swapchain_get_context(swapchain);
}
context = swapchain_get_context(device->swapchains[0]);
}
context_enter(context);
if (swapchain)
context_update_window(context, swapchain->win_handle);
context_update_window(context);
context_setup_target(context, target_texture, target_sub_resource_idx);
if (!context->valid) return context;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment