[v4 2/5] d3d9: Replace surface refcounting with parent texture refcounting.

Riccardo Bortolato rikyz619 at gmail.com
Fri Jan 22 12:25:51 CST 2016


Removed wined3d_surface from d3d9_surface as it's not used anymore.

Signed-off-by: Riccardo Bortolato <rikyz619 at gmail.com>
---
 dlls/d3d9/d3d9_private.h | 3 +--
 dlls/d3d9/device.c       | 2 +-
 dlls/d3d9/surface.c      | 7 +++----
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index 6e84faf..5e01f84 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -219,7 +219,6 @@ struct d3d9_surface
     struct d3d9_resource resource;
     struct wined3d_texture *wined3d_texture;
     unsigned int sub_resource_idx;
-    struct wined3d_surface *wined3d_surface;
     struct list rtv_entry;
     struct wined3d_rendertarget_view *wined3d_rtv;
     IDirect3DDevice9Ex *parent_device;
@@ -230,7 +229,7 @@ struct d3d9_surface
 
 struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9_surface *surface) DECLSPEC_HIDDEN;
 void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
-        struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
+        const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN;
 struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN;
 
 struct d3d9_vertexbuffer
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 8a2ce0c..8f7be33 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3618,7 +3618,7 @@ static HRESULT CDECL device_parent_surface_created(struct wined3d_device_parent
     if (!(d3d_surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_surface))))
         return E_OUTOFMEMORY;
 
-    surface_init(d3d_surface, wined3d_texture, sub_resource_idx, surface, parent_ops);
+    surface_init(d3d_surface, wined3d_texture, sub_resource_idx, parent_ops);
     *parent = d3d_surface;
     TRACE("Created surface %p.\n", d3d_surface);
 
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c
index 833c1f4..baef4e3 100644
--- a/dlls/d3d9/surface.c
+++ b/dlls/d3d9/surface.c
@@ -71,7 +71,7 @@ static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface)
         wined3d_mutex_lock();
         if (surface->wined3d_rtv)
             wined3d_rendertarget_view_incref(surface->wined3d_rtv);
-        wined3d_surface_incref(surface->wined3d_surface);
+        wined3d_texture_incref(surface->wined3d_texture);
         wined3d_mutex_unlock();
     }
 
@@ -101,7 +101,7 @@ static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface)
         wined3d_mutex_lock();
         if (surface->wined3d_rtv)
             wined3d_rendertarget_view_decref(surface->wined3d_rtv);
-        wined3d_surface_decref(surface->wined3d_surface);
+        wined3d_texture_decref(surface->wined3d_texture);
         wined3d_mutex_unlock();
 
         /* Release the device last, as it may cause the device to be destroyed. */
@@ -358,7 +358,7 @@ static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops =
 };
 
 void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx,
-        struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops)
+        const struct wined3d_parent_ops **parent_ops)
 {
     struct wined3d_resource_desc desc;
     IDirect3DBaseTexture9 *texture;
@@ -366,7 +366,6 @@ void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_
     surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl;
     d3d9_resource_init(&surface->resource);
     surface->resource.refcount = 0;
-    surface->wined3d_surface = wined3d_surface;
     list_init(&surface->rtv_entry);
     surface->container = wined3d_texture_get_parent(wined3d_texture);
     surface->wined3d_texture = wined3d_texture;
-- 
1.9.1




More information about the wine-patches mailing list