summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Janes <mark.a.janes@intel.com>2017-05-30 15:36:26 -0700
committerMark Janes <mark.a.janes@intel.com>2017-06-19 14:10:07 -0700
commited9a2ceccf965643ec0ca9e6a5dacd70f90828f2 (patch)
tree8660f8d6d639be591d7d862414fd5b1d924dd5a1
parent88855284c4829e1afdf24ec861c022d8181576bf (diff)
retrace: Handle glFrameTerminatorGREMEDY
ApiTrace thinks glFrameTerminatorGREMEDY is a frame terminator. In Dota, it immediately follows swapBuffers, causing FrameRetrace to think half of the frames have zero calls. Ignore glFrameTerminatorGREMEDY, to avoid this double counting of frames.
-rw-r--r--retrace/daemon/glframe_retrace.cpp6
-rw-r--r--retrace/daemon/glframe_retrace_render.cpp15
-rw-r--r--retrace/daemon/glframe_retrace_render.hpp1
3 files changed, 18 insertions, 4 deletions
diff --git a/retrace/daemon/glframe_retrace.cpp b/retrace/daemon/glframe_retrace.cpp
index 3d91330d..81a45175 100644
--- a/retrace/daemon/glframe_retrace.cpp
+++ b/retrace/daemon/glframe_retrace.cpp
@@ -145,7 +145,7 @@ FrameRetrace::openFile(const std::string &filename,
retracer.retrace(*call);
m_tracker.track(*call);
}
- const bool frame_boundary = call->flags & trace::CALL_FLAG_END_FRAME;
+ const bool frame_boundary = RetraceRender::endsFrame(*call);
delete call;
if (frame_boundary) {
++current_frame;
@@ -222,7 +222,7 @@ FrameState::FrameState(const std::string &filename,
trace::Call *call;
int current_frame = 0;
while ((call = p->scan_call()) && current_frame < framenumber) {
- if (call->flags & trace::CALL_FLAG_END_FRAME) {
+ if (RetraceRender::endsFrame(*call)) {
++current_frame;
if (current_frame == framenumber) {
delete call;
@@ -237,7 +237,7 @@ FrameState::FrameState(const std::string &filename,
++render_count;
}
- if (call->flags & trace::CALL_FLAG_END_FRAME) {
+ if (RetraceRender::endsFrame(*call)) {
delete call;
break;
}
diff --git a/retrace/daemon/glframe_retrace_render.cpp b/retrace/daemon/glframe_retrace_render.cpp
index 1848c125..e41bc597 100644
--- a/retrace/daemon/glframe_retrace_render.cpp
+++ b/retrace/daemon/glframe_retrace_render.cpp
@@ -79,6 +79,19 @@ RetraceRender::isRender(const trace::Call &call) {
|| isClear(call));
}
+bool
+RetraceRender::endsFrame(const trace::Call &c) {
+ if (c.flags & trace::CALL_FLAG_END_FRAME) {
+ // apitrace considers glFrameTerminatorGREMEDY to be a terminator,
+ // but this always follows swapbuffers when it exists.
+ if (strncmp("glFrameTerminatorGREMEDY", c.sig->name,
+ strlen("glFrameTerminatorGREMEDY")) == 0)
+ return false;
+ return true;
+ }
+ return false;
+}
+
int
RetraceRender::currentRenderBuffer() {
glstate::Context context;
@@ -110,7 +123,7 @@ RetraceRender::RetraceRender(trace::AbstractParser *parser,
tracker->flush();
m_retracer->retrace(*call);
tracker->track(*call);
- m_end_of_frame = call->flags & trace::CALL_FLAG_END_FRAME;
+ m_end_of_frame = endsFrame(*call);
const bool render = isRender(*call);
compute = isCompute(*call);
if (changesContext(*call)) {
diff --git a/retrace/daemon/glframe_retrace_render.hpp b/retrace/daemon/glframe_retrace_render.hpp
index 2dd1b515..af8113b1 100644
--- a/retrace/daemon/glframe_retrace_render.hpp
+++ b/retrace/daemon/glframe_retrace_render.hpp
@@ -75,6 +75,7 @@ class RetraceRender {
OnFrameRetrace *callback);
static bool isRender(const trace::Call &c);
static bool changesContext(const trace::Call &c);
+ static bool endsFrame(const trace::Call &c);
static int currentRenderBuffer();
private: