VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/query.c@ 32184

Last change on this file since 32184 was 28475, checked in by vboxsync, 15 years ago

crOpenGL: update to wine 1.1.43

  • Property svn:eol-style set to native
File size: 21.2 KB
Line 
1/*
2 * IWineD3DQuery implementation
3 *
4 * Copyright 2005 Oliver Stieber
5 * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
6 * Copyright 2009 Henri Verbeet for CodeWeavers.
7 *
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.
12 *
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.
17 *
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
21 */
22
23/*
24 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
25 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
26 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
27 * a choice of LGPL license versions is made available with the language indicating
28 * that LGPLv2 or any later version may be used, or where a choice of which version
29 * of the LGPL is applied is otherwise unspecified.
30 */
31
32#include "config.h"
33#include "wined3d_private.h"
34
35WINE_DEFAULT_DEBUG_CHANNEL(d3d);
36#define GLINFO_LOCATION (*gl_info)
37
38BOOL wined3d_event_query_supported(const struct wined3d_gl_info *gl_info)
39{
40 return gl_info->supported[ARB_SYNC] || gl_info->supported[NV_FENCE] || gl_info->supported[APPLE_FENCE];
41}
42
43void wined3d_event_query_destroy(struct wined3d_event_query *query)
44{
45 if (query->context) context_free_event_query(query);
46 HeapFree(GetProcessHeap(), 0, query);
47}
48
49enum wined3d_event_query_result wined3d_event_query_test(struct wined3d_event_query *query, IWineD3DDeviceImpl *device)
50{
51 struct wined3d_context *context;
52 const struct wined3d_gl_info *gl_info;
53 enum wined3d_event_query_result ret;
54 BOOL fence_result;
55
56 TRACE("(%p) : device %p\n", query, device);
57
58 if (query->context == NULL)
59 {
60 TRACE("Query not started\n");
61 return WINED3D_EVENT_QUERY_NOT_STARTED;
62 }
63
64 if (!query->context->gl_info->supported[ARB_SYNC] && query->context->tid != GetCurrentThreadId())
65 {
66 WARN("Event query tested from wrong thread\n");
67 return WINED3D_EVENT_QUERY_WRONG_THREAD;
68 }
69
70 context = context_acquire(device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
71 gl_info = context->gl_info;
72
73 ENTER_GL();
74
75 if (gl_info->supported[ARB_SYNC])
76 {
77 GLenum gl_ret = GL_EXTCALL(glClientWaitSync(query->object.sync, 0, 0));
78 checkGLcall("glClientWaitSync");
79
80 switch (gl_ret)
81 {
82 case GL_ALREADY_SIGNALED:
83 case GL_CONDITION_SATISFIED:
84 ret = WINED3D_EVENT_QUERY_OK;
85 break;
86
87 case GL_TIMEOUT_EXPIRED:
88 ret = WINED3D_EVENT_QUERY_WAITING;
89 break;
90
91 case GL_WAIT_FAILED:
92 default:
93 ERR("glClientWaitSync returned %#x.\n", gl_ret);
94 ret = WINED3D_EVENT_QUERY_ERROR;
95 }
96 }
97 else if (gl_info->supported[APPLE_FENCE])
98 {
99 fence_result = GL_EXTCALL(glTestFenceAPPLE(query->object.id));
100 checkGLcall("glTestFenceAPPLE");
101 if (fence_result) ret = WINED3D_EVENT_QUERY_OK;
102 else ret = WINED3D_EVENT_QUERY_WAITING;
103 }
104 else if (gl_info->supported[NV_FENCE])
105 {
106 fence_result = GL_EXTCALL(glTestFenceNV(query->object.id));
107 checkGLcall("glTestFenceNV");
108 if (fence_result) ret = WINED3D_EVENT_QUERY_OK;
109 else ret = WINED3D_EVENT_QUERY_WAITING;
110 }
111 else
112 {
113 ERR("Event query created despite lack of GL support\n");
114 ret = WINED3D_EVENT_QUERY_ERROR;
115 }
116
117 LEAVE_GL();
118
119 context_release(context);
120 return ret;
121}
122
123enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_query *query, IWineD3DDeviceImpl *device)
124{
125 struct wined3d_context *context;
126 const struct wined3d_gl_info *gl_info;
127 enum wined3d_event_query_result ret;
128
129 TRACE("(%p)\n", query);
130
131 if (!query->context)
132 {
133 TRACE("Query not started\n");
134 return WINED3D_EVENT_QUERY_NOT_STARTED;
135 }
136 gl_info = query->context->gl_info;
137
138 if (query->context->tid != GetCurrentThreadId() && !gl_info->supported[ARB_SYNC])
139 {
140 /* A glFinish does not reliably wait for draws in other contexts. The caller has
141 * to find its own way to cope with the thread switch
142 */
143 WARN("Event query finished from wrong thread\n");
144 return WINED3D_EVENT_QUERY_WRONG_THREAD;
145 }
146
147 context = context_acquire(device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
148
149 ENTER_GL();
150 if (gl_info->supported[ARB_SYNC])
151 {
152 GLenum gl_ret = GL_EXTCALL(glClientWaitSync(query->object.sync, 0, ~(GLuint64)0));
153 checkGLcall("glClientWaitSync");
154
155 switch (gl_ret)
156 {
157 case GL_ALREADY_SIGNALED:
158 case GL_CONDITION_SATISFIED:
159 ret = WINED3D_EVENT_QUERY_OK;
160 break;
161
162 /* We don't expect a timeout for a ~584 year wait */
163 default:
164 ERR("glClientWaitSync returned %#x.\n", gl_ret);
165 ret = WINED3D_EVENT_QUERY_ERROR;
166 }
167 }
168 else if (context->gl_info->supported[APPLE_FENCE])
169 {
170 GL_EXTCALL(glFinishFenceAPPLE(query->object.id));
171 checkGLcall("glFinishFenceAPPLE");
172 ret = WINED3D_EVENT_QUERY_OK;
173 }
174 else if (context->gl_info->supported[NV_FENCE])
175 {
176 GL_EXTCALL(glFinishFenceNV(query->object.id));
177 checkGLcall("glFinishFenceNV");
178 ret = WINED3D_EVENT_QUERY_OK;
179 }
180 else
181 {
182 ERR("Event query created without GL support\n");
183 ret = WINED3D_EVENT_QUERY_ERROR;
184 }
185 LEAVE_GL();
186
187 context_release(context);
188 return ret;
189}
190
191void wined3d_event_query_issue(struct wined3d_event_query *query, IWineD3DDeviceImpl *device)
192{
193 const struct wined3d_gl_info *gl_info;
194 struct wined3d_context *context;
195
196 if (query->context)
197 {
198 if (!query->context->gl_info->supported[ARB_SYNC] && query->context->tid != GetCurrentThreadId())
199 {
200 context_free_event_query(query);
201 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
202 context_alloc_event_query(context, query);
203 }
204 else
205 {
206 context = context_acquire(device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
207 }
208 }
209 else
210 {
211 context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
212 context_alloc_event_query(context, query);
213 }
214
215 gl_info = context->gl_info;
216
217 ENTER_GL();
218
219 if (gl_info->supported[ARB_SYNC])
220 {
221 if (query->object.sync) GL_EXTCALL(glDeleteSync(query->object.sync));
222 checkGLcall("glDeleteSync");
223 query->object.sync = GL_EXTCALL(glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
224 checkGLcall("glFenceSync");
225 }
226 else if (gl_info->supported[APPLE_FENCE])
227 {
228 GL_EXTCALL(glSetFenceAPPLE(query->object.id));
229 checkGLcall("glSetFenceAPPLE");
230 }
231 else if (gl_info->supported[NV_FENCE])
232 {
233 GL_EXTCALL(glSetFenceNV(query->object.id, GL_ALL_COMPLETED_NV));
234 checkGLcall("glSetFenceNV");
235 }
236
237 LEAVE_GL();
238
239 context_release(context);
240}
241
242/*
243 * Occlusion Queries:
244 * http://www.gris.uni-tuebingen.de/~bartz/Publications/paper/hww98.pdf
245 * http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
246 */
247
248/* *******************************************
249 IWineD3DQuery IUnknown parts follow
250 ******************************************* */
251static HRESULT WINAPI IWineD3DQueryImpl_QueryInterface(IWineD3DQuery *iface, REFIID riid, LPVOID *ppobj)
252{
253 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
254 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
255 if (IsEqualGUID(riid, &IID_IUnknown)
256 || IsEqualGUID(riid, &IID_IWineD3DBase)
257 || IsEqualGUID(riid, &IID_IWineD3DQuery)) {
258 IUnknown_AddRef(iface);
259 *ppobj = This;
260 return S_OK;
261 }
262 *ppobj = NULL;
263 return E_NOINTERFACE;
264}
265
266static ULONG WINAPI IWineD3DQueryImpl_AddRef(IWineD3DQuery *iface) {
267 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
268 TRACE("(%p) : AddRef increasing from %d\n", This, This->ref);
269 return InterlockedIncrement(&This->ref);
270}
271
272static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
273 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
274 ULONG ref;
275 TRACE("(%p) : Releasing from %d\n", This, This->ref);
276 ref = InterlockedDecrement(&This->ref);
277 if (ref == 0) {
278 /* Queries are specific to the GL context that created them. Not
279 * deleting the query will obviously leak it, but that's still better
280 * than potentially deleting a different query with the same id in this
281 * context, and (still) leaking the actual query. */
282 if (This->type == WINED3DQUERYTYPE_EVENT)
283 {
284 struct wined3d_event_query *query = This->extendedData;
285 if (query) wined3d_event_query_destroy(query);
286 }
287 else if (This->type == WINED3DQUERYTYPE_OCCLUSION)
288 {
289 struct wined3d_occlusion_query *query = This->extendedData;
290
291 if (query->context) context_free_occlusion_query(query);
292 HeapFree(GetProcessHeap(), 0, This->extendedData);
293 }
294
295 HeapFree(GetProcessHeap(), 0, This);
296 }
297 return ref;
298}
299
300/* *******************************************
301 IWineD3DQuery IWineD3DQuery parts follow
302 ******************************************* */
303static HRESULT WINAPI IWineD3DQueryImpl_GetParent(IWineD3DQuery *iface, IUnknown **parent)
304{
305 TRACE("iface %p, parent %p.\n", iface, parent);
306
307 *parent = (IUnknown *)parent;
308 IUnknown_AddRef(*parent);
309
310 TRACE("Returning %p.\n", *parent);
311
312 return WINED3D_OK;
313}
314
315static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
316 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
317 struct wined3d_occlusion_query *query = This->extendedData;
318 IWineD3DDeviceImpl *device = This->device;
319 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
320 struct wined3d_context *context;
321 DWORD* data = pData;
322 GLuint available;
323 GLuint samples;
324 HRESULT res;
325
326 TRACE("(%p) : type D3DQUERY_OCCLUSION, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
327
328 if (!query->context) This->state = QUERY_CREATED;
329
330 if (This->state == QUERY_CREATED)
331 {
332 /* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves */
333 TRACE("Query wasn't yet started, returning S_OK\n");
334 if(data) *data = 0;
335 return S_OK;
336 }
337
338 if (This->state == QUERY_BUILDING)
339 {
340 /* Msdn says this returns an error, but our tests show that S_FALSE is returned */
341 TRACE("Query is building, returning S_FALSE\n");
342 return S_FALSE;
343 }
344
345 if (!gl_info->supported[ARB_OCCLUSION_QUERY])
346 {
347 WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This);
348 *data = 1;
349 return S_OK;
350 }
351
352 if (query->context->tid != GetCurrentThreadId())
353 {
354 FIXME("%p Wrong thread, returning 1.\n", This);
355 *data = 1;
356 return S_OK;
357 }
358
359 context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
360
361 ENTER_GL();
362
363 GL_EXTCALL(glGetQueryObjectuivARB(query->id, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
364 checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)");
365 TRACE("(%p) : available %d.\n", This, available);
366
367 if (available)
368 {
369 if (data)
370 {
371 GL_EXTCALL(glGetQueryObjectuivARB(query->id, GL_QUERY_RESULT_ARB, &samples));
372 checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)");
373 TRACE("(%p) : Returning %d samples.\n", This, samples);
374 *data = samples;
375 }
376 res = S_OK;
377 }
378 else
379 {
380 res = S_FALSE;
381 }
382
383 LEAVE_GL();
384
385 context_release(context);
386
387 return res;
388}
389
390static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
391 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
392 struct wined3d_event_query *query = This->extendedData;
393 BOOL *data = pData;
394 enum wined3d_event_query_result ret;
395
396 TRACE("(%p) : type D3DQUERY_EVENT, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
397
398 if (!pData || !dwSize) return S_OK;
399 if (!query)
400 {
401 WARN("(%p): Event query not supported by GL, reporting GPU idle\n", This);
402 *data = TRUE;
403 return S_OK;
404 }
405
406 ret = wined3d_event_query_test(query, This->device);
407 switch(ret)
408 {
409 case WINED3D_EVENT_QUERY_OK:
410 case WINED3D_EVENT_QUERY_NOT_STARTED:
411 *data = TRUE;
412 break;
413
414 case WINED3D_EVENT_QUERY_WAITING:
415 *data = FALSE;
416 break;
417
418 case WINED3D_EVENT_QUERY_WRONG_THREAD:
419 FIXME("(%p) Wrong thread, reporting GPU idle.\n", This);
420 *data = TRUE;
421 break;
422
423 case WINED3D_EVENT_QUERY_ERROR:
424 ERR("The GL event query failed, returning D3DERR_INVALIDCALL\n");
425 return WINED3DERR_INVALIDCALL;
426 }
427
428 return S_OK;
429}
430
431static DWORD WINAPI IWineD3DEventQueryImpl_GetDataSize(IWineD3DQuery* iface){
432 TRACE("(%p) : type D3DQUERY_EVENT\n", iface);
433
434 return sizeof(BOOL);
435}
436
437static DWORD WINAPI IWineD3DOcclusionQueryImpl_GetDataSize(IWineD3DQuery* iface){
438 TRACE("(%p) : type D3DQUERY_OCCLUSION\n", iface);
439
440 return sizeof(DWORD);
441}
442
443static WINED3DQUERYTYPE WINAPI IWineD3DQueryImpl_GetType(IWineD3DQuery* iface){
444 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
445 return This->type;
446}
447
448static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
449 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
450
451 TRACE("(%p) : dwIssueFlags %#x, type D3DQUERY_EVENT\n", This, dwIssueFlags);
452 if (dwIssueFlags & WINED3DISSUE_END)
453 {
454 struct wined3d_event_query *query = This->extendedData;
455
456 /* Faked event query support */
457 if (!query) return WINED3D_OK;
458
459 wined3d_event_query_issue(query, This->device);
460 }
461 else if(dwIssueFlags & WINED3DISSUE_BEGIN)
462 {
463 /* Started implicitly at device creation */
464 ERR("Event query issued with START flag - what to do?\n");
465 }
466
467 if(dwIssueFlags & WINED3DISSUE_BEGIN) {
468 This->state = QUERY_BUILDING;
469 } else {
470 This->state = QUERY_SIGNALLED;
471 }
472
473 return WINED3D_OK;
474}
475
476static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
477 IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
478 IWineD3DDeviceImpl *device = This->device;
479 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
480
481 if (gl_info->supported[ARB_OCCLUSION_QUERY])
482 {
483 struct wined3d_occlusion_query *query = This->extendedData;
484 struct wined3d_context *context;
485
486 /* This is allowed according to msdn and our tests. Reset the query and restart */
487 if (dwIssueFlags & WINED3DISSUE_BEGIN)
488 {
489 if (This->state == QUERY_BUILDING)
490 {
491 if (query->context->tid != GetCurrentThreadId())
492 {
493 FIXME("Wrong thread, can't restart query.\n");
494
495 context_free_occlusion_query(query);
496 context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD);
497 context_alloc_occlusion_query(context, query);
498 }
499 else
500 {
501 context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
502
503 ENTER_GL();
504 GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
505 checkGLcall("glEndQuery()");
506 LEAVE_GL();
507 }
508 }
509 else
510 {
511 if (query->context) context_free_occlusion_query(query);
512 context = context_acquire(This->device, NULL, CTXUSAGE_RESOURCELOAD);
513 context_alloc_occlusion_query(context, query);
514 }
515
516 ENTER_GL();
517 GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, query->id));
518 checkGLcall("glBeginQuery()");
519 LEAVE_GL();
520
521 context_release(context);
522 }
523 if (dwIssueFlags & WINED3DISSUE_END) {
524 /* Msdn says _END on a non-building occlusion query returns an error, but
525 * our tests show that it returns OK. But OpenGL doesn't like it, so avoid
526 * generating an error
527 */
528 if (This->state == QUERY_BUILDING)
529 {
530 if (query->context->tid != GetCurrentThreadId())
531 {
532 FIXME("Wrong thread, can't end query.\n");
533 }
534 else
535 {
536 context = context_acquire(This->device, query->context->current_rt, CTXUSAGE_RESOURCELOAD);
537
538 ENTER_GL();
539 GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
540 checkGLcall("glEndQuery()");
541 LEAVE_GL();
542
543 context_release(context);
544 }
545 }
546 }
547 } else {
548 FIXME("(%p) : Occlusion queries not supported\n", This);
549 }
550
551 if(dwIssueFlags & WINED3DISSUE_BEGIN) {
552 This->state = QUERY_BUILDING;
553 } else {
554 This->state = QUERY_SIGNALLED;
555 }
556 return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */
557}
558
559static const IWineD3DQueryVtbl IWineD3DEventQuery_Vtbl =
560{
561 /*** IUnknown methods ***/
562 IWineD3DQueryImpl_QueryInterface,
563 IWineD3DQueryImpl_AddRef,
564 IWineD3DQueryImpl_Release,
565 /*** IWineD3Dquery methods ***/
566 IWineD3DQueryImpl_GetParent,
567 IWineD3DEventQueryImpl_GetData,
568 IWineD3DEventQueryImpl_GetDataSize,
569 IWineD3DQueryImpl_GetType,
570 IWineD3DEventQueryImpl_Issue
571};
572
573static const IWineD3DQueryVtbl IWineD3DOcclusionQuery_Vtbl =
574{
575 /*** IUnknown methods ***/
576 IWineD3DQueryImpl_QueryInterface,
577 IWineD3DQueryImpl_AddRef,
578 IWineD3DQueryImpl_Release,
579 /*** IWineD3Dquery methods ***/
580 IWineD3DQueryImpl_GetParent,
581 IWineD3DOcclusionQueryImpl_GetData,
582 IWineD3DOcclusionQueryImpl_GetDataSize,
583 IWineD3DQueryImpl_GetType,
584 IWineD3DOcclusionQueryImpl_Issue
585};
586
587HRESULT query_init(IWineD3DQueryImpl *query, IWineD3DDeviceImpl *device,
588 WINED3DQUERYTYPE type, IUnknown *parent)
589{
590 const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
591
592 switch (type)
593 {
594 case WINED3DQUERYTYPE_OCCLUSION:
595 TRACE("Occlusion query.\n");
596 if (!gl_info->supported[ARB_OCCLUSION_QUERY])
597 {
598 WARN("Unsupported in local OpenGL implementation: ARB_OCCLUSION_QUERY.\n");
599 return WINED3DERR_NOTAVAILABLE;
600 }
601 query->lpVtbl = &IWineD3DOcclusionQuery_Vtbl;
602 query->extendedData = HeapAlloc(GetProcessHeap(), 0, sizeof(struct wined3d_occlusion_query));
603 if (!query->extendedData)
604 {
605 ERR("Failed to allocate occlusion query extended data.\n");
606 return E_OUTOFMEMORY;
607 }
608 ((struct wined3d_occlusion_query *)query->extendedData)->context = NULL;
609 break;
610
611 case WINED3DQUERYTYPE_EVENT:
612 TRACE("Event query.\n");
613 if (!wined3d_event_query_supported(gl_info))
614 {
615 /* Half-Life 2 needs this query. It does not render the main
616 * menu correctly otherwise. Pretend to support it, faking
617 * this query does not do much harm except potentially
618 * lowering performance. */
619 FIXME("Event query: Unimplemented, but pretending to be supported.\n");
620 }
621 query->lpVtbl = &IWineD3DEventQuery_Vtbl;
622 query->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct wined3d_event_query));
623 if (!query->extendedData)
624 {
625 ERR("Failed to allocate event query memory.\n");
626 return E_OUTOFMEMORY;
627 }
628 break;
629
630 case WINED3DQUERYTYPE_VCACHE:
631 case WINED3DQUERYTYPE_RESOURCEMANAGER:
632 case WINED3DQUERYTYPE_VERTEXSTATS:
633 case WINED3DQUERYTYPE_TIMESTAMP:
634 case WINED3DQUERYTYPE_TIMESTAMPDISJOINT:
635 case WINED3DQUERYTYPE_TIMESTAMPFREQ:
636 case WINED3DQUERYTYPE_PIPELINETIMINGS:
637 case WINED3DQUERYTYPE_INTERFACETIMINGS:
638 case WINED3DQUERYTYPE_VERTEXTIMINGS:
639 case WINED3DQUERYTYPE_PIXELTIMINGS:
640 case WINED3DQUERYTYPE_BANDWIDTHTIMINGS:
641 case WINED3DQUERYTYPE_CACHEUTILIZATION:
642 default:
643 FIXME("Unhandled query type %#x.\n", type);
644 return WINED3DERR_NOTAVAILABLE;
645 }
646
647 query->type = type;
648 query->state = QUERY_CREATED;
649 query->device = device;
650 query->parent = parent;
651 query->ref = 1;
652
653 return WINED3D_OK;
654}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette