[Mesa-dev] [PATCH 2/2] retrace: use GREMEDY_string_marker to emit call no's
Rob Clark
robdclark at gmail.com
Mon Aug 10 14:35:47 PDT 2015
If the extension is present, use it to log call numbers for draw
commands.
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
retrace/glretrace.hpp | 2 ++
retrace/glretrace_main.cpp | 15 +++++++++++++++
retrace/retrace.hpp | 2 ++
retrace/retrace_main.cpp | 4 ++++
4 files changed, 23 insertions(+)
diff --git a/retrace/glretrace.hpp b/retrace/glretrace.hpp
index b172f85..ebd5996 100644
--- a/retrace/glretrace.hpp
+++ b/retrace/glretrace.hpp
@@ -55,6 +55,8 @@ struct Context {
bool used;
+ bool GREMEDY_string_marker;
+
inline glprofile::Profile
profile(void) const {
return wsContext->profile;
diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp
index 71dde8e..513aca3 100755
--- a/retrace/glretrace_main.cpp
+++ b/retrace/glretrace_main.cpp
@@ -348,6 +348,7 @@ initContext() {
supportsElapsed = currentContext->hasExtension("GL_EXT_timer_query") || supportsTimestamp;
supportsOcclusion = currentProfile.versionGreaterOrEqual(glprofile::API_GL, 1, 5);
supportsARBShaderObjects = currentContext->hasExtension("GL_ARB_shader_objects");
+ currentContext->GREMEDY_string_marker = currentContext->hasExtension("GL_GREMEDY_string_marker");
#ifdef __APPLE__
// GL_TIMESTAMP doesn't work on Apple. GL_TIME_ELAPSED still does however.
@@ -620,6 +621,20 @@ public:
dumpState(StateWriter &writer) {
glstate::dumpCurrentContext(writer);
}
+
+ void
+ log(trace::Call &call) {
+ glretrace::Context *currentContext = glretrace::getCurrentContext();
+ if (currentContext && currentContext->GREMEDY_string_marker) {
+ char *str;
+ int len = asprintf(&str, "%d:%s", call.no, call.name());
+ if (len > 0) {
+ glStringMarkerGREMEDY(len, str);
+ free(str);
+ }
+ }
+ }
+
};
static GLDumper glDumper;
diff --git a/retrace/retrace.hpp b/retrace/retrace.hpp
index c2b06e3..c624b27 100644
--- a/retrace/retrace.hpp
+++ b/retrace/retrace.hpp
@@ -217,6 +217,8 @@ public:
virtual void
dumpState(StateWriter &) = 0;
+
+ virtual void log(trace::Call &call) {}
};
diff --git a/retrace/retrace_main.cpp b/retrace/retrace_main.cpp
index 48651cd..356aca3 100644
--- a/retrace/retrace_main.cpp
+++ b/retrace/retrace_main.cpp
@@ -232,6 +232,10 @@ retraceCall(trace::Call *call) {
}
}
+ if (call->flags & trace::CALL_FLAG_RENDER) {
+ dumper->log(*call);
+ }
+
retracer.retrace(*call);
if (doSnapshot) {
--
2.4.3
More information about the mesa-dev
mailing list