2 * Copyright 2009 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/port.h"
23 #include "d3d10core_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
27 /* IUnknown methods */
29 static HRESULT STDMETHODCALLTYPE d3d10_rendertarget_view_QueryInterface(ID3D10RenderTargetView *iface,
30 REFIID riid, void **object)
32 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
34 if (IsEqualGUID(riid, &IID_ID3D10RenderTargetView)
35 || IsEqualGUID(riid, &IID_ID3D10View)
36 || IsEqualGUID(riid, &IID_ID3D10DeviceChild)
37 || IsEqualGUID(riid, &IID_IUnknown))
39 IUnknown_AddRef(iface);
44 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
50 static ULONG STDMETHODCALLTYPE d3d10_rendertarget_view_AddRef(ID3D10RenderTargetView *iface)
52 struct d3d10_rendertarget_view *This = (struct d3d10_rendertarget_view *)iface;
53 ULONG refcount = InterlockedIncrement(&This->refcount);
55 TRACE("%p increasing refcount to %u\n", This, refcount);
60 static ULONG STDMETHODCALLTYPE d3d10_rendertarget_view_Release(ID3D10RenderTargetView *iface)
62 struct d3d10_rendertarget_view *This = (struct d3d10_rendertarget_view *)iface;
63 ULONG refcount = InterlockedDecrement(&This->refcount);
65 TRACE("%p decreasing refcount to %u\n", This, refcount);
69 IWineD3DRendertargetView_Release(This->wined3d_view);
70 HeapFree(GetProcessHeap(), 0, This);
76 /* ID3D10DeviceChild methods */
78 static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetDevice(ID3D10RenderTargetView *iface, ID3D10Device **device)
80 FIXME("iface %p, device %p stub!\n", iface, device);
83 static HRESULT STDMETHODCALLTYPE d3d10_rendertarget_view_GetPrivateData(ID3D10RenderTargetView *iface,
84 REFGUID guid, UINT *data_size, void *data)
86 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
87 iface, debugstr_guid(guid), data_size, data);
92 static HRESULT STDMETHODCALLTYPE d3d10_rendertarget_view_SetPrivateData(ID3D10RenderTargetView *iface,
93 REFGUID guid, UINT data_size, const void *data)
95 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
96 iface, debugstr_guid(guid), data_size, data);
101 static HRESULT STDMETHODCALLTYPE d3d10_rendertarget_view_SetPrivateDataInterface(ID3D10RenderTargetView *iface,
102 REFGUID guid, const IUnknown *data)
104 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
109 /* ID3D10View methods */
111 static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetResource(ID3D10RenderTargetView *iface,
112 ID3D10Resource **resource)
114 struct d3d10_rendertarget_view *This = (struct d3d10_rendertarget_view *)iface;
115 IWineD3DResource *wined3d_resource;
119 TRACE("iface %p, resource %p\n", iface, resource);
121 hr = IWineD3DRendertargetView_GetResource(This->wined3d_view, &wined3d_resource);
124 ERR("Failed to get wined3d resource, hr %#x\n", hr);
129 hr = IWineD3DResource_GetParent(wined3d_resource, &parent);
130 IWineD3DResource_Release(wined3d_resource);
133 ERR("Failed to get wined3d resource parent, hr %#x\n", hr);
138 hr = IUnknown_QueryInterface(parent, &IID_ID3D10Resource, (void **)&resource);
139 IUnknown_Release(parent);
142 ERR("Resource parent isn't a d3d10 resource, hr %#x\n", hr);
148 /* ID3D10RenderTargetView methods */
150 static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetDesc(ID3D10RenderTargetView* iface,
151 D3D10_RENDER_TARGET_VIEW_DESC *desc)
153 struct d3d10_rendertarget_view *This = (struct d3d10_rendertarget_view *)iface;
155 TRACE("iface %p, desc %p\n", iface, desc);
160 const struct ID3D10RenderTargetViewVtbl d3d10_rendertarget_view_vtbl =
162 /* IUnknown methods */
163 d3d10_rendertarget_view_QueryInterface,
164 d3d10_rendertarget_view_AddRef,
165 d3d10_rendertarget_view_Release,
166 /* ID3D10DeviceChild methods */
167 d3d10_rendertarget_view_GetDevice,
168 d3d10_rendertarget_view_GetPrivateData,
169 d3d10_rendertarget_view_SetPrivateData,
170 d3d10_rendertarget_view_SetPrivateDataInterface,
171 /* ID3D10View methods */
172 d3d10_rendertarget_view_GetResource,
173 /* ID3D10RenderTargetView methods */
174 d3d10_rendertarget_view_GetDesc,