[PATCH 6/7] d3d8: Store a struct d3d8 in struct d3d8_device.

Zhiyi Zhang zzhang at codeweavers.com
Mon Mar 30 02:19:47 CDT 2020


So that d3d8->wined3d_outputs can be accessed.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/d3d8/d3d8_private.h | 2 +-
 dlls/d3d8/device.c       | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 9352641176..ca958942f8 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -115,7 +115,7 @@ struct d3d8_device
     LONG                    ref;
     struct wined3d_device  *wined3d_device;
     unsigned int            adapter_ordinal;
-    IDirect3D8             *d3d_parent;
+    struct d3d8            *d3d_parent;
     struct                  d3d8_handle_table handle_table;
 
     /* FVF management */
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 23e93df061..44a81ba672 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -576,7 +576,7 @@ static ULONG WINAPI d3d8_device_Release(IDirect3DDevice8 *iface)
 
     if (!ref)
     {
-        IDirect3D8 *parent = device->d3d_parent;
+        IDirect3D8 *parent = &device->d3d_parent->IDirect3D8_iface;
         unsigned i;
 
         TRACE("Releasing wined3d device %p.\n", device->wined3d_device);
@@ -672,7 +672,8 @@ static HRESULT WINAPI d3d8_device_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D
     if (!d3d8)
         return D3DERR_INVALIDCALL;
 
-    return IDirect3D8_QueryInterface(device->d3d_parent, &IID_IDirect3D8, (void **)d3d8);
+    return IDirect3D8_QueryInterface(&device->d3d_parent->IDirect3D8_iface, &IID_IDirect3D8,
+            (void **)d3d8);
 }
 
 static HRESULT WINAPI d3d8_device_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *caps)
@@ -3779,8 +3780,8 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wine
 
     device->implicit_swapchain = wined3d_swapchain;
 
-    device->d3d_parent = &parent->IDirect3D8_iface;
-    IDirect3D8_AddRef(device->d3d_parent);
+    device->d3d_parent = parent;
+    IDirect3D8_AddRef(&parent->IDirect3D8_iface);
 
     return D3D_OK;
 
-- 
2.20.1




More information about the wine-devel mailing list