Commit b6b9c156 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10core: Implement d3d10_shader_resource_view_GetResource().

parent 32d1bb2b
......@@ -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
......
......@@ -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);
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment