d3d10core: Implement d3d10_shader_resource_view_GetResource().

This commit is contained in:
Henri Verbeet 2012-09-12 11:30:51 +02:00 committed by Alexandre Julliard
parent 32d1bb2bbf
commit b6b9c15696
3 changed files with 17 additions and 5 deletions

View File

@ -155,9 +155,12 @@ struct d3d10_shader_resource_view
{ {
ID3D10ShaderResourceView ID3D10ShaderResourceView_iface; ID3D10ShaderResourceView ID3D10ShaderResourceView_iface;
LONG refcount; 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 */ /* ID3D10InputLayout */
struct d3d10_input_layout struct d3d10_input_layout

View File

@ -746,8 +746,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Dev
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
hr = d3d10_shader_resource_view_init(object); if (FAILED(hr = d3d10_shader_resource_view_init(object, resource)))
if (FAILED(hr))
{ {
WARN("Failed to initialize shader resource view, hr %#x.\n", hr); WARN("Failed to initialize shader resource view, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object); HeapFree(GetProcessHeap(), 0, object);

View File

@ -526,6 +526,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_Release(ID3D10ShaderRe
if (!refcount) if (!refcount)
{ {
ID3D10Resource_Release(This->resource);
HeapFree(GetProcessHeap(), 0, This); 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, static void STDMETHODCALLTYPE d3d10_shader_resource_view_GetResource(ID3D10ShaderResourceView *iface,
ID3D10Resource **resource) 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 */ /* ID3D10ShaderResourceView methods */
@ -599,10 +605,14 @@ static const struct ID3D10ShaderResourceViewVtbl d3d10_shader_resource_view_vtbl
d3d10_shader_resource_view_GetDesc, 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->ID3D10ShaderResourceView_iface.lpVtbl = &d3d10_shader_resource_view_vtbl;
view->refcount = 1; view->refcount = 1;
view->resource = resource;
ID3D10Resource_AddRef(resource);
return S_OK; return S_OK;
} }