Modify gpu debug markers to store gpu device markers when a flush occurs.
BUG=skia:
R=bsalomon@google.com
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/341583002
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index d203681..7cdb743 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -578,7 +578,30 @@
dstCopy.texture() ? &dstCopy : NULL);
}
-void GrDrawTarget::addGpuTraceMarker(GrGpuTraceMarker* marker) {
+typedef GrTraceMarkerSet::Iter TMIter;
+void GrDrawTarget::saveActiveTraceMarkers() {
+ if (this->caps()->gpuTracingSupport()) {
+ SkASSERT(0 == fStoredTraceMarkers.count());
+ fStoredTraceMarkers.addSet(fActiveTraceMarkers);
+ for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) {
+ this->removeGpuTraceMarker(&(*iter));
+ }
+ }
+}
+
+void GrDrawTarget::restoreActiveTraceMarkers() {
+ if (this->caps()->gpuTracingSupport()) {
+ SkASSERT(0 == fActiveTraceMarkers.count());
+ for (TMIter iter = fStoredTraceMarkers.begin(); iter != fStoredTraceMarkers.end(); ++iter) {
+ this->addGpuTraceMarker(&(*iter));
+ }
+ for (TMIter iter = fActiveTraceMarkers.begin(); iter != fActiveTraceMarkers.end(); ++iter) {
+ this->fStoredTraceMarkers.remove(*iter);
+ }
+ }
+}
+
+void GrDrawTarget::addGpuTraceMarker(const GrGpuTraceMarker* marker) {
if (this->caps()->gpuTracingSupport()) {
SkASSERT(fGpuTraceMarkerCount >= 0);
this->fActiveTraceMarkers.add(*marker);
@@ -587,7 +610,7 @@
}
}
-void GrDrawTarget::removeGpuTraceMarker(GrGpuTraceMarker* marker) {
+void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
if (this->caps()->gpuTracingSupport()) {
SkASSERT(fGpuTraceMarkerCount >= 1);
this->fActiveTraceMarkers.remove(*marker);