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_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
);
42 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid
));
48 static 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
);
58 static 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
);
67 HeapFree(GetProcessHeap(), 0, This
);
73 /* IDXGIObject methods */
75 static 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
);
83 static 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
);
91 static 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
);
99 static 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
);
106 /* IDXGIFactory methods */
108 static 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
);
115 static 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
);
122 static HRESULT STDMETHODCALLTYPE
dxgi_factory_GetWindowAssociation(IDXGIFactory
*iface
, HWND
*window
)
124 FIXME("iface %p, window %p stub!\n", iface
, window
);
129 static HRESULT STDMETHODCALLTYPE
dxgi_factory_CreateSwapChain(IDXGIFactory
*iface
,
130 IUnknown
*device
, DXGI_SWAP_CHAIN_DESC
*desc
, IDXGISwapChain
**swapchain
)
132 struct dxgi_swapchain
*object
;
134 FIXME("iface %p, device %p, desc %p, swapchain %p partial stub!\n", iface
, device
, desc
, swapchain
);
136 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
139 ERR("Failed to allocate DXGI swapchain object memory\n");
140 return E_OUTOFMEMORY
;
143 object
->vtbl
= &dxgi_swapchain_vtbl
;
144 object
->refcount
= 1;
145 *swapchain
= (IDXGISwapChain
*)object
;
147 TRACE("Created IDXGISwapChain %p\n", object
);
152 static HRESULT STDMETHODCALLTYPE
dxgi_factory_CreateSoftwareAdapter(IDXGIFactory
*iface
,
153 HMODULE swrast
, IDXGIAdapter
**adapter
)
155 FIXME("iface %p, swrast %p, adapter %p stub!\n", iface
, swrast
, adapter
);
160 const struct IDXGIFactoryVtbl dxgi_factory_vtbl
=
162 /* IUnknown methods */
163 dxgi_factory_QueryInterface
,
165 dxgi_factory_Release
,
166 /* IDXGIObject methods */
167 dxgi_factory_SetPrivateData
,
168 dxgi_factory_SetPrivateDataInterface
,
169 dxgi_factory_GetPrivateData
,
170 dxgi_factory_GetParent
,
171 /* IDXGIFactory methods */
172 dxgi_factory_EnumAdapters
,
173 dxgi_factory_MakeWindowAssociation
,
174 dxgi_factory_GetWindowAssociation
,
175 dxgi_factory_CreateSwapChain
,
176 dxgi_factory_CreateSoftwareAdapter
,