Panda3D

Loading...
Searching...
No Matches
pStatGPUTimer.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pStatGPUTimer.I
10 * @author rdb
11 * @date 2014-08-21
12 */
13
14#ifdef DO_PSTATS
15
16/**
17 *
18 */
19INLINE PStatGPUTimer::
20PStatGPUTimer(GraphicsStateGuardian *gsg, PStatCollector &collector) :
21 PStatTimer(collector),
22 _gsg(gsg)
23{
24 if (gsg->get_timer_queries_active() && collector.is_active()) {
25 gsg->issue_timer_query(collector.get_index());
26 // cerr << "issuing " << collector << " active " << collector.is_active()
27 // << "\n";
28 }
29}
30
31/**
32 *
33 */
34INLINE PStatGPUTimer::
35PStatGPUTimer(GraphicsStateGuardian *gsg, PStatCollector &collector, Thread *current_thread) :
36 PStatTimer(collector, current_thread),
37 _gsg(gsg)
38{
39 if (gsg->get_timer_queries_active() && collector.is_active()) {
40 gsg->issue_timer_query(collector.get_index());
41 }
42}
43
44/**
45 *
46 */
47INLINE PStatGPUTimer::
48~PStatGPUTimer() {
49 if (_gsg->get_timer_queries_active() && _collector.is_active()) {
50 _gsg->issue_timer_query(_collector.get_index() | 0x8000);
51 }
52}
53
54#endif
GraphicsStateGuardian
Encapsulates all the communication with a particular instance of a given rendering backend.
Definition graphicsStateGuardian.h:65
GraphicsStateGuardian::get_timer_queries_active
get_timer_queries_active
Returns true if timer queries are currently enabled on this GSG.
Definition graphicsStateGuardian.h:222
PStatCollector
A lightweight class that represents a single element that may be timed and/or counted via stats.
Definition pStatCollector.h:43
PStatTimer
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
Definition pStatTimer.h:30
Thread
A thread; that is, a lightweight process.
Definition thread.h:46