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
24 #include "wined3d_private.h"
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
);
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
;
62 TRACE("(%p) : Releasing from %d\n", This
, This
->ref
);
63 ref
= InterlockedDecrement(&This
->ref
);
65 ActivateContext(This
->wineD3DDevice
, This
->wineD3DDevice
->lastActiveRenderTarget
, CTXUSAGE_RESOURCELOAD
);
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");
94 GL_EXTCALL(glDeleteQueriesARB(1, &((WineQueryOcclusionData
*)(This
->extendedData
))->queryId
));
95 checkGLcall("glDeleteQueriesARB");
100 HeapFree(GetProcessHeap(), 0, This
->extendedData
);
101 HeapFree(GetProcessHeap(), 0, This
);
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
);
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
);
127 static HRESULT WINAPI
IWineD3DQueryImpl_GetData(IWineD3DQuery
* iface
, void* pData
, DWORD dwSize
, DWORD dwGetDataFlags
){
128 IWineD3DQueryImpl
*This
= (IWineD3DQueryImpl
*)iface
;
131 TRACE("(%p) : type %#x, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This
, This
->type
, pData
, dwSize
, dwGetDataFlags
);
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)*/
148 case WINED3DQUERYTYPE_RESOURCEMANAGER
:
150 WINED3DDEVINFO_RESOURCEMANAGER
*data
= pData
;
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;
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;
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*/
190 case WINED3DQUERYTYPE_TIMESTAMPDISJOINT
:
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*/
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*/
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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");
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");
314 if (!GL_SUPPORT(ARB_OCCLUSION_QUERY
))
316 WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This
);
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
);
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
);
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
);
358 static HRESULT WINAPI
IWineD3DEventQueryImpl_GetData(IWineD3DQuery
* iface
, void* pData
, DWORD dwSize
, DWORD dwGetDataFlags
) {
359 IWineD3DQueryImpl
*This
= (IWineD3DQueryImpl
*) iface
;
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) {
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");
373 } else if(GL_SUPPORT(APPLE_FENCE
)) {
375 *data
= GL_EXTCALL(glTestFenceAPPLE(((WineQueryEventData
*)This
->extendedData
)->fenceId
));
376 checkGLcall("glTestFenceAPPLE");
378 } else if(GL_SUPPORT(NV_FENCE
)) {
380 *data
= GL_EXTCALL(glTestFenceNV(((WineQueryEventData
*)This
->extendedData
)->fenceId
));
381 checkGLcall("glTestFenceNV");
384 WARN("(%p): reporting GPU idle\n", This
);
391 static DWORD WINAPI
IWineD3DQueryImpl_GetDataSize(IWineD3DQuery
* iface
){
392 IWineD3DQueryImpl
*This
= (IWineD3DQueryImpl
*)iface
;
394 TRACE("(%p) : type %#x\n", This
, This
->type
);
396 case WINED3DQUERYTYPE_VCACHE
:
397 dataSize
= sizeof(WINED3DDEVINFO_VCACHE
);
399 case WINED3DQUERYTYPE_RESOURCEMANAGER
:
400 dataSize
= sizeof(WINED3DDEVINFO_RESOURCEMANAGER
);
402 case WINED3DQUERYTYPE_VERTEXSTATS
:
403 dataSize
= sizeof(WINED3DDEVINFO_VERTEXSTATS
);
405 case WINED3DQUERYTYPE_EVENT
:
406 dataSize
= sizeof(BOOL
);
408 case WINED3DQUERYTYPE_TIMESTAMP
:
409 dataSize
= sizeof(UINT64
);
411 case WINED3DQUERYTYPE_TIMESTAMPDISJOINT
:
412 dataSize
= sizeof(BOOL
);
414 case WINED3DQUERYTYPE_TIMESTAMPFREQ
:
415 dataSize
= sizeof(UINT64
);
417 case WINED3DQUERYTYPE_PIPELINETIMINGS
:
418 dataSize
= sizeof(WINED3DDEVINFO_PIPELINETIMINGS
);
420 case WINED3DQUERYTYPE_INTERFACETIMINGS
:
421 dataSize
= sizeof(WINED3DDEVINFO_INTERFACETIMINGS
);
423 case WINED3DQUERYTYPE_VERTEXTIMINGS
:
424 dataSize
= sizeof(WINED3DDEVINFO_STAGETIMINGS
);
426 case WINED3DQUERYTYPE_PIXELTIMINGS
:
427 dataSize
= sizeof(WINED3DDEVINFO_STAGETIMINGS
);
429 case WINED3DQUERYTYPE_BANDWIDTHTIMINGS
:
430 dataSize
= sizeof(WINED3DQUERYTYPE_BANDWIDTHTIMINGS
);
432 case WINED3DQUERYTYPE_CACHEUTILIZATION
:
433 dataSize
= sizeof(WINED3DDEVINFO_CACHEUTILIZATION
);
436 FIXME("(%p) Unhandled query type %d\n",This
, This
->type
);
442 static DWORD WINAPI
IWineD3DEventQueryImpl_GetDataSize(IWineD3DQuery
* iface
){
443 TRACE("(%p) : type D3DQUERY_EVENT\n", iface
);
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
;
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
)) {
480 GL_EXTCALL(glSetFenceAPPLE(((WineQueryEventData
*)This
->extendedData
)->fenceId
));
481 checkGLcall("glSetFenceAPPLE");
483 } else if (GL_SUPPORT(NV_FENCE
)) {
485 GL_EXTCALL(glSetFenceNV(((WineQueryEventData
*)This
->extendedData
)->fenceId
, GL_ALL_COMPLETED_NV
));
486 checkGLcall("glSetFenceNV");
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
;
497 This
->state
= QUERY_SIGNALLED
;
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");
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()");
538 FIXME("(%p) : Occlusion queries not supported\n", This
);
541 if(dwIssueFlags
& WINED3DISSUE_BEGIN
) {
542 This
->state
= QUERY_BUILDING
;
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
;
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