Skip to content

Commit d3fe254

Browse files
corporatesharkmeta-codesync[bot]
authored andcommitted
igl | opengl | Add Tracy profiler markers to Timer
Reviewed By: rudybear Differential Revision: D114575235 fbshipit-source-id: ee8d73b1ea4d0830c4328bc6da09537353293183
1 parent 6fe6905 commit d3fe254

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/igl/opengl/Timer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <igl/opengl/Timer.h>
99

10+
#include <igl/Macros.h>
1011
#include <igl/opengl/DeviceFeatureSet.h>
1112

1213
namespace igl::opengl {
@@ -28,19 +29,23 @@ namespace igl::opengl {
2829
#endif
2930

3031
Timer::Timer(IContext& context) : WithContext(context) {
32+
IGL_PROFILER_FUNCTION_COLOR(IGL_PROFILER_COLOR_CREATE);
3133
iglGenQueries(1, &id_);
3234
iglBeginQuery(GL_TIME_ELAPSED, id_);
3335
}
3436

3537
Timer::~Timer() {
38+
IGL_PROFILER_FUNCTION_COLOR(IGL_PROFILER_COLOR_DESTROY);
3639
iglDeleteQueries(1, &id_);
3740
}
3841

3942
void Timer::end() {
43+
IGL_PROFILER_FUNCTION();
4044
iglEndQuery(GL_TIME_ELAPSED);
4145
}
4246

4347
uint64_t Timer::getElapsedTimeNanos() const {
48+
IGL_PROFILER_FUNCTION();
4449
// Check for GPU disjoint event (power management, context switch, etc.)
4550
// If a disjoint occurred, the timing results are invalid
4651
if (DeviceFeatureSet::usesOpenGLES()) {
@@ -57,6 +62,7 @@ uint64_t Timer::getElapsedTimeNanos() const {
5762
}
5863

5964
bool Timer::resultsAvailable() const {
65+
IGL_PROFILER_FUNCTION();
6066
GLint available = 0;
6167
iglGetQueryObjectiv(id_, GL_QUERY_RESULT_AVAILABLE, &available);
6268
// NOLINTNEXTLINE(readability-implicit-bool-conversion)

0 commit comments

Comments
 (0)