Skip to content

Instantly share code, notes, and snippets.

@chinmaygarde
Created April 18, 2017 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chinmaygarde/607eb86d5447615b9cf2804a4f8fb1ce to your computer and use it in GitHub Desktop.
Save chinmaygarde/607eb86d5447615b9cf2804a4f8fb1ce to your computer and use it in GitHub Desktop.
Trace Skia GL Calls to Timeline
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index 7503371..6386d6a 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -11,6 +11,7 @@
#include "gl/GrGLInterface.h"
#include "GrGLDefines.h"
#include "GrStencilSettings.h"
+#include "SkTraceEvent.h"
class SkMatrix;
@@ -186,6 +187,7 @@ void GrGLClearErr(const GrGLInterface* gl);
// the caller wants to do its own glGetError() call and examine the error value.
#define GR_GL_CALL_NOERRCHECK(IFACE, X) \
do { \
+ TRACE_EVENT0("flutter", #X) \
(IFACE)->fFunctions.f##X; \
GR_GL_LOG_CALLS_IMPL(X); \
} while (false)
@@ -200,6 +202,7 @@ void GrGLClearErr(const GrGLInterface* gl);
// same as GR_GL_CALL_RET but always skips the error check.
#define GR_GL_CALL_RET_NOERRCHECK(IFACE, RET, X) \
do { \
+ TRACE_EVENT0("flutter", #X) \
(RET) = (IFACE)->fFunctions.f##X; \
GR_GL_LOG_CALLS_IMPL(X); \
} while (false)
@dnfield
Copy link

dnfield commented May 28, 2019

Updated for today:

diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index dd25823c40..3d555a92ad 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -12,6 +12,7 @@
 #include "include/private/GrTypesPriv.h"
 #include "src/gpu/GrStencilSettings.h"
 #include "src/gpu/gl/GrGLDefines.h"
+#include "src/core/SkTraceEvent.h"
 
 class SkMatrix;
 
@@ -236,6 +237,7 @@ void GrGLClearErr(const GrGLInterface* gl);
 // the caller wants to do its own glGetError() call and examine the error value.
 #define GR_GL_CALL_NOERRCHECK(IFACE, X)                         \
     do {                                                        \
+        TRACE_EVENT0("flutter", #X);                            \
         (IFACE)->fFunctions.f##X;                               \
         GR_GL_LOG_CALLS_IMPL(X);                                \
     } while (false)
@@ -250,6 +252,7 @@ void GrGLClearErr(const GrGLInterface* gl);
 // same as GR_GL_CALL_RET but always skips the error check.
 #define GR_GL_CALL_RET_NOERRCHECK(IFACE, RET, X)                \
     do {                                                        \
+        TRACE_EVENT0("flutter", #X);                            \
         (RET) = (IFACE)->fFunctions.f##X;                       \
         GR_GL_LOG_CALLS_IMPL(X);                                \
     } while (false)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment