DDraw: When changing the back buffers also update the render target

Stefan Dösinger stefandoesinger at gmx.at
Wed Mar 28 09:44:49 CDT 2007


-------------- next part --------------
From 920d883a8ac0e6c632895ecfb43ae5e530f9a06c Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Tue, 27 Mar 2007 17:41:25 +0200
Subject: [PATCH] DDraw: When changing the back buffers also update the render target

To enable WineD3D to catch windowed Direct3D blits from an offscreen back to the
onscreen front buffer, DDraw sets a back buffer when creating the d3d7 device. Also set
the render target to notify the context manager about the changed surfaces.
---
 dlls/ddraw/device.c   |    5 +++++
 dlls/ddraw/direct3d.c |    4 ++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 231e2cd..2e26056 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -308,6 +308,11 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
         /* Restore the render targets */
         if(This->OffScreenTarget)
         {
+            /* Set the device up to render to the front buffer since the back buffer will
+             * vanish soon.
+             */
+            IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
+                                           This->ddraw->d3d_target->WineD3DSurface);
             /* This->target is the offscreen target.
              * This->ddraw->d3d_target is the target used by DDraw
              */
diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c
index b716a60..3047f1d 100644
--- a/dlls/ddraw/direct3d.c
+++ b/dlls/ddraw/direct3d.c
@@ -855,6 +855,10 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
         if(hr != D3D_OK)
             ERR("(%p) Error %08x setting the front and back buffer\n", This, hr);
 
+        /* Render to the back buffer */
+        IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0,
+                                       target->WineD3DSurface);
+
         object->OffScreenTarget = TRUE;
     }
     else
-- 
1.4.4.3



More information about the wine-patches mailing list