wineesd.drv: Build a unique name so we can identify our stream.
[wine] / dlls / dxgi / adapter.c
1 /*
2  * Copyright 2008 Henri Verbeet for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  *
18  */
19
20 #include "config.h"
21 #include "wine/port.h"
22
23 #include "dxgi_private.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
26
27 /* IUnknown methods */
28
29 static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IWineDXGIAdapter *iface, REFIID riid, void **object)
30 {
31     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
32
33     if (IsEqualGUID(riid, &IID_IUnknown)
34             || IsEqualGUID(riid, &IID_IDXGIObject)
35             || IsEqualGUID(riid, &IID_IDXGIAdapter)
36             || IsEqualGUID(riid, &IID_IWineDXGIAdapter))
37     {
38         IUnknown_AddRef(iface);
39         *object = iface;
40         return S_OK;
41     }
42
43     WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
44
45     *object = NULL;
46     return E_NOINTERFACE;
47 }
48
49 static ULONG STDMETHODCALLTYPE dxgi_adapter_AddRef(IWineDXGIAdapter *iface)
50 {
51     struct dxgi_adapter *This = (struct dxgi_adapter *)iface;
52     ULONG refcount = InterlockedIncrement(&This->refcount);
53
54     TRACE("%p increasing refcount to %u\n", This, refcount);
55
56     return refcount;
57 }
58
59 static ULONG STDMETHODCALLTYPE dxgi_adapter_Release(IWineDXGIAdapter *iface)
60 {
61     struct dxgi_adapter *This = (struct dxgi_adapter *)iface;
62     ULONG refcount = InterlockedDecrement(&This->refcount);
63
64     TRACE("%p decreasing refcount to %u\n", This, refcount);
65
66     if (!refcount)
67     {
68         HeapFree(GetProcessHeap(), 0, This);
69     }
70
71     return refcount;
72 }
73
74 /* IDXGIObject methods */
75
76 static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateData(IWineDXGIAdapter *iface,
77         REFGUID guid, UINT data_size, const void *data)
78 {
79     FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
80
81     return E_NOTIMPL;
82 }
83
84 static HRESULT STDMETHODCALLTYPE dxgi_adapter_SetPrivateDataInterface(IWineDXGIAdapter *iface,
85         REFGUID guid, const IUnknown *object)
86 {
87     FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
88
89     return E_NOTIMPL;
90 }
91
92 static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetPrivateData(IWineDXGIAdapter *iface,
93         REFGUID guid, UINT *data_size, void *data)
94 {
95     FIXME("iface %p, guid %s, data_size %p, data %p stub!\n", iface, debugstr_guid(guid), data_size, data);
96
97     return E_NOTIMPL;
98 }
99
100 static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetParent(IWineDXGIAdapter *iface, REFIID riid, void **parent)
101 {
102     struct dxgi_adapter *This = (struct dxgi_adapter *)iface;
103
104     TRACE("iface %p, riid %s, parent %p\n", iface, debugstr_guid(riid), parent);
105
106     return IDXGIFactory_QueryInterface(This->parent, riid, parent);
107 }
108
109 /* IDXGIAdapter methods */
110
111 static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *iface,
112         UINT output_idx, IDXGIOutput **output)
113 {
114     FIXME("iface %p, output_idx %u, output %p stub!\n", iface, output_idx, output);
115
116     return E_NOTIMPL;
117 }
118
119 static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc)
120 {
121     FIXME("iface %p, desc %p stub!\n", iface, desc);
122
123     return E_NOTIMPL;
124 }
125
126 static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAdapter *iface,
127         REFGUID guid, LARGE_INTEGER *umd_version)
128 {
129     FIXME("iface %p, guid %s, umd_version %p stub!\n", iface, debugstr_guid(guid), umd_version);
130
131     return E_NOTIMPL;
132 }
133
134 /* IWineDXGIAdapter methods */
135
136 static UINT STDMETHODCALLTYPE dxgi_adapter_get_ordinal(IWineDXGIAdapter *iface)
137 {
138     struct dxgi_adapter *This = (struct dxgi_adapter *)iface;
139
140     TRACE("iface %p, returning %u\n", iface, This->ordinal);
141
142     return This->ordinal;
143 }
144
145 const struct IWineDXGIAdapterVtbl dxgi_adapter_vtbl =
146 {
147     /* IUnknown methods */
148     dxgi_adapter_QueryInterface,
149     dxgi_adapter_AddRef,
150     dxgi_adapter_Release,
151     /* IDXGIObject methods */
152     dxgi_adapter_SetPrivateData,
153     dxgi_adapter_SetPrivateDataInterface,
154     dxgi_adapter_GetPrivateData,
155     dxgi_adapter_GetParent,
156     /* IDXGIAdapter methods */
157     dxgi_adapter_EnumOutputs,
158     dxgi_adapter_GetDesc,
159     dxgi_adapter_CheckInterfaceSupport,
160     /* IWineDXGIAdapter methods */
161     dxgi_adapter_get_ordinal,
162 };