ReactOS  0.4.14-dev-606-g14ebc0b
query.c
Go to the documentation of this file.
1 /*
2  * Copyright 2005 Oliver Stieber
3  * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
4  * Copyright 2009-2010 Henri Verbeet for CodeWeavers.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 
22 #include "config.h"
23 #include "wine/port.h"
24 #include "wined3d_private.h"
25 
27 
28 static UINT64 get_query_result64(GLuint id, const struct wined3d_gl_info *gl_info)
29 {
30  if (gl_info->supported[ARB_TIMER_QUERY])
31  {
33  GL_EXTCALL(glGetQueryObjectui64v(id, GL_QUERY_RESULT, &result));
34  return result;
35  }
36  else
37  {
38  GLuint result;
39  GL_EXTCALL(glGetQueryObjectuiv(id, GL_QUERY_RESULT, &result));
40  return result;
41  }
42 }
43 
45  enum wined3d_query_type type, const void *data, DWORD data_size,
46  const struct wined3d_query_ops *query_ops, void *parent, const struct wined3d_parent_ops *parent_ops)
47 {
48  query->ref = 1;
49  query->parent = parent;
50  query->parent_ops = parent_ops;
51  query->device = device;
52  query->state = QUERY_CREATED;
53  query->type = type;
54  query->data = data;
55  query->data_size = data_size;
56  query->query_ops = query_ops;
57  list_init(&query->poll_list_entry);
58 }
59 
61 {
63 }
64 
66 {
68 }
69 
71 {
73 }
74 
76 {
78 }
79 
81  struct wined3d_query *query)
82 {
84 }
85 
86 static BOOL wined3d_fence_supported(const struct wined3d_gl_info *gl_info)
87 {
88  return gl_info->supported[ARB_SYNC] || gl_info->supported[NV_FENCE] || gl_info->supported[APPLE_FENCE];
89 }
90 
91 static enum wined3d_fence_result wined3d_fence_test(const struct wined3d_fence *fence,
92  const struct wined3d_device *device, DWORD flags)
93 {
94  const struct wined3d_gl_info *gl_info;
95  struct wined3d_context *context;
97  BOOL fence_result;
98 
99  TRACE("fence %p, device %p, flags %#x.\n", fence, device, flags);
100 
101  if (!fence->context)
102  {
103  TRACE("Fence not issued.\n");
105  }
106 
107  if (!(context = context_reacquire(device, fence->context)))
108  {
109  if (!fence->context->gl_info->supported[ARB_SYNC])
110  {
111  WARN("Fence tested from wrong thread.\n");
113  }
115  }
116  gl_info = context->gl_info;
117 
118  if (gl_info->supported[ARB_SYNC])
119  {
120  GLenum gl_ret = GL_EXTCALL(glClientWaitSync(fence->object.sync,
122  checkGLcall("glClientWaitSync");
123 
124  switch (gl_ret)
125  {
126  case GL_ALREADY_SIGNALED:
129  break;
130 
131  case GL_TIMEOUT_EXPIRED:
133  break;
134 
135  case GL_WAIT_FAILED:
136  default:
137  ERR("glClientWaitSync returned %#x.\n", gl_ret);
139  }
140  }
141  else if (gl_info->supported[APPLE_FENCE])
142  {
143  fence_result = GL_EXTCALL(glTestFenceAPPLE(fence->object.id));
144  checkGLcall("glTestFenceAPPLE");
145  if (fence_result)
147  else
149  }
150  else if (gl_info->supported[NV_FENCE])
151  {
152  fence_result = GL_EXTCALL(glTestFenceNV(fence->object.id));
153  checkGLcall("glTestFenceNV");
154  if (fence_result)
156  else
158  }
159  else
160  {
161  ERR("Fence created despite lack of GL support.\n");
163  }
164 
166  return ret;
167 }
168 
170  const struct wined3d_device *device)
171 {
172  const struct wined3d_gl_info *gl_info;
173  struct wined3d_context *context;
175 
176  TRACE("fence %p, device %p.\n", fence, device);
177 
178  if (!fence->context)
179  {
180  TRACE("Fence not issued.\n");
182  }
183  gl_info = fence->context->gl_info;
184 
185  if (!(context = context_reacquire(device, fence->context)))
186  {
187  /* A glFinish does not reliably wait for draws in other contexts. The caller has
188  * to find its own way to cope with the thread switch
189  */
190  if (!gl_info->supported[ARB_SYNC])
191  {
192  WARN("Fence finished from wrong thread.\n");
194  }
196  }
197  gl_info = context->gl_info;
198 
199  if (gl_info->supported[ARB_SYNC])
200  {
201  /* Timeouts near 0xffffffffffffffff may immediately return GL_TIMEOUT_EXPIRED,
202  * possibly because macOS internally adds some slop to the timer. To avoid this,
203  * we use a large number that isn't near the point of overflow (macOS 10.12.5).
204  */
205  GLenum gl_ret = GL_EXTCALL(glClientWaitSync(fence->object.sync,
207  checkGLcall("glClientWaitSync");
208 
209  switch (gl_ret)
210  {
211  case GL_ALREADY_SIGNALED:
214  break;
215 
216  /* We don't expect a timeout for a ~292 year wait */
217  default:
218  ERR("glClientWaitSync returned %#x.\n", gl_ret);
220  }
221  }
222  else if (context->gl_info->supported[APPLE_FENCE])
223  {
224  GL_EXTCALL(glFinishFenceAPPLE(fence->object.id));
225  checkGLcall("glFinishFenceAPPLE");
227  }
228  else if (context->gl_info->supported[NV_FENCE])
229  {
230  GL_EXTCALL(glFinishFenceNV(fence->object.id));
231  checkGLcall("glFinishFenceNV");
233  }
234  else
235  {
236  ERR("Fence created without GL support.\n");
238  }
239 
241  return ret;
242 }
243 
244 void wined3d_fence_issue(struct wined3d_fence *fence, const struct wined3d_device *device)
245 {
246  struct wined3d_context *context = NULL;
247  const struct wined3d_gl_info *gl_info;
248 
249  if (fence->context && !(context = context_reacquire(device, fence->context))
250  && !fence->context->gl_info->supported[ARB_SYNC])
251  context_free_fence(fence);
252  if (!context)
254  gl_info = context->gl_info;
255  if (!fence->context)
257 
258  if (gl_info->supported[ARB_SYNC])
259  {
260  if (fence->object.sync)
261  GL_EXTCALL(glDeleteSync(fence->object.sync));
262  checkGLcall("glDeleteSync");
263  fence->object.sync = GL_EXTCALL(glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
264  checkGLcall("glFenceSync");
265  }
266  else if (gl_info->supported[APPLE_FENCE])
267  {
268  GL_EXTCALL(glSetFenceAPPLE(fence->object.id));
269  checkGLcall("glSetFenceAPPLE");
270  }
271  else if (gl_info->supported[NV_FENCE])
272  {
273  GL_EXTCALL(glSetFenceNV(fence->object.id, GL_ALL_COMPLETED_NV));
274  checkGLcall("glSetFenceNV");
275  }
276 
278 }
279 
280 static void wined3d_fence_free(struct wined3d_fence *fence)
281 {
282  if (fence->context)
283  context_free_fence(fence);
284 }
285 
287 {
288  wined3d_fence_free(fence);
289  heap_free(fence);
290 }
291 
292 static HRESULT wined3d_fence_init(struct wined3d_fence *fence, const struct wined3d_gl_info *gl_info)
293 {
294  if (!wined3d_fence_supported(gl_info))
295  {
296  WARN("Fences not supported.\n");
298  }
299 
300  return WINED3D_OK;
301 }
302 
304 {
305  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
306  struct wined3d_fence *object;
307  HRESULT hr;
308 
309  TRACE("device %p, fence %p.\n", device, fence);
310 
311  if (!(object = heap_alloc_zero(sizeof(*object))))
312  return E_OUTOFMEMORY;
313 
314  if (FAILED(hr = wined3d_fence_init(object, gl_info)))
315  {
316  heap_free(object);
317  return hr;
318  }
319 
320  TRACE("Created fence %p.\n", object);
321  *fence = object;
322 
323  return WINED3D_OK;
324 }
325 
327 {
328  ULONG refcount = InterlockedIncrement(&query->ref);
329 
330  TRACE("%p increasing refcount to %u.\n", query, refcount);
331 
332  return refcount;
333 }
334 
335 static void wined3d_query_destroy_object(void *object)
336 {
337  struct wined3d_query *query = object;
338 
339  if (!list_empty(&query->poll_list_entry))
340  list_remove(&query->poll_list_entry);
341 
342  /* Queries are specific to the GL context that created them. Not
343  * deleting the query will obviously leak it, but that's still better
344  * than potentially deleting a different query with the same id in this
345  * context, and (still) leaking the actual query. */
346  query->query_ops->query_destroy(query);
347 }
348 
350 {
351  ULONG refcount = InterlockedDecrement(&query->ref);
352 
353  TRACE("%p decreasing refcount to %u.\n", query, refcount);
354 
355  if (!refcount)
356  {
357  query->parent_ops->wined3d_object_destroyed(query->parent);
359  }
360 
361  return refcount;
362 }
363 
365  void *data, UINT data_size, DWORD flags)
366 {
367  TRACE("query %p, data %p, data_size %u, flags %#x.\n",
369 
370  if (flags)
371  WARN("Ignoring flags %#x.\n", flags);
372 
373  if (query->state == QUERY_BUILDING)
374  {
375  WARN("Query is building, returning S_FALSE.\n");
376  return S_FALSE;
377  }
378 
379  if (query->state == QUERY_CREATED)
380  {
381  WARN("Query wasn't started yet.\n");
382  return WINED3DERR_INVALIDCALL;
383  }
384 
385  if (!query->device->cs->thread)
386  {
387  if (!query->query_ops->query_poll(query, flags))
388  return S_FALSE;
389  }
390  else if (query->counter_main != query->counter_retrieved)
391  {
392  if (flags & WINED3DGETDATA_FLUSH && !query->device->cs->queries_flushed)
393  wined3d_cs_emit_flush(query->device->cs);
394  return S_FALSE;
395  }
396 
397  if (data)
398  memcpy(data, query->data, min(data_size, query->data_size));
399 
400  return S_OK;
401 }
402 
404 {
405  TRACE("query %p.\n", query);
406 
407  return query->data_size;
408 }
409 
411 {
412  TRACE("query %p, flags %#x.\n", query, flags);
413 
414  if (flags & WINED3DISSUE_END)
415  ++query->counter_main;
416 
418 
420  query->state = QUERY_BUILDING;
421  else
422  query->state = QUERY_SIGNALLED;
423 
424  return WINED3D_OK;
425 }
426 
428 {
430  struct wined3d_device *device = query->device;
431  const struct wined3d_gl_info *gl_info;
432  struct wined3d_context *context;
434 
435  TRACE("query %p, flags %#x.\n", query, flags);
436 
437  if (!(context = context_reacquire(device, oq->context)))
438  {
439  FIXME("%p Wrong thread, returning 1.\n", query);
440  oq->samples = 1;
441  return TRUE;
442  }
443  gl_info = context->gl_info;
444 
445  GL_EXTCALL(glGetQueryObjectuiv(oq->id, GL_QUERY_RESULT_AVAILABLE, &available));
446  TRACE("Available %#x.\n", available);
447 
448  if (available)
449  {
450  oq->samples = get_query_result64(oq->id, gl_info);
451  TRACE("Returning 0x%s samples.\n", wine_dbgstr_longlong(oq->samples));
452  }
453 
454  checkGLcall("poll occlusion query");
456 
457  return available;
458 }
459 
461 {
464 
465  TRACE("query %p, flags %#x.\n", query, flags);
466 
467  ret = wined3d_fence_test(&event_query->fence, query->device, flags);
468  switch (ret)
469  {
470  case WINED3D_FENCE_OK:
472  return event_query->signalled = TRUE;
473 
475  return event_query->signalled = FALSE;
476 
478  FIXME("(%p) Wrong thread, reporting GPU idle.\n", query);
479  return event_query->signalled = TRUE;
480 
481  case WINED3D_FENCE_ERROR:
482  ERR("The GL event query failed.\n");
483  return event_query->signalled = TRUE;
484 
485  default:
486  ERR("Unexpected wined3d_event_query_test result %#x.\n", ret);
487  return event_query->signalled = TRUE;
488  }
489 }
490 
492 {
493  TRACE("query %p.\n", query);
494 
495  return query->parent;
496 }
497 
499 {
500  TRACE("query %p.\n", query);
501 
502  return query->type;
503 }
504 
506 {
507  TRACE("query %p, flags %#x.\n", query, flags);
508 
509  if (flags & WINED3DISSUE_END)
510  {
512 
513  wined3d_fence_issue(&event_query->fence, query->device);
514  return TRUE;
515  }
516  else if (flags & WINED3DISSUE_BEGIN)
517  {
518  /* Started implicitly at query creation. */
519  ERR("Event query issued with START flag - what to do?\n");
520  }
521 
522  return FALSE;
523 }
524 
526 {
528  struct wined3d_device *device = query->device;
529  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
530  struct wined3d_context *context;
531  BOOL poll = FALSE;
532 
533  TRACE("query %p, flags %#x.\n", query, flags);
534 
535  /* This is allowed according to MSDN and our tests. Reset the query and
536  * restart. */
538  {
539  if (oq->started)
540  {
541  if ((context = context_reacquire(device, oq->context)))
542  {
543  GL_EXTCALL(glEndQuery(GL_SAMPLES_PASSED));
544  checkGLcall("glEndQuery()");
545  }
546  else
547  {
548  FIXME("Wrong thread, can't restart query.\n");
552  }
553  }
554  else
555  {
556  if (oq->context)
560  }
561 
562  GL_EXTCALL(glBeginQuery(GL_SAMPLES_PASSED, oq->id));
563  checkGLcall("glBeginQuery()");
564 
566  oq->started = TRUE;
567  }
568  if (flags & WINED3DISSUE_END)
569  {
570  /* MSDN says END on a non-building occlusion query returns an error,
571  * but our tests show that it returns OK. But OpenGL doesn't like it,
572  * so avoid generating an error. */
573  if (oq->started)
574  {
575  if ((context = context_reacquire(device, oq->context)))
576  {
577  GL_EXTCALL(glEndQuery(GL_SAMPLES_PASSED));
578  checkGLcall("glEndQuery()");
579 
581  poll = TRUE;
582  }
583  else
584  {
585  FIXME("Wrong thread, can't end query.\n");
586  }
587  }
588  oq->started = FALSE;
589  }
590 
591  return poll;
592 }
593 
595 {
597  struct wined3d_device *device = query->device;
598  const struct wined3d_gl_info *gl_info;
599  struct wined3d_context *context;
602 
603  TRACE("query %p, flags %#x.\n", query, flags);
604 
605  if (!(context = context_reacquire(device, tq->context)))
606  {
607  FIXME("%p Wrong thread, returning 1.\n", query);
608  tq->timestamp = 1;
609  return TRUE;
610  }
611  gl_info = context->gl_info;
612 
613  GL_EXTCALL(glGetQueryObjectuiv(tq->id, GL_QUERY_RESULT_AVAILABLE, &available));
614  checkGLcall("glGetQueryObjectuiv(GL_QUERY_RESULT_AVAILABLE)");
615  TRACE("available %#x.\n", available);
616 
617  if (available)
618  {
619  GL_EXTCALL(glGetQueryObjectui64v(tq->id, GL_QUERY_RESULT, &timestamp));
620  checkGLcall("glGetQueryObjectui64v(GL_QUERY_RESULT)");
621  TRACE("Returning timestamp %s.\n", wine_dbgstr_longlong(timestamp));
622  tq->timestamp = timestamp;
623  }
624 
626 
627  return available;
628 }
629 
631 {
633  const struct wined3d_gl_info *gl_info;
634  struct wined3d_context *context;
635 
636  TRACE("query %p, flags %#x.\n", query, flags);
637 
639  {
640  WARN("Ignoring WINED3DISSUE_BEGIN with a TIMESTAMP query.\n");
641  }
642  if (flags & WINED3DISSUE_END)
643  {
644  if (tq->context)
646  context = context_acquire(query->device, NULL, 0);
647  gl_info = context->gl_info;
649  GL_EXTCALL(glQueryCounter(tq->id, GL_TIMESTAMP));
650  checkGLcall("glQueryCounter()");
652 
653  return TRUE;
654  }
655 
656  return FALSE;
657 }
658 
660 {
661  TRACE("query %p, flags %#x.\n", query, flags);
662 
663  return TRUE;
664 }
665 
667 {
668  TRACE("query %p, flags %#x.\n", query, flags);
669 
670  return FALSE;
671 }
672 
674 {
676  struct wined3d_device *device = query->device;
677  GLuint written_available, generated_available;
678  const struct wined3d_gl_info *gl_info;
679  struct wined3d_context *context;
680 
681  TRACE("query %p, flags %#x.\n", query, flags);
682 
683  if (!(context = context_reacquire(device, pq->context)))
684  {
685  FIXME("%p Wrong thread, returning 0 primitives.\n", query);
686  memset(&pq->statistics, 0, sizeof(pq->statistics));
687  return TRUE;
688  }
689  gl_info = context->gl_info;
690 
691  GL_EXTCALL(glGetQueryObjectuiv(pq->u.query.written,
692  GL_QUERY_RESULT_AVAILABLE, &written_available));
693  GL_EXTCALL(glGetQueryObjectuiv(pq->u.query.generated,
694  GL_QUERY_RESULT_AVAILABLE, &generated_available));
695  TRACE("Available %#x, %#x.\n", written_available, generated_available);
696 
697  if (written_available && generated_available)
698  {
699  pq->statistics.primitives_written = get_query_result64(pq->u.query.written, gl_info);
700  pq->statistics.primitives_generated = get_query_result64(pq->u.query.generated, gl_info);
701  TRACE("Returning %s, %s primitives.\n",
702  wine_dbgstr_longlong(pq->statistics.primitives_written),
703  wine_dbgstr_longlong(pq->statistics.primitives_generated));
704  }
705 
706  checkGLcall("poll SO statistics query");
708 
709  return written_available && generated_available;
710 }
711 
713 {
715  struct wined3d_device *device = query->device;
716  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
717  struct wined3d_context *context;
718  BOOL poll = FALSE;
719 
720  TRACE("query %p, flags %#x.\n", query, flags);
721 
723  {
724  if (pq->started)
725  {
726  if ((context = context_reacquire(device, pq->context)))
727  {
729  GL_EXTCALL(glEndQueryIndexed(GL_PRIMITIVES_GENERATED, pq->stream_idx));
730  }
731  else
732  {
733  FIXME("Wrong thread, can't restart query.\n");
737  }
738  }
739  else
740  {
741  if (pq->context)
745  }
746 
748  pq->stream_idx, pq->u.query.written));
749  GL_EXTCALL(glBeginQueryIndexed(GL_PRIMITIVES_GENERATED,
750  pq->stream_idx, pq->u.query.generated));
751  checkGLcall("begin query");
752 
754  pq->started = TRUE;
755  }
756  if (flags & WINED3DISSUE_END)
757  {
758  if (pq->started)
759  {
760  if ((context = context_reacquire(device, pq->context)))
761  {
763  GL_EXTCALL(glEndQueryIndexed(GL_PRIMITIVES_GENERATED, pq->stream_idx));
764  checkGLcall("end query");
765 
767  poll = TRUE;
768  }
769  else
770  {
771  FIXME("Wrong thread, can't end query.\n");
772  }
773  }
774  pq->started = FALSE;
775  }
776 
777  return poll;
778 }
779 
781 {
783  struct wined3d_device *device = query->device;
784  const struct wined3d_gl_info *gl_info;
785  struct wined3d_context *context;
787  int i;
788 
789  TRACE("query %p, flags %#x.\n", query, flags);
790 
791  if (!(context = context_reacquire(device, pq->context)))
792  {
793  FIXME("%p Wrong thread.\n", query);
794  memset(&pq->statistics, 0, sizeof(pq->statistics));
795  return TRUE;
796  }
797  gl_info = context->gl_info;
798 
799  for (i = 0; i < ARRAY_SIZE(pq->u.id); ++i)
800  {
801  GL_EXTCALL(glGetQueryObjectuiv(pq->u.id[i], GL_QUERY_RESULT_AVAILABLE, &available));
802  if (!available)
803  break;
804  }
805 
806  if (available)
807  {
808  pq->statistics.vertices_submitted = get_query_result64(pq->u.query.vertices, gl_info);
809  pq->statistics.primitives_submitted = get_query_result64(pq->u.query.primitives, gl_info);
810  pq->statistics.vs_invocations = get_query_result64(pq->u.query.vertex_shader, gl_info);
811  pq->statistics.hs_invocations = get_query_result64(pq->u.query.tess_control_shader, gl_info);
812  pq->statistics.ds_invocations = get_query_result64(pq->u.query.tess_eval_shader, gl_info);
813  pq->statistics.gs_invocations = get_query_result64(pq->u.query.geometry_shader, gl_info);
814  pq->statistics.gs_primitives = get_query_result64(pq->u.query.geometry_primitives, gl_info);
815  pq->statistics.ps_invocations = get_query_result64(pq->u.query.fragment_shader, gl_info);
816  pq->statistics.cs_invocations = get_query_result64(pq->u.query.compute_shader, gl_info);
817  pq->statistics.clipping_input_primitives = get_query_result64(pq->u.query.clipping_input, gl_info);
818  pq->statistics.clipping_output_primitives = get_query_result64(pq->u.query.clipping_output, gl_info);
819  }
820 
821  checkGLcall("poll pipeline statistics query");
823  return available;
824 }
825 
827  struct wined3d_context *context)
828 {
829  const struct wined3d_gl_info *gl_info = context->gl_info;
830 
842  checkGLcall("end query");
843 }
844 
846 {
848  struct wined3d_device *device = query->device;
849  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
850  struct wined3d_context *context;
851  BOOL poll = FALSE;
852 
853  TRACE("query %p, flags %#x.\n", query, flags);
854 
856  {
857  if (pq->started)
858  {
859  if ((context = context_reacquire(device, pq->context)))
860  {
862  }
863  else
864  {
865  FIXME("Wrong thread, can't restart query.\n");
869  }
870  }
871  else
872  {
873  if (pq->context)
877  }
878 
879  GL_EXTCALL(glBeginQuery(GL_VERTICES_SUBMITTED_ARB, pq->u.query.vertices));
880  GL_EXTCALL(glBeginQuery(GL_PRIMITIVES_SUBMITTED_ARB, pq->u.query.primitives));
881  GL_EXTCALL(glBeginQuery(GL_VERTEX_SHADER_INVOCATIONS_ARB, pq->u.query.vertex_shader));
882  GL_EXTCALL(glBeginQuery(GL_TESS_CONTROL_SHADER_PATCHES_ARB, pq->u.query.tess_control_shader));
883  GL_EXTCALL(glBeginQuery(GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB, pq->u.query.tess_eval_shader));
884  GL_EXTCALL(glBeginQuery(GL_GEOMETRY_SHADER_INVOCATIONS, pq->u.query.geometry_shader));
885  GL_EXTCALL(glBeginQuery(GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB, pq->u.query.geometry_primitives));
886  GL_EXTCALL(glBeginQuery(GL_FRAGMENT_SHADER_INVOCATIONS_ARB, pq->u.query.fragment_shader));
887  GL_EXTCALL(glBeginQuery(GL_COMPUTE_SHADER_INVOCATIONS_ARB, pq->u.query.compute_shader));
888  GL_EXTCALL(glBeginQuery(GL_CLIPPING_INPUT_PRIMITIVES_ARB, pq->u.query.clipping_input));
889  GL_EXTCALL(glBeginQuery(GL_CLIPPING_OUTPUT_PRIMITIVES_ARB, pq->u.query.clipping_output));
890  checkGLcall("begin query");
891 
893  pq->started = TRUE;
894  }
895  if (flags & WINED3DISSUE_END)
896  {
897  if (pq->started)
898  {
899  if ((context = context_reacquire(device, pq->context)))
900  {
903  poll = TRUE;
904  }
905  else
906  {
907  FIXME("Wrong thread, can't end query.\n");
908  }
909  }
910  pq->started = FALSE;
911  }
912 
913  return poll;
914 }
915 
917 {
918  TRACE("query %p, flags %#x.\n", query, flags);
919 
920  return TRUE;
921 }
922 
924 {
925  FIXME("query %p, flags %#x.\n", query, flags);
926 
927  return FALSE;
928 }
929 
931 {
932  TRACE("query %p, flags %#x.\n", query, flags);
933 
934  return TRUE;
935 }
936 
938 {
939  FIXME("query %p, flags %#x.\n", query, flags);
940 
941  return FALSE;
942 }
943 
945 {
947 
948  wined3d_fence_free(&event_query->fence);
949  heap_free(event_query);
950 }
951 
952 static const struct wined3d_query_ops event_query_ops =
953 {
957 };
958 
960  enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops,
961  struct wined3d_query **query)
962 {
963  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
964  struct wined3d_event_query *object;
965  HRESULT hr;
966 
967  TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
968  device, type, parent, parent_ops, query);
969 
970  if (!(object = heap_alloc_zero(sizeof(*object))))
971  return E_OUTOFMEMORY;
972 
973  if (FAILED(hr = wined3d_fence_init(&object->fence, gl_info)))
974  {
975  WARN("Event queries not supported.\n");
976  heap_free(object);
977  return hr;
978  }
979 
980  wined3d_query_init(&object->query, device, type, &object->signalled,
981  sizeof(object->signalled), &event_query_ops, parent, parent_ops);
982 
983  TRACE("Created query %p.\n", object);
984  *query = &object->query;
985 
986  return WINED3D_OK;
987 }
988 
990 {
992 
993  if (oq->context)
995  heap_free(oq);
996 }
997 
999 {
1003 };
1004 
1006  enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops,
1007  struct wined3d_query **query)
1008 {
1009  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
1011 
1012  TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
1013  device, type, parent, parent_ops, query);
1014 
1015  if (!gl_info->supported[ARB_OCCLUSION_QUERY])
1016  {
1017  WARN("Unsupported in local OpenGL implementation: ARB_OCCLUSION_QUERY.\n");
1018  return WINED3DERR_NOTAVAILABLE;
1019  }
1020 
1021  if (!(object = heap_alloc_zero(sizeof(*object))))
1022  return E_OUTOFMEMORY;
1023 
1024  wined3d_query_init(&object->query, device, type, &object->samples,
1025  sizeof(object->samples), &occlusion_query_ops, parent, parent_ops);
1026 
1027  TRACE("Created query %p.\n", object);
1028  *query = &object->query;
1029 
1030  return WINED3D_OK;
1031 }
1032 
1034 {
1036 
1037  if (tq->context)
1039  heap_free(tq);
1040 }
1041 
1043 {
1047 };
1048 
1050  enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops,
1051  struct wined3d_query **query)
1052 {
1053  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
1055 
1056  TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
1057  device, type, parent, parent_ops, query);
1058 
1059  if (!gl_info->supported[ARB_TIMER_QUERY])
1060  {
1061  WARN("Unsupported in local OpenGL implementation: ARB_TIMER_QUERY.\n");
1062  return WINED3DERR_NOTAVAILABLE;
1063  }
1064 
1065  if (!(object = heap_alloc_zero(sizeof(*object))))
1066  return E_OUTOFMEMORY;
1067 
1068  wined3d_query_init(&object->query, device, type, &object->timestamp,
1069  sizeof(object->timestamp), &timestamp_query_ops, parent, parent_ops);
1070 
1071  TRACE("Created query %p.\n", object);
1072  *query = &object->query;
1073 
1074  return WINED3D_OK;
1075 }
1076 
1078 {
1079  heap_free(query);
1080 }
1081 
1083 {
1087 };
1088 
1090  enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops,
1091  struct wined3d_query **query)
1092 {
1093  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
1094  struct wined3d_query *object;
1095 
1096  TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
1098 
1099  if (!gl_info->supported[ARB_TIMER_QUERY])
1100  {
1101  WARN("Unsupported in local OpenGL implementation: ARB_TIMER_QUERY.\n");
1102  return WINED3DERR_NOTAVAILABLE;
1103  }
1104 
1105  if (!(object = heap_alloc_zero(sizeof(*object))))
1106  return E_OUTOFMEMORY;
1107 
1109  {
1110  static const struct wined3d_query_data_timestamp_disjoint disjoint_data = {1000 * 1000 * 1000, FALSE};
1111 
1112  wined3d_query_init(object, device, type, &disjoint_data,
1113  sizeof(disjoint_data), &timestamp_disjoint_query_ops, parent, parent_ops);
1114  }
1115  else
1116  {
1117  static const UINT64 freq = 1000 * 1000 * 1000;
1118 
1119  wined3d_query_init(object, device, type, &freq,
1120  sizeof(freq), &timestamp_disjoint_query_ops, parent, parent_ops);
1121  }
1122 
1123  TRACE("Created query %p.\n", object);
1124  *query = object;
1125 
1126  return WINED3D_OK;
1127 }
1128 
1130 {
1132 
1133  if (pq->context)
1135  heap_free(pq);
1136 }
1137 
1139 {
1143 };
1144 
1146  enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops,
1147  struct wined3d_query **query)
1148 {
1149  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
1151  unsigned int stream_idx;
1152 
1155  else
1156  return WINED3DERR_NOTAVAILABLE;
1157 
1158  TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
1159  device, type, parent, parent_ops, query);
1160 
1161  if (!gl_info->supported[WINED3D_GL_PRIMITIVE_QUERY])
1162  {
1163  WARN("OpenGL implementation does not support primitive queries.\n");
1164  return WINED3DERR_NOTAVAILABLE;
1165  }
1166  if (!gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
1167  {
1168  WARN("OpenGL implementation does not support indexed queries.\n");
1169  return WINED3DERR_NOTAVAILABLE;
1170  }
1171 
1172  if (!(object = heap_alloc_zero(sizeof(*object))))
1173  return E_OUTOFMEMORY;
1174 
1175  wined3d_query_init(&object->query, device, type, &object->statistics,
1176  sizeof(object->statistics), &so_statistics_query_ops, parent, parent_ops);
1177  object->stream_idx = stream_idx;
1178 
1179  TRACE("Created query %p.\n", object);
1180  *query = &object->query;
1181 
1182  return WINED3D_OK;
1183 }
1184 
1186 {
1188  if (pq->context)
1190  heap_free(pq);
1191 }
1192 
1194 {
1198 };
1199 
1201  enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops,
1202  struct wined3d_query **query)
1203 {
1204  const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
1206 
1207  TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
1208  device, type, parent, parent_ops, query);
1209 
1211  {
1212  WARN("OpenGL implementation does not support pipeline statistics queries.\n");
1213  return WINED3DERR_NOTAVAILABLE;
1214  }
1215 
1216  if (!(object = heap_alloc_zero(sizeof(*object))))
1217  return E_OUTOFMEMORY;
1218 
1219  wined3d_query_init(&object->query, device, type, &object->statistics,
1220  sizeof(object->statistics), &pipeline_query_ops, parent, parent_ops);
1221 
1222  TRACE("Created query %p.\n", object);
1223  *query = &object->query;
1224 
1225  return WINED3D_OK;
1226 }
1227 
1229 {
1230  HeapFree(GetProcessHeap(), 0, query);
1231 }
1232 
1234 {
1238 };
1239 
1241  enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops,
1242  struct wined3d_query **query)
1243 {
1244  static const struct wined3d_query_data_so_statistics statistics = { 1, 1 };
1245  struct wined3d_query *object;
1246 
1247  FIXME("device %p, type %#x, parent %p, query %p.\n", device, type, parent, query);
1248 
1249  if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
1250  return E_OUTOFMEMORY;
1251 
1252  wined3d_query_init(object, device, type, &statistics,
1253  sizeof(statistics), &statistics_query_ops, parent, parent_ops);
1254 
1255  TRACE("Created query %p.\n", object);
1256  *query = object;
1257 
1258  return WINED3D_OK;
1259 }
1260 
1262 {
1263  HeapFree(GetProcessHeap(), 0, query);
1264 }
1265 
1267 {
1271 };
1272 
1274  enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops,
1275  struct wined3d_query **query)
1276 {
1277  static const BOOL overflow = FALSE;
1278  struct wined3d_query *object;
1279 
1280  FIXME("device %p, type %#x, parent %p, query %p.\n", device, type, parent, query);
1281 
1282  if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
1283  return E_OUTOFMEMORY;
1284 
1285  wined3d_query_init(object, device, type, &overflow,
1286  sizeof(overflow), &overflow_query_ops, parent, parent_ops);
1287 
1288  TRACE("Created query %p.\n", object);
1289  *query = object;
1290 
1291  return WINED3D_OK;
1292 }
1293 
1295  void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
1296 {
1297  TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
1299 
1300  switch (type)
1301  {
1304 
1307 
1310 
1314 
1320 
1323 
1326 
1329 
1330  default:
1331  FIXME("Unhandled query type %#x.\n", type);
1332  return WINED3DERR_NOTAVAILABLE;
1333  }
1334 }
#define GL_VERTICES_SUBMITTED_ARB
Definition: wgl.h:4857
#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN
Definition: glext.h:551
static HRESULT wined3d_timestamp_disjoint_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1089
union wined3d_gl_fence_object object
union wined3d_gl_pipeline_statistics_query u
#define WINED3DERR_INVALIDCALL
Definition: wined3d.h:48
#define GL_SAMPLES_PASSED
Definition: glext.h:356
void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *query, DWORD flags)
Definition: cs.c:1934
static BOOL wined3d_overflow_query_ops_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:937
#define TRUE
Definition: types.h:120
static BOOL wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:630
static const struct wined3d_query_ops so_statistics_query_ops
Definition: query.c:1138
static HRESULT wined3d_timestamp_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1049
struct wined3d_context * context
#define GL_CLIPPING_INPUT_PRIMITIVES_ARB
Definition: wgl.h:400
HRESULT wined3d_fence_create(struct wined3d_device *device, struct wined3d_fence **fence)
Definition: query.c:303
HRESULT hr
Definition: shlfolder.c:183
void context_free_fence(struct wined3d_fence *fence)
Definition: context.c:904
#define GL_SYNC_FLUSH_COMMANDS_BIT
Definition: glext.h:1930
Definition: http.c:7098
#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB
Definition: wgl.h:1450
void context_alloc_so_statistics_query(struct wined3d_context *context, struct wined3d_so_statistics_query *query)
Definition: context.c:961
#define WARN(fmt,...)
Definition: debug.h:111
void context_free_timestamp_query(struct wined3d_timestamp_query *query)
Definition: context.c:943
static void wined3d_pipeline_statistics_query_end(struct wined3d_pipeline_statistics_query *query, struct wined3d_context *context)
Definition: query.c:826
#define GL_TIMEOUT_EXPIRED
Definition: glext.h:1927
static struct wined3d_timestamp_query * wined3d_timestamp_query_from_query(struct wined3d_query *query)
Definition: query.c:70
UINT CDECL wined3d_query_get_data_size(const struct wined3d_query *query)
Definition: query.c:403
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define GL_SYNC_GPU_COMMANDS_COMPLETE
Definition: glext.h:1923
#define WINED3DGETDATA_FLUSH
Definition: wined3d.h:763
#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB
Definition: wgl.h:1562
struct wined3d_context * context
static struct wined3d_pipeline_statistics_query * wined3d_pipeline_statistics_query_from_query(struct wined3d_query *query)
Definition: query.c:80
void wined3d_cs_destroy_object(struct wined3d_cs *cs, void(*callback)(void *object), void *object)
Definition: cs.c:1885
static BOOL wined3d_overflow_query_ops_poll(struct wined3d_query *query, DWORD flags)
Definition: query.c:930
static HRESULT wined3d_pipeline_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1200
void wined3d_fence_destroy(struct wined3d_fence *fence)
Definition: query.c:286
#define GL_VERTEX_SHADER_INVOCATIONS_ARB
Definition: wgl.h:4831
static void wined3d_statistics_query_ops_destroy(struct wined3d_query *query)
Definition: query.c:1228
void *CDECL wined3d_query_get_parent(const struct wined3d_query *query)
Definition: query.c:491
struct wined3d_gl_so_statistics_query::@276 query
static BOOL wined3d_statistics_query_ops_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:923
static HRESULT wined3d_fence_init(struct wined3d_fence *fence, const struct wined3d_gl_info *gl_info)
Definition: query.c:292
#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB
Definition: wgl.h:402
static const struct wined3d_query_ops overflow_query_ops
Definition: query.c:1266
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct wined3d_fence fence
#define WINED3DISSUE_BEGIN
Definition: wined3d.h:761
HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, void *data, UINT data_size, DWORD flags)
Definition: query.c:364
static void wined3d_pipeline_query_ops_destroy(struct wined3d_query *query)
Definition: query.c:1185
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static BOOL wined3d_pipeline_query_ops_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:845
static UINT64 get_query_result64(GLuint id, const struct wined3d_gl_info *gl_info)
Definition: query.c:28
WINE_DEFAULT_DEBUG_CHANNEL(d3d9)
unsigned int BOOL
Definition: ntddk_ex.h:94
wined3d_query_type
Definition: wined3d.h:704
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL supported[WINED3D_GL_EXT_COUNT]
#define S_FALSE
Definition: winerror.h:2357
static void wined3d_timestamp_query_ops_destroy(struct wined3d_query *query)
Definition: query.c:1033
static HRESULT wined3d_occlusion_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1005
smooth NULL
Definition: ftsmooth.c:416
static WCHAR available[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2336
void wined3d_cs_emit_flush(struct wined3d_cs *cs)
Definition: cs.c:930
static BOOL wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:525
#define GL_QUERY_RESULT
Definition: glext.h:334
static HRESULT wined3d_event_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:959
static struct wined3d_event_query * wined3d_event_query_from_query(struct wined3d_query *query)
Definition: query.c:60
static BOOL wined3d_occlusion_query_ops_poll(struct wined3d_query *query, DWORD flags)
Definition: query.c:427
#define GL_GEOMETRY_SHADER_INVOCATIONS
Definition: glext.h:2051
static void wined3d_query_init(struct wined3d_query *query, struct wined3d_device *device, enum wined3d_query_type type, const void *data, DWORD data_size, const struct wined3d_query_ops *query_ops, void *parent, const struct wined3d_parent_ops *parent_ops)
Definition: query.c:44
struct wined3d_context * context
void context_release(struct wined3d_context *context)
Definition: context.c:1571
struct wined3d_gl_pipeline_statistics_query::@277 query
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static HRESULT wined3d_so_statistics_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1145
static const struct wined3d_query_ops pipeline_query_ops
Definition: query.c:1193
static const struct wined3d_query_ops event_query_ops
Definition: query.c:952
static enum wined3d_fence_result wined3d_fence_test(const struct wined3d_fence *fence, const struct wined3d_device *device, DWORD flags)
Definition: query.c:91
#define GL_COMPUTE_SHADER_INVOCATIONS_ARB
Definition: wgl.h:692
#define GL_EXTCALL(f)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
static void wined3d_occlusion_query_ops_destroy(struct wined3d_query *query)
Definition: query.c:989
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define GL_QUERY_RESULT_AVAILABLE
Definition: glext.h:335
r parent
Definition: btrfs.c:2869
LONG HRESULT
Definition: typedefs.h:77
static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD flags)
Definition: query.c:594
HANDLE thread
Definition: pdh_main.c:145
#define GL_CONDITION_SATISFIED
Definition: glext.h:1928
int poll(struct pollfd *ufds, int nfds, int timeout)
Definition: adnstest.c:68
static const struct wined3d_query_ops timestamp_query_ops
Definition: query.c:1042
#define GL_TIMESTAMP
Definition: glext.h:2037
#define WINED3D_OK
Definition: wined3d.h:37
#define GL_WAIT_FAILED
Definition: glext.h:1929
static HRESULT wined3d_statistics_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1240
struct wined3d_query_data_so_statistics statistics
unsigned long DWORD
Definition: ntddk_ex.h:95
void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query)
Definition: context.c:923
void context_alloc_pipeline_statistics_query(struct wined3d_context *context, struct wined3d_pipeline_statistics_query *query)
Definition: context.c:1002
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void context_alloc_fence(struct wined3d_context *context, struct wined3d_fence *fence)
Definition: context.c:863
static const struct wined3d_query_ops occlusion_query_ops
Definition: query.c:998
static void wined3d_so_statistics_query_ops_destroy(struct wined3d_query *query)
Definition: query.c:1129
GLbitfield flags
Definition: glext.h:7161
static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:712
struct wined3d_context * context
static BOOL wined3d_so_statistics_query_ops_poll(struct wined3d_query *query, DWORD flags)
Definition: query.c:673
static void wined3d_timestamp_disjoint_query_ops_destroy(struct wined3d_query *query)
Definition: query.c:1077
void wined3d_fence_issue(struct wined3d_fence *fence, const struct wined3d_device *device)
Definition: query.c:244
int ret
static BOOL wined3d_statistics_query_ops_poll(struct wined3d_query *query, DWORD flags)
Definition: query.c:916
void context_free_so_statistics_query(struct wined3d_so_statistics_query *query)
Definition: context.c:983
#define InterlockedDecrement
Definition: armddk.h:52
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int GLenum
Definition: gl.h:150
static HRESULT wined3d_overflow_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1273
static BOOL wined3d_timestamp_disjoint_query_ops_poll(struct wined3d_query *query, DWORD flags)
Definition: query.c:659
#define ERR(fmt,...)
Definition: debug.h:109
struct wined3d_context * context_acquire(const struct wined3d_device *device, struct wined3d_texture *texture, unsigned int sub_resource_idx)
Definition: context.c:4242
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
static struct wined3d_occlusion_query * wined3d_occlusion_query_from_query(struct wined3d_query *query)
Definition: query.c:65
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int GLuint
Definition: gl.h:159
static const struct wined3d_query_ops timestamp_disjoint_query_ops
Definition: query.c:1082
void context_alloc_occlusion_query(struct wined3d_context *context, struct wined3d_occlusion_query *query)
Definition: context.c:816
#define CDECL
Definition: compat.h:21
HRESULT CDECL wined3d_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1294
#define ARRAY_SIZE(a)
Definition: main.h:24
wined3d_fence_result
enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query *query)
Definition: query.c:498
#define checkGLcall(A)
#define WINED3DERR_NOTAVAILABLE
Definition: wined3d.h:46
#define min(a, b)
Definition: monoChain.cc:55
struct wined3d_context * context_reacquire(const struct wined3d_device *device, struct wined3d_context *context)
Definition: context.c:4305
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define WINED3DISSUE_END
Definition: wined3d.h:762
#define GL_TESS_CONTROL_SHADER_PATCHES_ARB
Definition: wgl.h:4068
static BOOL wined3d_pipeline_query_ops_poll(struct wined3d_query *query, DWORD flags)
Definition: query.c:780
static BOOL wined3d_fence_supported(const struct wined3d_gl_info *gl_info)
Definition: query.c:86
static struct wined3d_so_statistics_query * wined3d_so_statistics_query_from_query(struct wined3d_query *query)
Definition: query.c:75
#define GL_ALREADY_SIGNALED
Definition: glext.h:1926
#define GL_ALL_COMPLETED_NV
Definition: glext.h:3621
static BOOL wined3d_timestamp_disjoint_query_ops_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:666
static const struct wined3d_query_ops statistics_query_ops
Definition: query.c:1233
struct wined3d_query_data_pipeline_statistics statistics
enum wined3d_fence_result wined3d_fence_wait(const struct wined3d_fence *fence, const struct wined3d_device *device)
Definition: query.c:169
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
static void wined3d_query_destroy_object(void *object)
Definition: query.c:335
const struct wined3d_gl_info * gl_info
void context_free_occlusion_query(struct wined3d_occlusion_query *query)
Definition: context.c:844
HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:410
unsigned long long UINT64
ULONG CDECL wined3d_query_incref(struct wined3d_query *query)
Definition: query.c:326
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
const struct wined3d_parent_ops * parent_ops
#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB
Definition: wgl.h:4077
static void wined3d_fence_free(struct wined3d_fence *fence)
Definition: query.c:280
static BOOL wined3d_event_query_ops_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:505
#define HeapFree(x, y, z)
Definition: compat.h:402
uint64_t GLuint64
Definition: glext.h:5568
static void wined3d_overflow_query_ops_destroy(struct wined3d_query *query)
Definition: query.c:1261
union wined3d_gl_so_statistics_query u
void * object
Definition: jmemsys.h:48
static BOOL wined3d_event_query_ops_poll(struct wined3d_query *query, DWORD flags)
Definition: query.c:460
ULONG CDECL wined3d_query_decref(struct wined3d_query *query)
Definition: query.c:349
void context_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query *query)
Definition: context.c:1021
static void wined3d_event_query_ops_destroy(struct wined3d_query *query)
Definition: query.c:944
struct wined3d_context * context
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define GL_PRIMITIVES_GENERATED
Definition: glext.h:550
#define GL_PRIMITIVES_SUBMITTED_ARB
Definition: wgl.h:3174