2 #define _GPU_TIMERS_H 1
10 extern bool enable_timing;
11 extern bool detailed_timing;
12 extern bool in_warmup;
17 std::pair<GLuint, GLuint> begin_timer(const std::string &name, int level);
23 std::pair<GLuint, GLuint> query;
25 std::vector<Timer> timers;
28 // A simple RAII class for timing until the end of the scope.
31 ScopedTimer(const std::string &name, GPUTimers *timers)
32 : timers(timers), level(0)
34 query = timers->begin_timer(name, level);
37 ScopedTimer(const std::string &name, ScopedTimer *parent_timer)
38 : timers(parent_timer->timers),
39 level(parent_timer->level + 1)
41 query = timers->begin_timer(name, level);
51 if (enable_timing && !ended) {
52 glQueryCounter(query.second, GL_TIMESTAMP);
60 std::pair<GLuint, GLuint> query;
64 #endif // !defined(_GPU_TIMERS_H)