d3d8/tests: Use a separate device for alpha_test().
[wine.git] / dlls / d3d10core / async.c
blob6d3442baf80a011017b4e10e36dcf0fb8c94b7a9
1 /*
2 * Copyright 2009 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 "d3d10core_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
27 static inline struct d3d10_query *impl_from_ID3D10Query(ID3D10Query *iface)
29 return CONTAINING_RECORD(iface, struct d3d10_query, ID3D10Query_iface);
32 /* IUnknown methods */
34 static HRESULT STDMETHODCALLTYPE d3d10_query_QueryInterface(ID3D10Query *iface, REFIID riid, void **object)
36 struct d3d10_query *query = impl_from_ID3D10Query(iface);
38 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
40 if ((IsEqualGUID(riid, &IID_ID3D10Predicate) && query->predicate)
41 || IsEqualGUID(riid, &IID_ID3D10Query)
42 || IsEqualGUID(riid, &IID_ID3D10Asynchronous)
43 || IsEqualGUID(riid, &IID_ID3D10DeviceChild)
44 || IsEqualGUID(riid, &IID_IUnknown))
46 IUnknown_AddRef(iface);
47 *object = iface;
48 return S_OK;
51 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
53 *object = NULL;
54 return E_NOINTERFACE;
57 static ULONG STDMETHODCALLTYPE d3d10_query_AddRef(ID3D10Query *iface)
59 struct d3d10_query *This = impl_from_ID3D10Query(iface);
60 ULONG refcount = InterlockedIncrement(&This->refcount);
62 TRACE("%p increasing refcount to %u.\n", This, refcount);
64 return refcount;
67 static ULONG STDMETHODCALLTYPE d3d10_query_Release(ID3D10Query *iface)
69 struct d3d10_query *This = impl_from_ID3D10Query(iface);
70 ULONG refcount = InterlockedDecrement(&This->refcount);
72 TRACE("%p decreasing refcount to %u.\n", This, refcount);
74 if (!refcount)
76 ID3D10Device1_Release(This->device);
77 HeapFree(GetProcessHeap(), 0, This);
80 return refcount;
83 /* ID3D10DeviceChild methods */
85 static void STDMETHODCALLTYPE d3d10_query_GetDevice(ID3D10Query *iface, ID3D10Device **device)
87 struct d3d10_query *query = impl_from_ID3D10Query(iface);
89 TRACE("iface %p, device %p.\n", iface, device);
91 *device = (ID3D10Device *)query->device;
92 ID3D10Device_AddRef(*device);
95 static HRESULT STDMETHODCALLTYPE d3d10_query_GetPrivateData(ID3D10Query *iface,
96 REFGUID guid, UINT *data_size, void *data)
98 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
99 iface, debugstr_guid(guid), data_size, data);
101 return E_NOTIMPL;
104 static HRESULT STDMETHODCALLTYPE d3d10_query_SetPrivateData(ID3D10Query *iface,
105 REFGUID guid, UINT data_size, const void *data)
107 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
108 iface, debugstr_guid(guid), data_size, data);
110 return E_NOTIMPL;
113 static HRESULT STDMETHODCALLTYPE d3d10_query_SetPrivateDataInterface(ID3D10Query *iface,
114 REFGUID guid, const IUnknown *data)
116 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
118 return E_NOTIMPL;
121 /* ID3D10Asynchronous methods */
123 static void STDMETHODCALLTYPE d3d10_query_Begin(ID3D10Query *iface)
125 FIXME("iface %p stub!\n", iface);
128 static void STDMETHODCALLTYPE d3d10_query_End(ID3D10Query *iface)
130 FIXME("iface %p stub!\n", iface);
133 static HRESULT STDMETHODCALLTYPE d3d10_query_GetData(ID3D10Query *iface, void *data, UINT data_size, UINT flags)
135 FIXME("iface %p, data %p, data_size %u, flags %#x stub!\n", iface, data, data_size, flags);
137 return E_NOTIMPL;
140 static UINT STDMETHODCALLTYPE d3d10_query_GetDataSize(ID3D10Query *iface)
142 FIXME("iface %p stub!\n", iface);
144 return 0;
147 /* ID3D10Query methods */
149 static void STDMETHODCALLTYPE d3d10_query_GetDesc(ID3D10Query *iface, D3D10_QUERY_DESC *desc)
151 FIXME("iface %p, desc %p stub!\n", iface, desc);
154 static const struct ID3D10QueryVtbl d3d10_query_vtbl =
156 /* IUnknown methods */
157 d3d10_query_QueryInterface,
158 d3d10_query_AddRef,
159 d3d10_query_Release,
160 /* ID3D10DeviceChild methods */
161 d3d10_query_GetDevice,
162 d3d10_query_GetPrivateData,
163 d3d10_query_SetPrivateData,
164 d3d10_query_SetPrivateDataInterface,
165 /* ID3D10Asynchronous methods */
166 d3d10_query_Begin,
167 d3d10_query_End,
168 d3d10_query_GetData,
169 d3d10_query_GetDataSize,
170 /* ID3D10Query methods */
171 d3d10_query_GetDesc,
174 HRESULT d3d10_query_init(struct d3d10_query *query, struct d3d10_device *device, BOOL predicate)
176 query->ID3D10Query_iface.lpVtbl = &d3d10_query_vtbl;
177 query->refcount = 1;
178 query->predicate = predicate;
179 query->device = &device->ID3D10Device1_iface;
180 ID3D10Device1_AddRef(query->device);
182 return S_OK;