<div dir="ltr"><div>It's a good idea.</div><div><br></div>But I think that instead of GL_GREMEDY_string_marker it would be better to use GL_KHR_debug and<div><br><font face="monospace, monospace">  glDebugMessageInsert(GL_DEBUG_SOURCE_THIRD_PARTY,...)</font></div><div><br>as KHR_debug already foresees this sort of usage (from the spec):</div><br>    "A message's source identifies the origin of the message and can either<br><div>    describe components of the GL, the window system, third-party external<div>    sources such as external debuggers, or even the application itself."<div><br></div><div>We could also use an unique message id (like `APTR`) so the OpenGL driver can treat this message specially (e.g., use it to annotate its command lists, etc.)</div><div><br></div><div>This also should only be done when retrace::debug option is enabled (in particular, nothing of the sort should be attempted when benchmarking.)</div><div><br><div>Jose</div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 10, 2015 at 11:14 PM, Rob Clark <span dir="ltr"><<a href="mailto:robdclark@gmail.com" target="_blank">robdclark@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If the extension is present, use it to log call numbers for draw<br>
commands.<br>
<br>
Signed-off-by: Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>><br>
---<br>
 retrace/glretrace.hpp      |  2 ++<br>
 retrace/glretrace_main.cpp | 15 +++++++++++++++<br>
 retrace/retrace.hpp        |  2 ++<br>
 retrace/retrace_main.cpp   |  4 ++++<br>
 4 files changed, 23 insertions(+)<br>
<br>
diff --git a/retrace/glretrace.hpp b/retrace/glretrace.hpp<br>
index b172f85..ebd5996 100644<br>
--- a/retrace/glretrace.hpp<br>
+++ b/retrace/glretrace.hpp<br>
@@ -55,6 +55,8 @@ struct Context {<br>
<br>
     bool used;<br>
<br>
+    bool GREMEDY_string_marker;<br>
+<br>
     inline glprofile::Profile<br>
     profile(void) const {<br>
         return wsContext->profile;<br>
diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp<br>
index 71dde8e..513aca3 100755<br>
--- a/retrace/glretrace_main.cpp<br>
+++ b/retrace/glretrace_main.cpp<br>
@@ -348,6 +348,7 @@ initContext() {<br>
     supportsElapsed     = currentContext->hasExtension("GL_EXT_timer_query") || supportsTimestamp;<br>
     supportsOcclusion   = currentProfile.versionGreaterOrEqual(glprofile::API_GL, 1, 5);<br>
     supportsARBShaderObjects = currentContext->hasExtension("GL_ARB_shader_objects");<br>
+    currentContext->GREMEDY_string_marker = currentContext->hasExtension("GL_GREMEDY_string_marker");<br>
<br>
 #ifdef __APPLE__<br>
     // GL_TIMESTAMP doesn't work on Apple.  GL_TIME_ELAPSED still does however.<br>
@@ -620,6 +621,20 @@ public:<br>
     dumpState(StateWriter &writer) {<br>
         glstate::dumpCurrentContext(writer);<br>
     }<br>
+<br>
+    void<br>
+    log(trace::Call &call) {<br>
+        glretrace::Context *currentContext = glretrace::getCurrentContext();<br>
+        if (currentContext && currentContext->GREMEDY_string_marker) {<br>
+            char *str;<br>
+            int len = asprintf(&str, "%d:%s", <a href="http://call.no" rel="noreferrer" target="_blank">call.no</a>, <a href="http://call.name" rel="noreferrer" target="_blank">call.name</a>());<br>
+            if (len > 0) {<br>
+                glStringMarkerGREMEDY(len, str);<br>
+                free(str);<br>
+            }<br>
+        }<br>
+    }<br>
+<br>
 };<br>
<br>
 static GLDumper glDumper;<br>
diff --git a/retrace/retrace.hpp b/retrace/retrace.hpp<br>
index c2b06e3..c624b27 100644<br>
--- a/retrace/retrace.hpp<br>
+++ b/retrace/retrace.hpp<br>
@@ -217,6 +217,8 @@ public:<br>
<br>
     virtual void<br>
     dumpState(StateWriter &) = 0;<br>
+<br>
+    virtual void log(trace::Call &call) {}<br>
 };<br>
<br>
<br>
diff --git a/retrace/retrace_main.cpp b/retrace/retrace_main.cpp<br>
index 48651cd..356aca3 100644<br>
--- a/retrace/retrace_main.cpp<br>
+++ b/retrace/retrace_main.cpp<br>
@@ -232,6 +232,10 @@ retraceCall(trace::Call *call) {<br>
         }<br>
     }<br>
<br>
+    if (call->flags & trace::CALL_FLAG_RENDER) {<br>
+       dumper->log(*call);<br>
+    }<br>
+<br>
     retracer.retrace(*call);<br>
<br>
     if (doSnapshot) {<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.4.3<br>
<br>
_______________________________________________<br>
apitrace mailing list<br>
<a href="mailto:apitrace@lists.freedesktop.org">apitrace@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/apitrace" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/apitrace</a><br>
</font></span></blockquote></div><br></div></div>