d3d10core: Store the resource in the d3d10core rendertarget view.
This commit is contained in:
parent
f5c5a30724
commit
739e302e6f
|
@ -140,6 +140,7 @@ struct d3d10_rendertarget_view
|
||||||
|
|
||||||
struct wined3d_rendertarget_view *wined3d_view;
|
struct wined3d_rendertarget_view *wined3d_view;
|
||||||
D3D10_RENDER_TARGET_VIEW_DESC desc;
|
D3D10_RENDER_TARGET_VIEW_DESC desc;
|
||||||
|
ID3D10Resource *resource;
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
|
HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
|
||||||
|
|
|
@ -339,6 +339,7 @@ static ULONG STDMETHODCALLTYPE d3d10_rendertarget_view_Release(ID3D10RenderTarge
|
||||||
if (!refcount)
|
if (!refcount)
|
||||||
{
|
{
|
||||||
wined3d_rendertarget_view_decref(This->wined3d_view);
|
wined3d_rendertarget_view_decref(This->wined3d_view);
|
||||||
|
ID3D10Resource_Release(This->resource);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,29 +384,12 @@ static HRESULT STDMETHODCALLTYPE d3d10_rendertarget_view_SetPrivateDataInterface
|
||||||
static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetResource(ID3D10RenderTargetView *iface,
|
static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetResource(ID3D10RenderTargetView *iface,
|
||||||
ID3D10Resource **resource)
|
ID3D10Resource **resource)
|
||||||
{
|
{
|
||||||
struct d3d10_rendertarget_view *This = impl_from_ID3D10RenderTargetView(iface);
|
struct d3d10_rendertarget_view *view = impl_from_ID3D10RenderTargetView(iface);
|
||||||
struct wined3d_resource *wined3d_resource;
|
|
||||||
IUnknown *parent;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
TRACE("iface %p, resource %p\n", iface, resource);
|
TRACE("iface %p, resource %p\n", iface, resource);
|
||||||
|
|
||||||
wined3d_resource = wined3d_rendertarget_view_get_resource(This->wined3d_view);
|
*resource = view->resource;
|
||||||
if (!wined3d_resource)
|
ID3D10Resource_AddRef(*resource);
|
||||||
{
|
|
||||||
ERR("Failed to get wined3d resource.\n");
|
|
||||||
*resource = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent = wined3d_resource_get_parent(wined3d_resource);
|
|
||||||
hr = IUnknown_QueryInterface(parent, &IID_ID3D10Resource, (void **)&resource);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
ERR("Resource parent isn't a d3d10 resource, hr %#x\n", hr);
|
|
||||||
*resource = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ID3D10RenderTargetView methods */
|
/* ID3D10RenderTargetView methods */
|
||||||
|
@ -470,6 +454,9 @@ HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view,
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view->resource = resource;
|
||||||
|
ID3D10Resource_AddRef(resource);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue