Henri Verbeet : d3d9: Fix GetDevice() for surfaces that are part of a texture.

Alexandre Julliard julliard at winehq.org
Mon Dec 7 10:26:18 CST 2009


Module: wine
Branch: master
Commit: 89c96ca31ea51554b70a4c59d56f3b1e8b2d3f7b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=89c96ca31ea51554b70a4c59d56f3b1e8b2d3f7b

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Dec  7 11:08:37 2009 +0100

d3d9: Fix GetDevice() for surfaces that are part of a texture.

If the surface is part of a texture it doesn't keep its own reference to the
device, but instead relies on the reference the texture has. This fixes a
regression introduced by ff92e6eb6a6b0f5b6ee0d062f8434cad8f31c33d.

---

 dlls/d3d9/surface.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c
index 6f55eca..210a0ee 100644
--- a/dlls/d3d9/surface.c
+++ b/dlls/d3d9/surface.c
@@ -108,6 +108,23 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetDevice(IDirect3DSurface9 *iface,
 
     TRACE("iface %p, device %p.\n", iface, device);
 
+    if (This->forwardReference)
+    {
+        IDirect3DResource9 *resource;
+        HRESULT hr;
+
+        hr = IUnknown_QueryInterface(This->forwardReference, &IID_IDirect3DResource9, (void **)&resource);
+        if (SUCCEEDED(hr))
+        {
+            hr = IDirect3DResource9_GetDevice(resource, device);
+            IDirect3DResource9_Release(resource);
+
+            TRACE("Returning device %p.\n", *device);
+        }
+
+        return hr;
+    }
+
     *device = (IDirect3DDevice9 *)This->parentDevice;
     IDirect3DDevice9_AddRef(*device);
 




More information about the wine-cvs mailing list