wininet: Fix sockets leak in FTP_Connect.
[wine.git] / dlls / wined3d / query.c
bloba24f513ab29d5060899d382a8ca14ca58d6165e8
1 /*
2 * IWineD3DQuery implementation
4 * Copyright 2005 Oliver Stieber
5 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "config.h"
24 #include "wined3d_private.h"
27 * Occlusion Queries:
28 * http://www.gris.uni-tuebingen.de/~bartz/Publications/paper/hww98.pdf
29 * http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
32 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
33 #define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
35 /* *******************************************
36 IWineD3DQuery IUnknown parts follow
37 ******************************************* */
38 static HRESULT WINAPI IWineD3DQueryImpl_QueryInterface(IWineD3DQuery *iface, REFIID riid, LPVOID *ppobj)
40 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
41 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
42 if (IsEqualGUID(riid, &IID_IUnknown)
43 || IsEqualGUID(riid, &IID_IWineD3DBase)
44 || IsEqualGUID(riid, &IID_IWineD3DQuery)) {
45 IUnknown_AddRef(iface);
46 *ppobj = This;
47 return S_OK;
49 *ppobj = NULL;
50 return E_NOINTERFACE;
53 static ULONG WINAPI IWineD3DQueryImpl_AddRef(IWineD3DQuery *iface) {
54 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
55 TRACE("(%p) : AddRef increasing from %d\n", This, This->ref);
56 return InterlockedIncrement(&This->ref);
59 static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
60 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
61 ULONG ref;
62 TRACE("(%p) : Releasing from %d\n", This, This->ref);
63 ref = InterlockedDecrement(&This->ref);
64 if (ref == 0) {
65 ActivateContext(This->wineD3DDevice, This->wineD3DDevice->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
67 ENTER_GL();
68 /* Queries are specific to the GL context that created them. Not
69 * deleting the query will obviously leak it, but that's still better
70 * than potentially deleting a different query with the same id in this
71 * context, and (still) leaking the actual query. */
72 if(This->type == WINED3DQUERYTYPE_EVENT) {
73 if (((WineQueryEventData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext
74 || This->wineD3DDevice->activeContext->tid != GetCurrentThreadId())
76 FIXME("Query was created in a different context, skipping deletion\n");
78 else if(GL_SUPPORT(APPLE_FENCE))
80 GL_EXTCALL(glDeleteFencesAPPLE(1, &((WineQueryEventData *)(This->extendedData))->fenceId));
81 checkGLcall("glDeleteFencesAPPLE");
82 } else if(GL_SUPPORT(NV_FENCE)) {
83 GL_EXTCALL(glDeleteFencesNV(1, &((WineQueryEventData *)(This->extendedData))->fenceId));
84 checkGLcall("glDeleteFencesNV");
86 } else if(This->type == WINED3DQUERYTYPE_OCCLUSION && GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
87 if (((WineQueryOcclusionData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext
88 || This->wineD3DDevice->activeContext->tid != GetCurrentThreadId())
90 FIXME("Query was created in a different context, skipping deletion\n");
92 else
94 GL_EXTCALL(glDeleteQueriesARB(1, &((WineQueryOcclusionData *)(This->extendedData))->queryId));
95 checkGLcall("glDeleteQueriesARB");
98 LEAVE_GL();
100 HeapFree(GetProcessHeap(), 0, This->extendedData);
101 HeapFree(GetProcessHeap(), 0, This);
103 return ref;
106 /* *******************************************
107 IWineD3DQuery IWineD3DQuery parts follow
108 ******************************************* */
109 static HRESULT WINAPI IWineD3DQueryImpl_GetParent(IWineD3DQuery *iface, IUnknown** parent){
110 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
112 *parent= (IUnknown*) parent;
113 IUnknown_AddRef(*parent);
114 TRACE("(%p) : returning %p\n", This, *parent);
115 return WINED3D_OK;
118 static HRESULT WINAPI IWineD3DQueryImpl_GetDevice(IWineD3DQuery* iface, IWineD3DDevice **pDevice){
119 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
120 IWineD3DDevice_AddRef((IWineD3DDevice *)This->wineD3DDevice);
121 *pDevice = (IWineD3DDevice *)This->wineD3DDevice;
122 TRACE("(%p) returning %p\n", This, *pDevice);
123 return WINED3D_OK;
127 static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags){
128 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
129 HRESULT res = S_OK;
131 TRACE("(%p) : type %#x, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, This->type, pData, dwSize, dwGetDataFlags);
133 switch (This->type){
135 case WINED3DQUERYTYPE_VCACHE:
138 WINED3DDEVINFO_VCACHE *data = pData;
139 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VCACHE\n", This);
140 if(pData == NULL || dwSize == 0) break;
141 data->Pattern = WINEMAKEFOURCC('C','A','C','H');
142 data->OptMethod = 0; /*0 get longest strips, 1 optimize vertex cache*/
143 data->CacheSize = 0; /*cache size, only required if OptMethod == 1*/
144 data->MagicNumber = 0; /*only required if OptMethod == 1 (used internally)*/
147 break;
148 case WINED3DQUERYTYPE_RESOURCEMANAGER:
150 WINED3DDEVINFO_RESOURCEMANAGER *data = pData;
151 int i;
152 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_RESOURCEMANAGER\n", This);
153 if(pData == NULL || dwSize == 0) break;
154 for(i = 0; i < WINED3DRTYPECOUNT; i++){
155 /*I'm setting the default values to 1 so as to reduce the risk of a div/0 in the caller*/
156 /* isTextureResident could be used to get some of this information */
157 data->stats[i].bThrashing = FALSE;
158 data->stats[i].ApproxBytesDownloaded = 1;
159 data->stats[i].NumEvicts = 1;
160 data->stats[i].NumVidCreates = 1;
161 data->stats[i].LastPri = 1;
162 data->stats[i].NumUsed = 1;
163 data->stats[i].NumUsedInVidMem = 1;
164 data->stats[i].WorkingSet = 1;
165 data->stats[i].WorkingSetBytes = 1;
166 data->stats[i].TotalManaged = 1;
167 data->stats[i].TotalBytes = 1;
171 break;
172 case WINED3DQUERYTYPE_VERTEXSTATS:
174 WINED3DDEVINFO_VERTEXSTATS *data = pData;
175 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VERTEXSTATS\n", This);
176 if(pData == NULL || dwSize == 0) break;
177 data->NumRenderedTriangles = 1;
178 data->NumExtraClippingTriangles = 1;
181 break;
182 case WINED3DQUERYTYPE_TIMESTAMP:
184 UINT64* data = pData;
185 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMP\n", This);
186 if(pData == NULL || dwSize == 0) break;
187 *data = 1; /*Don't know what this is supposed to be*/
189 break;
190 case WINED3DQUERYTYPE_TIMESTAMPDISJOINT:
192 BOOL* data = pData;
193 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMPDISJOINT\n", This);
194 if(pData == NULL || dwSize == 0) break;
195 *data = FALSE; /*Don't know what this is supposed to be*/
197 break;
198 case WINED3DQUERYTYPE_TIMESTAMPFREQ:
200 UINT64* data = pData;
201 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMPFREQ\n", This);
202 if(pData == NULL || dwSize == 0) break;
203 *data = 1; /*Don't know what this is supposed to be*/
205 break;
206 case WINED3DQUERYTYPE_PIPELINETIMINGS:
208 WINED3DDEVINFO_PIPELINETIMINGS *data = pData;
209 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_PIPELINETIMINGS\n", This);
210 if(pData == NULL || dwSize == 0) break;
212 data->VertexProcessingTimePercent = 1.0f;
213 data->PixelProcessingTimePercent = 1.0f;
214 data->OtherGPUProcessingTimePercent = 97.0f;
215 data->GPUIdleTimePercent = 1.0f;
217 break;
218 case WINED3DQUERYTYPE_INTERFACETIMINGS:
220 WINED3DDEVINFO_INTERFACETIMINGS *data = pData;
221 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_INTERFACETIMINGS\n", This);
223 if(pData == NULL || dwSize == 0) break;
224 data->WaitingForGPUToUseApplicationResourceTimePercent = 1.0f;
225 data->WaitingForGPUToAcceptMoreCommandsTimePercent = 1.0f;
226 data->WaitingForGPUToStayWithinLatencyTimePercent = 1.0f;
227 data->WaitingForGPUExclusiveResourceTimePercent = 1.0f;
228 data->WaitingForGPUOtherTimePercent = 96.0f;
231 break;
232 case WINED3DQUERYTYPE_VERTEXTIMINGS:
234 WINED3DDEVINFO_STAGETIMINGS *data = pData;
235 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VERTEXTIMINGS\n", This);
237 if(pData == NULL || dwSize == 0) break;
238 data->MemoryProcessingPercent = 50.0f;
239 data->ComputationProcessingPercent = 50.0f;
242 break;
243 case WINED3DQUERYTYPE_PIXELTIMINGS:
245 WINED3DDEVINFO_STAGETIMINGS *data = pData;
246 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_PIXELTIMINGS\n", This);
248 if(pData == NULL || dwSize == 0) break;
249 data->MemoryProcessingPercent = 50.0f;
250 data->ComputationProcessingPercent = 50.0f;
252 break;
253 case WINED3DQUERYTYPE_BANDWIDTHTIMINGS:
255 WINED3DDEVINFO_BANDWIDTHTIMINGS *data = pData;
256 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_BANDWIDTHTIMINGS\n", This);
258 if(pData == NULL || dwSize == 0) break;
259 data->MaxBandwidthUtilized = 1.0f;
260 data->FrontEndUploadMemoryUtilizedPercent = 1.0f;
261 data->VertexRateUtilizedPercent = 1.0f;
262 data->TriangleSetupRateUtilizedPercent = 1.0f;
263 data->FillRateUtilizedPercent = 97.0f;
265 break;
266 case WINED3DQUERYTYPE_CACHEUTILIZATION:
268 WINED3DDEVINFO_CACHEUTILIZATION *data = pData;
269 FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_CACHEUTILIZATION\n", This);
271 if(pData == NULL || dwSize == 0) break;
272 data->TextureCacheHitRate = 1.0f;
273 data->PostTransformVertexCacheHitRate = 1.0f;
277 break;
278 default:
279 FIXME("(%p) Unhandled query type %d\n",This , This->type);
283 /*dwGetDataFlags = 0 || D3DGETDATA_FLUSH
284 D3DGETDATA_FLUSH may return WINED3DERR_DEVICELOST if the device is lost
286 return res; /* S_OK if the query data is available*/
289 static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
290 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
291 GLuint queryId = ((WineQueryOcclusionData *)This->extendedData)->queryId;
292 DWORD* data = pData;
293 GLuint available;
294 GLuint samples;
295 HRESULT res;
297 TRACE("(%p) : type D3DQUERY_OCCLUSION, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
299 if (This->state == QUERY_CREATED)
301 /* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves */
302 TRACE("Query wasn't yet started, returning S_OK\n");
303 if(data) *data = 0;
304 return S_OK;
307 if (This->state == QUERY_BUILDING)
309 /* Msdn says this returns an error, but our tests show that S_FALSE is returned */
310 TRACE("Query is building, returning S_FALSE\n");
311 return S_FALSE;
314 if (!GL_SUPPORT(ARB_OCCLUSION_QUERY))
316 WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This);
317 *data = 1;
318 return S_OK;
321 ActivateContext(This->wineD3DDevice, This->wineD3DDevice->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
323 if (((WineQueryOcclusionData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext
324 || This->wineD3DDevice->activeContext->tid != GetCurrentThreadId())
326 FIXME("%p Wrong context, returning 1.\n", This);
327 *data = 1;
328 return S_OK;
331 ENTER_GL();
333 GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
334 checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)\n");
335 TRACE("(%p) : available %d.\n", This, available);
337 if (available)
339 if (data)
341 GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_ARB, &samples));
342 checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)\n");
343 TRACE("(%p) : Returning %d samples.\n", This, samples);
344 *data = samples;
346 res = S_OK;
348 else
350 res = S_FALSE;
353 LEAVE_GL();
355 return res;
358 static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
359 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
360 BOOL* data = pData;
361 WineD3DContext *ctx;
362 TRACE("(%p) : type D3DQUERY_EVENT, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
364 ActivateContext(This->wineD3DDevice, This->wineD3DDevice->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
366 ctx = ((WineQueryEventData *)This->extendedData)->ctx;
367 if(pData == NULL || dwSize == 0) {
368 return S_OK;
369 } if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
370 /* See comment in IWineD3DQuery::Issue, event query codeblock */
371 FIXME("Query context not active, reporting GPU idle\n");
372 *data = TRUE;
373 } else if(GL_SUPPORT(APPLE_FENCE)) {
374 ENTER_GL();
375 *data = GL_EXTCALL(glTestFenceAPPLE(((WineQueryEventData *)This->extendedData)->fenceId));
376 checkGLcall("glTestFenceAPPLE");
377 LEAVE_GL();
378 } else if(GL_SUPPORT(NV_FENCE)) {
379 ENTER_GL();
380 *data = GL_EXTCALL(glTestFenceNV(((WineQueryEventData *)This->extendedData)->fenceId));
381 checkGLcall("glTestFenceNV");
382 LEAVE_GL();
383 } else {
384 WARN("(%p): reporting GPU idle\n", This);
385 *data = TRUE;
388 return S_OK;
391 static DWORD WINAPI IWineD3DQueryImpl_GetDataSize(IWineD3DQuery* iface){
392 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
393 int dataSize = 0;
394 TRACE("(%p) : type %#x\n", This, This->type);
395 switch(This->type){
396 case WINED3DQUERYTYPE_VCACHE:
397 dataSize = sizeof(WINED3DDEVINFO_VCACHE);
398 break;
399 case WINED3DQUERYTYPE_RESOURCEMANAGER:
400 dataSize = sizeof(WINED3DDEVINFO_RESOURCEMANAGER);
401 break;
402 case WINED3DQUERYTYPE_VERTEXSTATS:
403 dataSize = sizeof(WINED3DDEVINFO_VERTEXSTATS);
404 break;
405 case WINED3DQUERYTYPE_EVENT:
406 dataSize = sizeof(BOOL);
407 break;
408 case WINED3DQUERYTYPE_TIMESTAMP:
409 dataSize = sizeof(UINT64);
410 break;
411 case WINED3DQUERYTYPE_TIMESTAMPDISJOINT:
412 dataSize = sizeof(BOOL);
413 break;
414 case WINED3DQUERYTYPE_TIMESTAMPFREQ:
415 dataSize = sizeof(UINT64);
416 break;
417 case WINED3DQUERYTYPE_PIPELINETIMINGS:
418 dataSize = sizeof(WINED3DDEVINFO_PIPELINETIMINGS);
419 break;
420 case WINED3DQUERYTYPE_INTERFACETIMINGS:
421 dataSize = sizeof(WINED3DDEVINFO_INTERFACETIMINGS);
422 break;
423 case WINED3DQUERYTYPE_VERTEXTIMINGS:
424 dataSize = sizeof(WINED3DDEVINFO_STAGETIMINGS);
425 break;
426 case WINED3DQUERYTYPE_PIXELTIMINGS:
427 dataSize = sizeof(WINED3DDEVINFO_STAGETIMINGS);
428 break;
429 case WINED3DQUERYTYPE_BANDWIDTHTIMINGS:
430 dataSize = sizeof(WINED3DQUERYTYPE_BANDWIDTHTIMINGS);
431 break;
432 case WINED3DQUERYTYPE_CACHEUTILIZATION:
433 dataSize = sizeof(WINED3DDEVINFO_CACHEUTILIZATION);
434 break;
435 default:
436 FIXME("(%p) Unhandled query type %d\n",This , This->type);
437 dataSize = 0;
439 return dataSize;
442 static DWORD WINAPI IWineD3DEventQueryImpl_GetDataSize(IWineD3DQuery* iface){
443 TRACE("(%p) : type D3DQUERY_EVENT\n", iface);
445 return sizeof(BOOL);
448 static DWORD WINAPI IWineD3DOcclusionQueryImpl_GetDataSize(IWineD3DQuery* iface){
449 TRACE("(%p) : type D3DQUERY_OCCLUSION\n", iface);
451 return sizeof(DWORD);
454 static WINED3DQUERYTYPE WINAPI IWineD3DQueryImpl_GetType(IWineD3DQuery* iface){
455 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
456 return This->type;
460 static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
461 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
463 TRACE("(%p) : dwIssueFlags %#x, type D3DQUERY_EVENT\n", This, dwIssueFlags);
464 if (dwIssueFlags & WINED3DISSUE_END) {
465 WineD3DContext *ctx = ((WineQueryEventData *)This->extendedData)->ctx;
467 ActivateContext(This->wineD3DDevice, This->wineD3DDevice->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
469 if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
470 /* GL fences can be used only from the context that created them,
471 * so if a different context is active, don't bother setting the query. The penalty
472 * of a context switch is most likely higher than the gain of a correct query result
474 * If the query is used from a different thread, don't bother creating a multithread
475 * context - there's no point in doing that as the query would be unusable anyway
477 WARN("Query context not active\n");
478 } else if(GL_SUPPORT(APPLE_FENCE)) {
479 ENTER_GL();
480 GL_EXTCALL(glSetFenceAPPLE(((WineQueryEventData *)This->extendedData)->fenceId));
481 checkGLcall("glSetFenceAPPLE");
482 LEAVE_GL();
483 } else if (GL_SUPPORT(NV_FENCE)) {
484 ENTER_GL();
485 GL_EXTCALL(glSetFenceNV(((WineQueryEventData *)This->extendedData)->fenceId, GL_ALL_COMPLETED_NV));
486 checkGLcall("glSetFenceNV");
487 LEAVE_GL();
489 } else if(dwIssueFlags & WINED3DISSUE_BEGIN) {
490 /* Started implicitly at device creation */
491 ERR("Event query issued with START flag - what to do?\n");
494 if(dwIssueFlags & WINED3DISSUE_BEGIN) {
495 This->state = QUERY_BUILDING;
496 } else {
497 This->state = QUERY_SIGNALLED;
500 return WINED3D_OK;
503 static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
504 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
506 if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
507 WineD3DContext *ctx = ((WineQueryOcclusionData *)This->extendedData)->ctx;
509 ActivateContext(This->wineD3DDevice, This->wineD3DDevice->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
511 if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
512 FIXME("Not the owning context, can't start query\n");
513 } else {
514 ENTER_GL();
515 /* This is allowed according to msdn and our tests. Reset the query and restart */
516 if (dwIssueFlags & WINED3DISSUE_BEGIN) {
517 if(This->state == QUERY_BUILDING) {
518 GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
519 checkGLcall("glEndQuery()");
522 GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, ((WineQueryOcclusionData *)This->extendedData)->queryId));
523 checkGLcall("glBeginQuery()");
525 if (dwIssueFlags & WINED3DISSUE_END) {
526 /* Msdn says _END on a non-building occlusion query returns an error, but
527 * our tests show that it returns OK. But OpenGL doesn't like it, so avoid
528 * generating an error
530 if(This->state == QUERY_BUILDING) {
531 GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
532 checkGLcall("glEndQuery()");
535 LEAVE_GL();
537 } else {
538 FIXME("(%p) : Occlusion queries not supported\n", This);
541 if(dwIssueFlags & WINED3DISSUE_BEGIN) {
542 This->state = QUERY_BUILDING;
543 } else {
544 This->state = QUERY_SIGNALLED;
546 return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */
549 static HRESULT WINAPI IWineD3DQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags){
550 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
552 TRACE("(%p) : dwIssueFlags %#x, type %#x\n", This, dwIssueFlags, This->type);
554 /* The fixme is printed when the app asks for the resulting data */
555 WARN("(%p) : Unhandled query type %#x\n", This, This->type);
557 if(dwIssueFlags & WINED3DISSUE_BEGIN) {
558 This->state = QUERY_BUILDING;
559 } else {
560 This->state = QUERY_SIGNALLED;
563 return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */
567 /**********************************************************
568 * IWineD3DQuery VTbl follows
569 **********************************************************/
571 const IWineD3DQueryVtbl IWineD3DQuery_Vtbl =
573 /*** IUnknown methods ***/
574 IWineD3DQueryImpl_QueryInterface,
575 IWineD3DQueryImpl_AddRef,
576 IWineD3DQueryImpl_Release,
577 /*** IWineD3Dquery methods ***/
578 IWineD3DQueryImpl_GetParent,
579 IWineD3DQueryImpl_GetDevice,
580 IWineD3DQueryImpl_GetData,
581 IWineD3DQueryImpl_GetDataSize,
582 IWineD3DQueryImpl_GetType,
583 IWineD3DQueryImpl_Issue
586 const IWineD3DQueryVtbl IWineD3DEventQuery_Vtbl =
588 /*** IUnknown methods ***/
589 IWineD3DQueryImpl_QueryInterface,
590 IWineD3DQueryImpl_AddRef,
591 IWineD3DQueryImpl_Release,
592 /*** IWineD3Dquery methods ***/
593 IWineD3DQueryImpl_GetParent,
594 IWineD3DQueryImpl_GetDevice,
595 IWineD3DEventQueryImpl_GetData,
596 IWineD3DEventQueryImpl_GetDataSize,
597 IWineD3DQueryImpl_GetType,
598 IWineD3DEventQueryImpl_Issue
601 const IWineD3DQueryVtbl IWineD3DOcclusionQuery_Vtbl =
603 /*** IUnknown methods ***/
604 IWineD3DQueryImpl_QueryInterface,
605 IWineD3DQueryImpl_AddRef,
606 IWineD3DQueryImpl_Release,
607 /*** IWineD3Dquery methods ***/
608 IWineD3DQueryImpl_GetParent,
609 IWineD3DQueryImpl_GetDevice,
610 IWineD3DOcclusionQueryImpl_GetData,
611 IWineD3DOcclusionQueryImpl_GetDataSize,
612 IWineD3DQueryImpl_GetType,
613 IWineD3DOcclusionQueryImpl_Issue