2 #define _GPU_TIMERS_H 1
9 extern bool enable_timing;
10 extern bool detailed_timing;
11 extern bool in_warmup;
16 std::pair<GLuint, GLuint> begin_timer(const std::string &name, int level);
22 std::pair<GLuint, GLuint> query;
24 std::vector<Timer> timers;
27 // A simple RAII class for timing until the end of the scope.
30 ScopedTimer(const std::string &name, GPUTimers *timers)
31 : timers(timers), level(0)
33 query = timers->begin_timer(name, level);
36 ScopedTimer(const std::string &name, ScopedTimer *parent_timer)
37 : timers(parent_timer->timers),
38 level(parent_timer->level + 1)
40 query = timers->begin_timer(name, level);
50 if (enable_timing && !ended) {
51 glQueryCounter(query.second, GL_TIMESTAMP);
59 std::pair<GLuint, GLuint> query;
63 #endif // !defined(_GPU_TIMERS_H)