d3d10core: Implement d3d10_device_CreatePredicate().
[wine/multimedia.git] / dlls / d3d10core / async.c
blobd5de9a9410c60b68a33e9b8a4096640f0c5dbca7
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 HeapFree(GetProcessHeap(), 0, This);
79 return refcount;
82 /* ID3D10DeviceChild methods */
84 static void STDMETHODCALLTYPE d3d10_query_GetDevice(ID3D10Query *iface, ID3D10Device **device)
86 FIXME("iface %p, device %p stub!\n", iface, device);
89 static HRESULT STDMETHODCALLTYPE d3d10_query_GetPrivateData(ID3D10Query *iface,
90 REFGUID guid, UINT *data_size, void *data)
92 FIXME("iface %p, guid %s, data_size %p, data %p stub!\n",
93 iface, debugstr_guid(guid), data_size, data);
95 return E_NOTIMPL;
98 static HRESULT STDMETHODCALLTYPE d3d10_query_SetPrivateData(ID3D10Query *iface,
99 REFGUID guid, UINT data_size, const void *data)
101 FIXME("iface %p, guid %s, data_size %u, data %p stub!\n",
102 iface, debugstr_guid(guid), data_size, data);
104 return E_NOTIMPL;
107 static HRESULT STDMETHODCALLTYPE d3d10_query_SetPrivateDataInterface(ID3D10Query *iface,
108 REFGUID guid, const IUnknown *data)
110 FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
112 return E_NOTIMPL;
115 /* ID3D10Asynchronous methods */
117 static void STDMETHODCALLTYPE d3d10_query_Begin(ID3D10Query *iface)
119 FIXME("iface %p stub!\n", iface);
122 static void STDMETHODCALLTYPE d3d10_query_End(ID3D10Query *iface)
124 FIXME("iface %p stub!\n", iface);
127 static HRESULT STDMETHODCALLTYPE d3d10_query_GetData(ID3D10Query *iface, void *data, UINT data_size, UINT flags)
129 FIXME("iface %p, data %p, data_size %u, flags %#x stub!\n", iface, data, data_size, flags);
131 return E_NOTIMPL;
134 static UINT STDMETHODCALLTYPE d3d10_query_GetDataSize(ID3D10Query *iface)
136 FIXME("iface %p stub!\n", iface);
138 return 0;
141 /* ID3D10Query methods */
143 static void STDMETHODCALLTYPE d3d10_query_GetDesc(ID3D10Query *iface, D3D10_QUERY_DESC *desc)
145 FIXME("iface %p, desc %p stub!\n", iface, desc);
148 static const struct ID3D10QueryVtbl d3d10_query_vtbl =
150 /* IUnknown methods */
151 d3d10_query_QueryInterface,
152 d3d10_query_AddRef,
153 d3d10_query_Release,
154 /* ID3D10DeviceChild methods */
155 d3d10_query_GetDevice,
156 d3d10_query_GetPrivateData,
157 d3d10_query_SetPrivateData,
158 d3d10_query_SetPrivateDataInterface,
159 /* ID3D10Asynchronous methods */
160 d3d10_query_Begin,
161 d3d10_query_End,
162 d3d10_query_GetData,
163 d3d10_query_GetDataSize,
164 /* ID3D10Query methods */
165 d3d10_query_GetDesc,
168 HRESULT d3d10_query_init(struct d3d10_query *query, BOOL predicate)
170 query->ID3D10Query_iface.lpVtbl = &d3d10_query_vtbl;
171 query->refcount = 1;
172 query->predicate = predicate;
174 return S_OK;