d3d10core: Implement d3d10_rasterizer_state_GetDesc().
[wine] / dlls / d3d10core / async.c
1 /*
2  * Copyright 2009 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 "d3d10core_private.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
26
27 static inline struct d3d10_query *impl_from_ID3D10Query(ID3D10Query *iface)
28 {
29     return CONTAINING_RECORD(iface, struct d3d10_query, ID3D10Query_iface);
30 }
31
32 /* IUnknown methods */
33
34 static HRESULT STDMETHODCALLTYPE d3d10_query_QueryInterface(ID3D10Query *iface, REFIID riid, void **object)
35 {
36     TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
37
38     if (IsEqualGUID(riid, &IID_ID3D10Query)
39             || IsEqualGUID(riid, &IID_ID3D10Asynchronous)
40             || IsEqualGUID(riid, &IID_ID3D10DeviceChild)
41             || IsEqualGUID(riid, &IID_IUnknown))
42     {
43         IUnknown_AddRef(iface);
44         *object = iface;
45         return S_OK;
46     }
47
48     WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
49
50     *object = NULL;
51     return E_NOINTERFACE;
52 }
53
54 static ULONG STDMETHODCALLTYPE d3d10_query_AddRef(ID3D10Query *iface)
55 {
56     struct d3d10_query *This = impl_from_ID3D10Query(iface);
57     ULONG refcount = InterlockedIncrement(&This->refcount);
58
59     TRACE("%p increasing refcount to %u.\n", This, refcount);
60
61     return refcount;
62 }
63
64 static ULONG STDMETHODCALLTYPE d3d10_query_Release(ID3D10Query *iface)
65 {
66     struct d3d10_query *This = impl_from_ID3D10Query(iface);
67     ULONG refcount = InterlockedDecrement(&This->refcount);
68
69     TRACE("%p decreasing refcount to %u.\n", This, refcount);
70
71     if (!refcount)
72     {
73         HeapFree(GetProcessHeap(), 0, This);
74     }
75
76     return refcount;
77 }
78
79 /* ID3D10DeviceChild methods */
80
81 static void STDMETHODCALLTYPE d3d10_query_GetDevice(ID3D10Query *iface, ID3D10Device **device)
82 {
83     FIXME("iface %p, device %p stub!\n", iface, device);
84 }
85
86 static HRESULT STDMETHODCALLTYPE d3d10_query_GetPrivateData(ID3D10Query *iface,
87         REFGUID guid, UINT *data_size, void *data)
88 {
89     FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
90             iface, debugstr_guid(guid), data_size, data);
91
92     return E_NOTIMPL;
93 }
94
95 static HRESULT STDMETHODCALLTYPE d3d10_query_SetPrivateData(ID3D10Query *iface,
96         REFGUID guid, UINT data_size, const void *data)
97 {
98     FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
99             iface, debugstr_guid(guid), data_size, data);
100
101     return E_NOTIMPL;
102 }
103
104 static HRESULT STDMETHODCALLTYPE d3d10_query_SetPrivateDataInterface(ID3D10Query *iface,
105         REFGUID guid, const IUnknown *data)
106 {
107     FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
108
109     return E_NOTIMPL;
110 }
111
112 /* ID3D10Asynchronous methods */
113
114 static void STDMETHODCALLTYPE d3d10_query_Begin(ID3D10Query *iface)
115 {
116     FIXME("iface %p stub!\n", iface);
117 }
118
119 static void STDMETHODCALLTYPE d3d10_query_End(ID3D10Query *iface)
120 {
121     FIXME("iface %p stub!\n", iface);
122 }
123
124 static HRESULT STDMETHODCALLTYPE d3d10_query_GetData(ID3D10Query *iface, void *data, UINT data_size, UINT flags)
125 {
126     FIXME("iface %p, data %p, data_size %u, flags %#x stub!\n", iface, data, data_size, flags);
127
128     return E_NOTIMPL;
129 }
130
131 static UINT STDMETHODCALLTYPE d3d10_query_GetDataSize(ID3D10Query *iface)
132 {
133     FIXME("iface %p stub!\n", iface);
134
135     return 0;
136 }
137
138 /* ID3D10Query methods */
139
140 static void STDMETHODCALLTYPE d3d10_query_GetDesc(ID3D10Query *iface, D3D10_QUERY_DESC *desc)
141 {
142     FIXME("iface %p, desc %p stub!\n", iface, desc);
143 }
144
145 static const struct ID3D10QueryVtbl d3d10_query_vtbl =
146 {
147     /* IUnknown methods */
148     d3d10_query_QueryInterface,
149     d3d10_query_AddRef,
150     d3d10_query_Release,
151     /* ID3D10DeviceChild methods */
152     d3d10_query_GetDevice,
153     d3d10_query_GetPrivateData,
154     d3d10_query_SetPrivateData,
155     d3d10_query_SetPrivateDataInterface,
156     /* ID3D10Asynchronous methods */
157     d3d10_query_Begin,
158     d3d10_query_End,
159     d3d10_query_GetData,
160     d3d10_query_GetDataSize,
161     /* ID3D10Query methods */
162     d3d10_query_GetDesc,
163 };
164
165 HRESULT d3d10_query_init(struct d3d10_query *query)
166 {
167     query->ID3D10Query_iface.lpVtbl = &d3d10_query_vtbl;
168     query->refcount = 1;
169
170     return S_OK;
171 }