[PATCH 1/4] wined3d: Always check if context window needs to be updated.
Józef Kucia
jkucia at codeweavers.com
Sat Dec 17 17:22:25 CST 2016
This fixes a regression introduced by commit
8673dca87df76b8f94be65c82e4a1a389c13dd9b.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
This basically reverts commit 8673dca87df76b8f94be65c82e4a1a389c13dd9b
and adds a NULL check in context_update_window().
---
dlls/wined3d/context.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 8fdd297..6112b40 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -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;
--
2.7.3
More information about the wine-patches
mailing list