jscript: Pass global object as this if 'this' argument is null or undefined in Functi...
[wine/multimedia.git] / dlls / wined3d / query.c
blob76f519dd04f1f052dfa0595f932dcd763a3894ed
1 /*
2 * IWineD3DQuery implementation
4 * Copyright 2005 Oliver Stieber
5 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
6 * Copyright 2009 Henri Verbeet for CodeWeavers.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "config.h"
25 #include "wined3d_private.h"
28 * Occlusion Queries:
29 * http://www.gris.uni-tuebingen.de/~bartz/Publications/paper/hww98.pdf
30 * http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
33 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
34 #define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
36 /* *******************************************
37 IWineD3DQuery IUnknown parts follow
38 ******************************************* */
39 static HRESULT WINAPI IWineD3DQueryImpl_QueryInterface(IWineD3DQuery *iface, REFIID riid, LPVOID *ppobj)
41 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
42 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
43 if (IsEqualGUID(riid, &IID_IUnknown)
44 || IsEqualGUID(riid, &IID_IWineD3DBase)
45 || IsEqualGUID(riid, &IID_IWineD3DQuery)) {
46 IUnknown_AddRef(iface);
47 *ppobj = This;
48 return S_OK;
50 *ppobj = NULL;
51 return E_NOINTERFACE;
54 static ULONG WINAPI IWineD3DQueryImpl_AddRef(IWineD3DQuery *iface) {
55 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
56 TRACE("(%p) : AddRef increasing from %d\n", This, This->ref);
57 return InterlockedIncrement(&This->ref);
60 static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
61 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
62 ULONG ref;
63 TRACE("(%p) : Releasing from %d\n", This, This->ref);
64 ref = InterlockedDecrement(&This->ref);
65 if (ref == 0) {
66 /* Queries are specific to the GL context that created them. Not
67 * deleting the query will obviously leak it, but that's still better
68 * than potentially deleting a different query with the same id in this
69 * context, and (still) leaking the actual query. */
70 if (This->type == WINED3DQUERYTYPE_EVENT)
72 struct wined3d_event_query *query = This->extendedData;
74 if (query->context) context_free_event_query(query);
76 else if (This->type == WINED3DQUERYTYPE_OCCLUSION)
78 struct wined3d_occlusion_query *query = This->extendedData;
80 if (query->context) context_free_occlusion_query(query);
83 HeapFree(GetProcessHeap(), 0, This->extendedData);
84 HeapFree(GetProcessHeap(), 0, This);
86 return ref;
89 /* *******************************************
90 IWineD3DQuery IWineD3DQuery parts follow
91 ******************************************* */
92 static HRESULT WINAPI IWineD3DQueryImpl_GetParent(IWineD3DQuery *iface, IUnknown** parent){
93 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
95 *parent= (IUnknown*) parent;
96 IUnknown_AddRef(*parent);
97 TRACE("(%p) : returning %p\n", This, *parent);
98 return WINED3D_OK;
101 static HRESULT WINAPI IWineD3DQueryImpl_GetDevice(IWineD3DQuery* iface, IWineD3DDevice **pDevice){
102 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
103 IWineD3DDevice_AddRef((IWineD3DDevice *)This->wineD3DDevice);
104 *pDevice = (IWineD3DDevice *)This->wineD3DDevice;
105 TRACE("(%p) returning %p\n", This, *pDevice);
106 return WINED3D_OK;
110 static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags){
111 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
112 HRESULT res = S_OK;
114 TRACE("(%p) : type %#x, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, This->type, pData, dwSize, dwGetDataFlags);
116 switch (This->type){
118 case WINED3DQUERYTYPE_VCACHE:
121 WINED3DDEVINFO_VCACHE *data = pData;
122 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VCACHE\n", This);
123 if(pData == NULL || dwSize == 0) break;
124 data->Pattern = WINEMAKEFOURCC('C','A','C','H');
125 data->OptMethod = 0; /*0 get longest strips, 1 optimize vertex cache*/
126 data->CacheSize = 0; /*cache size, only required if OptMethod == 1*/
127 data->MagicNumber = 0; /*only required if OptMethod == 1 (used internally)*/
130 break;
131 case WINED3DQUERYTYPE_RESOURCEMANAGER:
133 WINED3DDEVINFO_RESOURCEMANAGER *data = pData;
134 int i;
135 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_RESOURCEMANAGER\n", This);
136 if(pData == NULL || dwSize == 0) break;
137 for(i = 0; i < WINED3DRTYPECOUNT; i++){
138 /*I'm setting the default values to 1 so as to reduce the risk of a div/0 in the caller*/
139 /* isTextureResident could be used to get some of this information */
140 data->stats[i].bThrashing = FALSE;
141 data->stats[i].ApproxBytesDownloaded = 1;
142 data->stats[i].NumEvicts = 1;
143 data->stats[i].NumVidCreates = 1;
144 data->stats[i].LastPri = 1;
145 data->stats[i].NumUsed = 1;
146 data->stats[i].NumUsedInVidMem = 1;
147 data->stats[i].WorkingSet = 1;
148 data->stats[i].WorkingSetBytes = 1;
149 data->stats[i].TotalManaged = 1;
150 data->stats[i].TotalBytes = 1;
154 break;
155 case WINED3DQUERYTYPE_VERTEXSTATS:
157 WINED3DDEVINFO_VERTEXSTATS *data = pData;
158 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VERTEXSTATS\n", This);
159 if(pData == NULL || dwSize == 0) break;
160 data->NumRenderedTriangles = 1;
161 data->NumExtraClippingTriangles = 1;
164 break;
165 case WINED3DQUERYTYPE_TIMESTAMP:
167 UINT64* data = pData;
168 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMP\n", This);
169 if(pData == NULL || dwSize == 0) break;
170 *data = 1; /*Don't know what this is supposed to be*/
172 break;
173 case WINED3DQUERYTYPE_TIMESTAMPDISJOINT:
175 BOOL* data = pData;
176 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMPDISJOINT\n", This);
177 if(pData == NULL || dwSize == 0) break;
178 *data = FALSE; /*Don't know what this is supposed to be*/
180 break;
181 case WINED3DQUERYTYPE_TIMESTAMPFREQ:
183 UINT64* data = pData;
184 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMPFREQ\n", This);
185 if(pData == NULL || dwSize == 0) break;
186 *data = 1; /*Don't know what this is supposed to be*/
188 break;
189 case WINED3DQUERYTYPE_PIPELINETIMINGS:
191 WINED3DDEVINFO_PIPELINETIMINGS *data = pData;
192 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_PIPELINETIMINGS\n", This);
193 if(pData == NULL || dwSize == 0) break;
195 data->VertexProcessingTimePercent = 1.0f;
196 data->PixelProcessingTimePercent = 1.0f;
197 data->OtherGPUProcessingTimePercent = 97.0f;
198 data->GPUIdleTimePercent = 1.0f;
200 break;
201 case WINED3DQUERYTYPE_INTERFACETIMINGS:
203 WINED3DDEVINFO_INTERFACETIMINGS *data = pData;
204 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_INTERFACETIMINGS\n", This);
206 if(pData == NULL || dwSize == 0) break;
207 data->WaitingForGPUToUseApplicationResourceTimePercent = 1.0f;
208 data->WaitingForGPUToAcceptMoreCommandsTimePercent = 1.0f;
209 data->WaitingForGPUToStayWithinLatencyTimePercent = 1.0f;
210 data->WaitingForGPUExclusiveResourceTimePercent = 1.0f;
211 data->WaitingForGPUOtherTimePercent = 96.0f;
214 break;
215 case WINED3DQUERYTYPE_VERTEXTIMINGS:
217 WINED3DDEVINFO_STAGETIMINGS *data = pData;
218 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VERTEXTIMINGS\n", This);
220 if(pData == NULL || dwSize == 0) break;
221 data->MemoryProcessingPercent = 50.0f;
222 data->ComputationProcessingPercent = 50.0f;
225 break;
226 case WINED3DQUERYTYPE_PIXELTIMINGS:
228 WINED3DDEVINFO_STAGETIMINGS *data = pData;
229 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_PIXELTIMINGS\n", This);
231 if(pData == NULL || dwSize == 0) break;
232 data->MemoryProcessingPercent = 50.0f;
233 data->ComputationProcessingPercent = 50.0f;
235 break;
236 case WINED3DQUERYTYPE_BANDWIDTHTIMINGS:
238 WINED3DDEVINFO_BANDWIDTHTIMINGS *data = pData;
239 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_BANDWIDTHTIMINGS\n", This);
241 if(pData == NULL || dwSize == 0) break;
242 data->MaxBandwidthUtilized = 1.0f;
243 data->FrontEndUploadMemoryUtilizedPercent = 1.0f;
244 data->VertexRateUtilizedPercent = 1.0f;
245 data->TriangleSetupRateUtilizedPercent = 1.0f;
246 data->FillRateUtilizedPercent = 97.0f;
248 break;
249 case WINED3DQUERYTYPE_CACHEUTILIZATION:
251 WINED3DDEVINFO_CACHEUTILIZATION *data = pData;
252 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_CACHEUTILIZATION\n", This);
254 if(pData == NULL || dwSize == 0) break;
255 data->TextureCacheHitRate = 1.0f;
256 data->PostTransformVertexCacheHitRate = 1.0f;
260 break;
261 default:
262 FIXME("(%p) Unhandled query type %d\n",This , This->type);
266 /*dwGetDataFlags = 0 || D3DGETDATA_FLUSH
267 D3DGETDATA_FLUSH may return WINED3DERR_DEVICELOST if the device is lost
269 return res; /* S_OK if the query data is available*/
272 static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
273 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
274 struct wined3d_occlusion_query *query = This->extendedData;
275 IWineD3DDeviceImpl *device = This->wineD3DDevice;
276 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
277 struct wined3d_context *context;
278 DWORD* data = pData;
279 GLuint available;
280 GLuint samples;
281 HRESULT res;
283 TRACE("(%p) : type D3DQUERY_OCCLUSION, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
285 if (!query->context) This->state = QUERY_CREATED;
287 if (This->state == QUERY_CREATED)
289 /* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves */
290 TRACE("Query wasn't yet started, returning S_OK\n");
291 if(data) *data = 0;
292 return S_OK;
295 if (This->state == QUERY_BUILDING)
297 /* Msdn says this returns an error, but our tests show that S_FALSE is returned */
298 TRACE("Query is building, returning S_FALSE\n");
299 return S_FALSE;
302 if (!gl_info->supported[ARB_OCCLUSION_QUERY])
304 WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This);
305 *data = 1;
306 return S_OK;
309 if (query->context->tid != GetCurrentThreadId())
311 FIXME("%p Wrong thread, returning 1.\n", This);
312 *data = 1;
313 return S_OK;
316 context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
318 ENTER_GL();
320 GL_EXTCALL(glGetQueryObjectuivARB(query->id, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
321 checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)");
322 TRACE("(%p) : available %d.\n", This, available);
324 if (available)
326 if (data)
328 GL_EXTCALL(glGetQueryObjectuivARB(query->id, GL_QUERY_RESULT_ARB, &samples));
329 checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)");
330 TRACE("(%p) : Returning %d samples.\n", This, samples);
331 *data = samples;
333 res = S_OK;
335 else
337 res = S_FALSE;
340 LEAVE_GL();
342 context_release(context);
344 return res;
347 static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
348 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
349 struct wined3d_event_query *query = This->extendedData;
350 struct wined3d_context *context;
351 BOOL *data = pData;
353 TRACE("(%p) : type D3DQUERY_EVENT, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
355 if (!pData || !dwSize) return S_OK;
357 if (!query->context)
359 ERR("Query not started, returning TRUE.\n");
360 *data = TRUE;
362 return S_OK;
365 if (query->context->tid != GetCurrentThreadId())
367 /* See comment in IWineD3DQuery::Issue, event query codeblock */
368 FIXME("Wrong thread, reporting GPU idle.\n");
369 *data = TRUE;
371 return S_OK;
374 context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
376 ENTER_GL();
378 if (context->gl_info->supported[APPLE_FENCE])
380 *data = GL_EXTCALL(glTestFenceAPPLE(query->id));
381 checkGLcall("glTestFenceAPPLE");
383 else if (context->gl_info->supported[NV_FENCE])
385 *data = GL_EXTCALL(glTestFenceNV(query->id));
386 checkGLcall("glTestFenceNV");
388 else
390 WARN("(%p): reporting GPU idle\n", This);
391 *data = TRUE;
394 LEAVE_GL();
396 context_release(context);
398 return S_OK;
401 static DWORD WINAPI IWineD3DQueryImpl_GetDataSize(IWineD3DQuery* iface){
402 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
403 int dataSize = 0;
404 TRACE("(%p) : type %#x\n", This, This->type);
405 switch(This->type){
406 case WINED3DQUERYTYPE_VCACHE:
407 dataSize = sizeof(WINED3DDEVINFO_VCACHE);
408 break;
409 case WINED3DQUERYTYPE_RESOURCEMANAGER:
410 dataSize = sizeof(WINED3DDEVINFO_RESOURCEMANAGER);
411 break;
412 case WINED3DQUERYTYPE_VERTEXSTATS:
413 dataSize = sizeof(WINED3DDEVINFO_VERTEXSTATS);
414 break;
415 case WINED3DQUERYTYPE_EVENT:
416 dataSize = sizeof(BOOL);
417 break;
418 case WINED3DQUERYTYPE_TIMESTAMP:
419 dataSize = sizeof(UINT64);
420 break;
421 case WINED3DQUERYTYPE_TIMESTAMPDISJOINT:
422 dataSize = sizeof(BOOL);
423 break;
424 case WINED3DQUERYTYPE_TIMESTAMPFREQ:
425 dataSize = sizeof(UINT64);
426 break;
427 case WINED3DQUERYTYPE_PIPELINETIMINGS:
428 dataSize = sizeof(WINED3DDEVINFO_PIPELINETIMINGS);
429 break;
430 case WINED3DQUERYTYPE_INTERFACETIMINGS:
431 dataSize = sizeof(WINED3DDEVINFO_INTERFACETIMINGS);
432 break;
433 case WINED3DQUERYTYPE_VERTEXTIMINGS:
434 dataSize = sizeof(WINED3DDEVINFO_STAGETIMINGS);
435 break;
436 case WINED3DQUERYTYPE_PIXELTIMINGS:
437 dataSize = sizeof(WINED3DDEVINFO_STAGETIMINGS);
438 break;
439 case WINED3DQUERYTYPE_BANDWIDTHTIMINGS:
440 dataSize = sizeof(WINED3DQUERYTYPE_BANDWIDTHTIMINGS);
441 break;
442 case WINED3DQUERYTYPE_CACHEUTILIZATION:
443 dataSize = sizeof(WINED3DDEVINFO_CACHEUTILIZATION);
444 break;
445 default:
446 FIXME("(%p) Unhandled query type %d\n",This , This->type);
447 dataSize = 0;
449 return dataSize;
452 static DWORD WINAPI IWineD3DEventQueryImpl_GetDataSize(IWineD3DQuery* iface){
453 TRACE("(%p) : type D3DQUERY_EVENT\n", iface);
455 return sizeof(BOOL);
458 static DWORD WINAPI IWineD3DOcclusionQueryImpl_GetDataSize(IWineD3DQuery* iface){
459 TRACE("(%p) : type D3DQUERY_OCCLUSION\n", iface);
461 return sizeof(DWORD);
464 static WINED3DQUERYTYPE WINAPI IWineD3DQueryImpl_GetType(IWineD3DQuery* iface){
465 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
466 return This->type;
470 static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
471 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
473 TRACE("(%p) : dwIssueFlags %#x, type D3DQUERY_EVENT\n", This, dwIssueFlags);
474 if (dwIssueFlags & WINED3DISSUE_END)
476 struct wined3d_event_query *query = This->extendedData;
477 struct wined3d_context *context;
479 if (query->context)
481 if (query->context->tid != GetCurrentThreadId())
483 context_free_event_query(query);
484 context = context_acquire(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);
485 context_alloc_event_query(context, query);
487 else
489 context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
492 else
494 context = context_acquire(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);
495 context_alloc_event_query(context, query);
498 ENTER_GL();
500 if (context->gl_info->supported[APPLE_FENCE])
502 GL_EXTCALL(glSetFenceAPPLE(query->id));
503 checkGLcall("glSetFenceAPPLE");
505 else if (context->gl_info->supported[NV_FENCE])
507 GL_EXTCALL(glSetFenceNV(query->id, GL_ALL_COMPLETED_NV));
508 checkGLcall("glSetFenceNV");
511 LEAVE_GL();
513 context_release(context);
515 else if(dwIssueFlags & WINED3DISSUE_BEGIN)
517 /* Started implicitly at device creation */
518 ERR("Event query issued with START flag - what to do?\n");
521 if(dwIssueFlags & WINED3DISSUE_BEGIN) {
522 This->state = QUERY_BUILDING;
523 } else {
524 This->state = QUERY_SIGNALLED;
527 return WINED3D_OK;
530 static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
531 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
532 IWineD3DDeviceImpl *device = This->wineD3DDevice;
533 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
535 if (gl_info->supported[ARB_OCCLUSION_QUERY])
537 struct wined3d_occlusion_query *query = This->extendedData;
538 struct wined3d_context *context;
540 /* This is allowed according to msdn and our tests. Reset the query and restart */
541 if (dwIssueFlags & WINED3DISSUE_BEGIN)
543 if (This->state == QUERY_BUILDING)
545 if (query->context->tid != GetCurrentThreadId())
547 FIXME("Wrong thread, can't restart query.\n");
549 context_free_occlusion_query(query);
550 context = context_acquire(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);
551 context_alloc_occlusion_query(context, query);
553 else
555 context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
557 ENTER_GL();
558 GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
559 checkGLcall("glEndQuery()");
560 LEAVE_GL();
563 else
565 if (query->context) context_free_occlusion_query(query);
566 context = context_acquire(This->wineD3DDevice, NULL, CTXUSAGE_RESOURCELOAD);
567 context_alloc_occlusion_query(context, query);
570 ENTER_GL();
571 GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, query->id));
572 checkGLcall("glBeginQuery()");
573 LEAVE_GL();
575 context_release(context);
577 if (dwIssueFlags & WINED3DISSUE_END) {
578 /* Msdn says _END on a non-building occlusion query returns an error, but
579 * our tests show that it returns OK. But OpenGL doesn't like it, so avoid
580 * generating an error
582 if (This->state == QUERY_BUILDING)
584 if (query->context->tid != GetCurrentThreadId())
586 FIXME("Wrong thread, can't end query.\n");
588 else
590 context = context_acquire(This->wineD3DDevice, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
592 ENTER_GL();
593 GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
594 checkGLcall("glEndQuery()");
595 LEAVE_GL();
597 context_release(context);
601 } else {
602 FIXME("(%p) : Occlusion queries not supported\n", This);
605 if(dwIssueFlags & WINED3DISSUE_BEGIN) {
606 This->state = QUERY_BUILDING;
607 } else {
608 This->state = QUERY_SIGNALLED;
610 return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */
613 static HRESULT WINAPI IWineD3DQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags){
614 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
616 TRACE("(%p) : dwIssueFlags %#x, type %#x\n", This, dwIssueFlags, This->type);
618 /* The fixme is printed when the app asks for the resulting data */
619 WARN("(%p) : Unhandled query type %#x\n", This, This->type);
621 if(dwIssueFlags & WINED3DISSUE_BEGIN) {
622 This->state = QUERY_BUILDING;
623 } else {
624 This->state = QUERY_SIGNALLED;
627 return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */
631 /**********************************************************
632 * IWineD3DQuery VTbl follows
633 **********************************************************/
635 const IWineD3DQueryVtbl IWineD3DQuery_Vtbl =
637 /*** IUnknown methods ***/
638 IWineD3DQueryImpl_QueryInterface,
639 IWineD3DQueryImpl_AddRef,
640 IWineD3DQueryImpl_Release,
641 /*** IWineD3Dquery methods ***/
642 IWineD3DQueryImpl_GetParent,
643 IWineD3DQueryImpl_GetDevice,
644 IWineD3DQueryImpl_GetData,
645 IWineD3DQueryImpl_GetDataSize,
646 IWineD3DQueryImpl_GetType,
647 IWineD3DQueryImpl_Issue
650 const IWineD3DQueryVtbl IWineD3DEventQuery_Vtbl =
652 /*** IUnknown methods ***/
653 IWineD3DQueryImpl_QueryInterface,
654 IWineD3DQueryImpl_AddRef,
655 IWineD3DQueryImpl_Release,
656 /*** IWineD3Dquery methods ***/
657 IWineD3DQueryImpl_GetParent,
658 IWineD3DQueryImpl_GetDevice,
659 IWineD3DEventQueryImpl_GetData,
660 IWineD3DEventQueryImpl_GetDataSize,
661 IWineD3DQueryImpl_GetType,
662 IWineD3DEventQueryImpl_Issue
665 const IWineD3DQueryVtbl IWineD3DOcclusionQuery_Vtbl =
667 /*** IUnknown methods ***/
668 IWineD3DQueryImpl_QueryInterface,
669 IWineD3DQueryImpl_AddRef,
670 IWineD3DQueryImpl_Release,
671 /*** IWineD3Dquery methods ***/
672 IWineD3DQueryImpl_GetParent,
673 IWineD3DQueryImpl_GetDevice,
674 IWineD3DOcclusionQueryImpl_GetData,
675 IWineD3DOcclusionQueryImpl_GetDataSize,
676 IWineD3DQueryImpl_GetType,
677 IWineD3DOcclusionQueryImpl_Issue