diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index 153c5cc9034..95d929a4f9d 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -128,9 +128,12 @@ struct d3d10_depthstencil_view { ID3D10DepthStencilView ID3D10DepthStencilView_iface; LONG refcount; + + ID3D10Resource *resource; }; -HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view) DECLSPEC_HIDDEN; +HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view, + ID3D10Resource *resource) DECLSPEC_HIDDEN; /* ID3D10RenderTargetView */ struct d3d10_rendertarget_view diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index 2d1db4ed2bc..6cd77374324 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -804,8 +804,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilView(ID3D10Devic return E_OUTOFMEMORY; } - hr = d3d10_depthstencil_view_init(object); - if (FAILED(hr)) + if (FAILED(hr = d3d10_depthstencil_view_init(object, resource))) { WARN("Failed to initialize depthstencil view, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); diff --git a/dlls/d3d10core/view.c b/dlls/d3d10core/view.c index a542e63b3a6..792e79b0667 100644 --- a/dlls/d3d10core/view.c +++ b/dlls/d3d10core/view.c @@ -211,6 +211,7 @@ static ULONG STDMETHODCALLTYPE d3d10_depthstencil_view_Release(ID3D10DepthStenci if (!refcount) { + ID3D10Resource_Release(This->resource); HeapFree(GetProcessHeap(), 0, This); } @@ -255,7 +256,12 @@ static HRESULT STDMETHODCALLTYPE d3d10_depthstencil_view_SetPrivateDataInterface static void STDMETHODCALLTYPE d3d10_depthstencil_view_GetResource(ID3D10DepthStencilView *iface, ID3D10Resource **resource) { - FIXME("iface %p, resource %p stub!\n", iface, resource); + struct d3d10_depthstencil_view *view = impl_from_ID3D10DepthStencilView(iface); + + TRACE("iface %p, resource %p.\n", iface, resource); + + *resource = view->resource; + ID3D10Resource_AddRef(*resource); } /* ID3D10DepthStencilView methods */ @@ -283,11 +289,15 @@ static const struct ID3D10DepthStencilViewVtbl d3d10_depthstencil_view_vtbl = d3d10_depthstencil_view_GetDesc, }; -HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view) +HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view, + ID3D10Resource *resource) { view->ID3D10DepthStencilView_iface.lpVtbl = &d3d10_depthstencil_view_vtbl; view->refcount = 1; + view->resource = resource; + ID3D10Resource_AddRef(resource); + return S_OK; }