2 * Copyright 2008 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 "dxgi_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
27 /* IUnknown methods */
29 static HRESULT STDMETHODCALLTYPE dxgi_device_QueryInterface(IDXGIDevice *iface, REFIID riid, void **object)
31 struct dxgi_device *This = (struct dxgi_device *)iface;
33 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
35 if (IsEqualGUID(riid, &IID_IUnknown)
36 || IsEqualGUID(riid, &IID_IDXGIObject)
37 || IsEqualGUID(riid, &IID_IDXGIDevice))
39 IUnknown_AddRef(iface);
44 if (This->child_layer)
46 TRACE("forwarding to child layer %p\n", This->child_layer);
47 return IUnknown_QueryInterface(This->child_layer, riid, object);
50 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
56 static ULONG STDMETHODCALLTYPE dxgi_device_AddRef(IDXGIDevice *iface)
58 struct dxgi_device *This = (struct dxgi_device *)iface;
59 ULONG refcount = InterlockedIncrement(&This->refcount);
61 TRACE("%p increasing refcount to %u\n", This, refcount);
66 static ULONG STDMETHODCALLTYPE dxgi_device_Release(IDXGIDevice *iface)
68 struct dxgi_device *This = (struct dxgi_device *)iface;
69 ULONG refcount = InterlockedDecrement(&This->refcount);
71 TRACE("%p decreasing refcount to %u\n", This, refcount);
75 if (This->child_layer) IUnknown_Release(This->child_layer);
76 EnterCriticalSection(&dxgi_cs);
77 IWineD3DDevice_Release(This->wined3d_device);
78 LeaveCriticalSection(&dxgi_cs);
79 IWineDXGIFactory_Release(This->factory);
80 HeapFree(GetProcessHeap(), 0, This);
86 /* IDXGIObject methods */
88 static HRESULT STDMETHODCALLTYPE dxgi_device_SetPrivateData(IDXGIDevice *iface, REFGUID guid, UINT data_size, const void *data)
90 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
95 static HRESULT STDMETHODCALLTYPE dxgi_device_SetPrivateDataInterface(IDXGIDevice *iface, REFGUID guid, const IUnknown *object)
97 FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
102 static HRESULT STDMETHODCALLTYPE dxgi_device_GetPrivateData(IDXGIDevice *iface, REFGUID guid, UINT *data_size, void *data)
104 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
109 static HRESULT STDMETHODCALLTYPE dxgi_device_GetParent(IDXGIDevice *iface, REFIID riid, void **parent)
111 FIXME("iface %p, riid %s, parent %p stub!\n", iface, debugstr_guid(riid), parent);
116 /* IDXGIDevice methods */
118 static HRESULT STDMETHODCALLTYPE dxgi_device_GetAdapter(IDXGIDevice *iface, IDXGIAdapter **adapter)
120 FIXME("iface %p, adapter %p stub!\n", iface, adapter);
125 static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IDXGIDevice *iface,
126 const DXGI_SURFACE_DESC *desc, UINT surface_count, DXGI_USAGE usage,
127 const DXGI_SHARED_RESOURCE *shared_resource, IDXGISurface **surface)
129 FIXME("iface %p, desc %p, surface_count %u, usage %#x, shared_resource %p, surface %p stub!\n",
130 iface, desc, surface_count, usage, shared_resource, surface);
135 static HRESULT STDMETHODCALLTYPE dxgi_device_QueryResourceResidency(IDXGIDevice *iface,
136 IUnknown *const *resources, DXGI_RESIDENCY *residency, UINT resource_count)
138 FIXME("iface %p, resources %p, residency %p, resource_count %u stub!\n",
139 iface, resources, residency, resource_count);
144 static HRESULT STDMETHODCALLTYPE dxgi_device_SetGPUThreadPriority(IDXGIDevice *iface, INT priority)
146 FIXME("iface %p, priority %d stub!\n", iface, priority);
151 static HRESULT STDMETHODCALLTYPE dxgi_device_GetGPUThreadPriority(IDXGIDevice *iface, INT *priority)
153 FIXME("iface %p, priority %p stub!\n", iface, priority);
158 const struct IDXGIDeviceVtbl dxgi_device_vtbl =
160 /* IUnknown methods */
161 dxgi_device_QueryInterface,
164 /* IDXGIObject methods */
165 dxgi_device_SetPrivateData,
166 dxgi_device_SetPrivateDataInterface,
167 dxgi_device_GetPrivateData,
168 dxgi_device_GetParent,
169 /* IDXGIDevice methods */
170 dxgi_device_GetAdapter,
171 dxgi_device_CreateSurface,
172 dxgi_device_QueryResourceResidency,
173 dxgi_device_SetGPUThreadPriority,
174 dxgi_device_GetGPUThreadPriority,