From de1d4bc66eb1356415957721c76db10213d2f48b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 19 Sep 2013 13:08:33 +0200
Subject: wined3d: Don't try to flip sysmem copies in swapchain_present.

This was once an optimization for ddraw applications that mapped the
backbuffer to render movies. It doesn't work any more in the intended
fashion.
---
 dlls/wined3d/swapchain.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index cf2543e..3214fe5 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -560,11 +560,13 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
     wined3d_resource_invalidate_location(&front->resource, ~WINED3D_LOCATION_DRAWABLE);
     /* If the swapeffect is DISCARD, the back buffer is undefined. That means the SYSMEM
      * and INTEXTURE copies can keep their old content if they have any defined content.
-     * If the swapeffect is COPY, the content remains the same.
-     *
-     * The FLIP swap effect is not implemented yet. We could mark WINED3D_LOCATION_DRAWABLE
-     * up to date and hope WGL flipped front and back buffers and read this data into
-     * the FBO. Don't bother about this for now. */
+     * If the swapeffect is COPY, the content remains the same. If it is FLIP however,
+     * the texture / sysmem copy needs to be reloaded from the drawable. */
+    if (swapchain->desc.swap_effect == WINED3D_SWAP_EFFECT_FLIP)
+    {
+        wined3d_resource_validate_location(&back_buffer->resource, back_buffer->container->resource.draw_binding);
+        wined3d_resource_invalidate_location(&back_buffer->resource, ~back_buffer->container->resource.draw_binding);
+    }
 
     if (fb->depth_stencil)
     {
-- 
2.5.1

