d3d9: Replace wined3d surface refcounting with texture refcounting.

Signed-off-by: Riccardo Bortolato <rikyz619@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Riccardo Bortolato 2016-01-27 20:44:41 +01:00 committed by Alexandre Julliard
parent 39549a54fc
commit edf003771b
3 changed files with 7 additions and 9 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;