Riccardo Bortolato : d3d9: Replace wined3d surface refcounting with texture refcounting.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 28 10:06:45 CST 2016


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

Author: Riccardo Bortolato <rikyz619 at gmail.com>
Date:   Wed Jan 27 20:44:41 2016 +0100

d3d9: Replace wined3d surface refcounting with texture refcounting.

Signed-off-by: Riccardo Bortolato <rikyz619 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d9/d3d9_private.h | 5 ++---
 dlls/d3d9/device.c       | 2 +-
 dlls/d3d9/surface.c      | 9 ++++-----
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index 6e84faf..a0703ab 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;
@@ -229,8 +228,8 @@ 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;
+void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture,
+        unsigned int sub_resource_idx, 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 3b1c859..e51cdd5 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..c3032dc 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. */
@@ -357,8 +357,8 @@ static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops =
     surface_wined3d_object_destroyed,
 };
 
-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)
+void surface_init(struct d3d9_surface *surface, struct wined3d_texture *wined3d_texture,
+        unsigned int sub_resource_idx, 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;




More information about the wine-cvs mailing list