[PATCH 1/5] d3d8: Fix GetDevice() for surfaces that are part of a texture.
Henri Verbeet
hverbeet at codeweavers.com
Mon Dec 7 04:08:36 CST 2009
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 3cedef2ffea3a72d9717470f01a3a046db923e4b.
---
dlls/d3d8/surface.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index 1d4b1dc..cf72e3e 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -106,6 +106,23 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface,
TRACE("iface %p, device %p.\n", iface, device);
+ if (This->forwardReference)
+ {
+ IDirect3DResource8 *resource;
+ HRESULT hr;
+
+ hr = IUnknown_QueryInterface(This->forwardReference, &IID_IDirect3DResource8, (void **)&resource);
+ if (SUCCEEDED(hr))
+ {
+ hr = IDirect3DResource8_GetDevice(resource, device);
+ IDirect3DResource8_Release(resource);
+
+ TRACE("Returning device %p.\n", *device);
+ }
+
+ return hr;
+ }
+
*device = (IDirect3DDevice8 *)This->parentDevice;
IDirect3DDevice8_AddRef(*device);
--
1.6.4.4
More information about the wine-patches
mailing list