d3d10core: COM cleanup for the ID3D10ShaderResourceView iface.

This commit is contained in:
Michael Stefaniuc 2011-06-01 10:46:00 +02:00 committed by Alexandre Julliard
parent 7aff686ea1
commit 36de21b3a1
3 changed files with 10 additions and 5 deletions

View File

@ -145,7 +145,7 @@ HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
/* ID3D10ShaderResourceView */
struct d3d10_shader_resource_view
{
const struct ID3D10ShaderResourceViewVtbl *vtbl;
ID3D10ShaderResourceView ID3D10ShaderResourceView_iface;
LONG refcount;
};

View File

@ -742,7 +742,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateShaderResourceView(ID3D10Dev
}
TRACE("Created shader resource view %p.\n", object);
*view = (ID3D10ShaderResourceView *)object;
*view = &object->ID3D10ShaderResourceView_iface;
return S_OK;
}

View File

@ -468,6 +468,11 @@ HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
return S_OK;
}
static inline struct d3d10_shader_resource_view *impl_from_ID3D10ShaderResourceView(ID3D10ShaderResourceView *iface)
{
return CONTAINING_RECORD(iface, struct d3d10_shader_resource_view, ID3D10ShaderResourceView_iface);
}
/* IUnknown methods */
static HRESULT STDMETHODCALLTYPE d3d10_shader_resource_view_QueryInterface(ID3D10ShaderResourceView *iface,
@ -493,7 +498,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_resource_view_QueryInterface(ID3D1
static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_AddRef(ID3D10ShaderResourceView *iface)
{
struct d3d10_shader_resource_view *This = (struct d3d10_shader_resource_view *)iface;
struct d3d10_shader_resource_view *This = impl_from_ID3D10ShaderResourceView(iface);
ULONG refcount = InterlockedIncrement(&This->refcount);
TRACE("%p increasing refcount to %u.\n", This, refcount);
@ -503,7 +508,7 @@ static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_AddRef(ID3D10ShaderRes
static ULONG STDMETHODCALLTYPE d3d10_shader_resource_view_Release(ID3D10ShaderResourceView *iface)
{
struct d3d10_shader_resource_view *This = (struct d3d10_shader_resource_view *)iface;
struct d3d10_shader_resource_view *This = impl_from_ID3D10ShaderResourceView(iface);
ULONG refcount = InterlockedDecrement(&This->refcount);
TRACE("%p decreasing refcount to %u.\n", This, refcount);
@ -585,7 +590,7 @@ static const struct ID3D10ShaderResourceViewVtbl d3d10_shader_resource_view_vtbl
HRESULT d3d10_shader_resource_view_init(struct d3d10_shader_resource_view *view)
{
view->vtbl = &d3d10_shader_resource_view_vtbl;
view->ID3D10ShaderResourceView_iface.lpVtbl = &d3d10_shader_resource_view_vtbl;
view->refcount = 1;
return S_OK;