diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index 95d929a4f9d..f45fd34c4b7 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -155,9 +155,12 @@ struct d3d10_shader_resource_view { ID3D10ShaderResourceView ID3D10ShaderResourceView_iface; LONG refcount; + + ID3D10Resource *resource; }; -HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view) DECLSPEC_HIDDEN; +HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view, + ID3D10Resource *resource) DECLSPEC_HIDDEN; /* ID3D10InputLayout */ struct d3d10_input_layout diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index 6cd77374324..d184c0285f5 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -746,8 +746,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Dev return E_OUTOFMEMORY; } - hr = d3d10_shader_resource_view_init(object); - if (FAILED(hr)) + if (FAILED(hr = d3d10_shader_resource_view_init(object, resource))) { WARN("Failed to initialize shader resource view, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); diff --git a/dlls/d3d10core/view.c b/dlls/d3d10core/view.c index 792e79b0667..9bf4fcb4548 100644 --- a/dlls/d3d10core/view.c +++ b/dlls/d3d10core/view.c @@ -526,6 +526,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_Release(ID3D10ShaderRe if (!refcount) { + ID3D10Resource_Release(This->resource); HeapFree(GetProcessHeap(), 0, This); } @@ -571,7 +572,12 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_resource_view_SetPrivateDataInterf static void STDMETHODCALLTYPE d3d10_shader_resource_view_GetResource(ID3D10ShaderResourceView *iface, ID3D10Resource **resource) { - FIXME("iface %p, resource %p stub!\n", iface, resource); + struct d3d10_shader_resource_view *view = impl_from_ID3D10ShaderResourceView(iface); + + TRACE("iface %p, resource %p.\n", iface, resource); + + *resource = view->resource; + ID3D10Resource_AddRef(*resource); } /* ID3D10ShaderResourceView methods */ @@ -599,10 +605,14 @@ static const struct ID3D10ShaderResourceViewVtbl d3d10_shader_resource_view_vtbl d3d10_shader_resource_view_GetDesc, }; -HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view) +HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view, + ID3D10Resource *resource) { view->ID3D10ShaderResourceView_iface.lpVtbl = &d3d10_shader_resource_view_vtbl; view->refcount = 1; + view->resource = resource; + ID3D10Resource_AddRef(resource); + return S_OK; }