From: Zebediah Figura zfigura@codeweavers.com
--- dlls/d3d8/d3d8_private.h | 1 + dlls/d3d8/surface.c | 7 +++++++ 2 files changed, 8 insertions(+)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index 69e16a50c3a..181a952a347 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -199,6 +199,7 @@ struct d3d8_surface IDirect3DDevice8 *parent_device; IUnknown *container; struct d3d8_texture *texture; + struct wined3d_swapchain *swapchain; };
struct wined3d_rendertarget_view *d3d8_surface_acquire_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN; diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index b4545ca3657..37d225ede70 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -69,6 +69,8 @@ static ULONG WINAPI d3d8_surface_AddRef(IDirect3DSurface8 *iface) if (surface->wined3d_rtv) wined3d_rendertarget_view_incref(surface->wined3d_rtv); wined3d_texture_incref(surface->wined3d_texture); + if (surface->swapchain) + wined3d_swapchain_incref(surface->swapchain); }
return refcount; @@ -102,6 +104,10 @@ static ULONG WINAPI d3d8_surface_Release(IDirect3DSurface8 *iface)
if (surface->wined3d_rtv) wined3d_rendertarget_view_decref(surface->wined3d_rtv); + if (surface->swapchain) + wined3d_swapchain_decref(surface->swapchain); + /* Releasing the texture may free the d3d8 object, so do not access it + * after releasing the texture. */ wined3d_texture_decref(surface->wined3d_texture);
if (parent_device) @@ -325,6 +331,7 @@ struct d3d8_surface *d3d8_surface_create(struct wined3d_texture *wined3d_texture surface->container = container; surface->wined3d_texture = wined3d_texture; surface->sub_resource_idx = sub_resource_idx; + surface->swapchain = wined3d_texture_get_swapchain(wined3d_texture);
if (surface->container && SUCCEEDED(IUnknown_QueryInterface(surface->container, &IID_IDirect3DBaseTexture8, (void **)&texture)))