dxgi: Implement CreateDXGIFactory().
[wine/hacks.git] / dlls / dxgi / factory.c
blobd9593e3b63bd458ed00b2d0d0a74e2eb5f844ca6
1 /*
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
20 #include "config.h"
21 #include "wine/port.h"
23 #include "dxgi_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
27 /* IUnknown methods */
29 HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IDXGIFactory* iface, REFIID riid, void **object)
31 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
33 if (IsEqualGUID(riid, &IID_IUnknown)
34 || IsEqualGUID(riid, &IID_IDXGIObject)
35 || IsEqualGUID(riid, &IID_IDXGIFactory))
37 IUnknown_AddRef(iface);
38 *object = iface;
39 return S_OK;
42 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
44 *object = NULL;
45 return E_NOINTERFACE;
48 ULONG STDMETHODCALLTYPE dxgi_factory_AddRef(IDXGIFactory* iface)
50 struct dxgi_factory *This = (struct dxgi_factory *)iface;
51 ULONG refcount = InterlockedIncrement(&This->refcount);
53 TRACE("%p increasing refcount to %u\n", This, refcount);
55 return refcount;
58 ULONG STDMETHODCALLTYPE dxgi_factory_Release(IDXGIFactory* iface)
60 struct dxgi_factory *This = (struct dxgi_factory *)iface;
61 ULONG refcount = InterlockedDecrement(&This->refcount);
63 TRACE("%p decreasing refcount to %u\n", This, refcount);
65 if (!refcount)
67 HeapFree(GetProcessHeap(), 0, This);
70 return refcount;
73 /* IDXGIObject methods */
75 HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateData(IDXGIFactory* iface,
76 REFGUID guid, UINT data_size, const void *data)
78 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
80 return E_NOTIMPL;
83 HRESULT STDMETHODCALLTYPE dxgi_factory_SetPrivateDataInterface(IDXGIFactory* iface,
84 REFGUID guid, const IUnknown *object)
86 FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
88 return E_NOTIMPL;
91 HRESULT STDMETHODCALLTYPE dxgi_factory_GetPrivateData(IDXGIFactory* iface,
92 REFGUID guid, UINT *data_size, void *data)
94 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
96 return E_NOTIMPL;
99 HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IDXGIFactory* iface, REFIID riid, void **parent)
101 FIXME("iface %p, riid %s, parent %p stub!\n", iface, debugstr_guid(riid), parent);
103 return E_NOTIMPL;
106 /* IDXGIFactory methods */
108 HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IDXGIFactory* iface, UINT adapter_idx, IDXGIAdapter **adapter)
110 FIXME("iface %p, adapter_idx %u, adapter %p stub!\n", iface, adapter_idx, adapter);
112 return E_NOTIMPL;
115 HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IDXGIFactory* iface, HWND window, UINT flags)
117 FIXME("iface %p, window %p, flags %#x stub!\n\n", iface, window, flags);
119 return E_NOTIMPL;
122 HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IDXGIFactory* iface, HWND *window)
124 FIXME("iface %p, window %p stub!\n", iface, window);
126 return E_NOTIMPL;
129 HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IDXGIFactory* iface,
130 IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
132 FIXME("iface %p, device %p, desc %p, swapchain %p stub!\n", iface, device, desc, swapchain);
134 return E_NOTIMPL;
137 HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IDXGIFactory* iface,
138 HMODULE swrast, IDXGIAdapter **adapter)
140 FIXME("iface %p, swrast %p, adapter %p stub!\n", iface, swrast, adapter);
142 return E_NOTIMPL;
145 const struct IDXGIFactoryVtbl dxgi_factory_vtbl =
147 /* IUnknown methods */
148 dxgi_factory_QueryInterface,
149 dxgi_factory_AddRef,
150 dxgi_factory_Release,
151 /* IDXGIObject methods */
152 dxgi_factory_SetPrivateData,
153 dxgi_factory_SetPrivateDataInterface,
154 dxgi_factory_GetPrivateData,
155 dxgi_factory_GetParent,
156 /* IDXGIFactory methods */
157 dxgi_factory_EnumAdapters,
158 dxgi_factory_MakeWindowAssociation,
159 dxgi_factory_GetWindowAssociation,
160 dxgi_factory_CreateSwapChain,
161 dxgi_factory_CreateSoftwareAdapter,