aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/private/GrAuditTrail.h2
-rw-r--r--src/gpu/GrAuditTrail.cpp3
-rw-r--r--tools/debugger/SkDebugCanvas.cpp11
3 files changed, 16 insertions, 0 deletions
diff --git a/include/private/GrAuditTrail.h b/include/private/GrAuditTrail.h
index 57e0feab6f..14873cd78c 100644
--- a/include/private/GrAuditTrail.h
+++ b/include/private/GrAuditTrail.h
@@ -129,6 +129,7 @@ public:
// a performance issue, but until then its nice to decouple
struct BatchInfo {
SkRect fBounds;
+ uint32_t fRenderTargetUniqueID;
struct Batch {
int fClientID;
SkRect fBounds;
@@ -168,6 +169,7 @@ private:
SkString toJson() const;
SkRect fBounds;
Batches fChildren;
+ uint32_t fRenderTargetUniqueID;
};
typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList;
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index f17ada4881..6b20876807 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -36,6 +36,7 @@ void GrAuditTrail::batchingResultNew(GrBatch* batch) {
fIDLookup.set(batch, fCurrentBatch->fBatchListID);
BatchNode* batchNode = new BatchNode;
batchNode->fBounds = fCurrentBatch->fBounds;
+ batchNode->fRenderTargetUniqueID = batch->renderTargetUniqueID();
batchNode->fChildren.push_back(fCurrentBatch);
fBatchList.emplace_back(batchNode);
}
@@ -62,6 +63,7 @@ void GrAuditTrail::getBoundsByClientID(SkTArray<BatchInfo>* outInfo, int clientI
// they have a different clientID
const BatchNode* bn = fBatchList[currentBatchListID];
outBatchInfo.fBounds = bn->fBounds;
+ outBatchInfo.fRenderTargetUniqueID = bn->fRenderTargetUniqueID;
for (int j = 0; j < bn->fChildren.count(); j++) {
BatchInfo::Batch& outBatch = outBatchInfo.fBatches.push_back();
const Batch* currentBatch = bn->fChildren[j];
@@ -212,6 +214,7 @@ SkString GrAuditTrail::Batch::toJson() const {
SkString GrAuditTrail::BatchNode::toJson() const {
SkString json;
json.append("{");
+ json.appendf("\"RenderTarget\": \"%u\",", fRenderTargetUniqueID);
skrect_to_json(&json, "Bounds", fBounds);
JsonifyTArray(&json, "Batches", fChildren, true);
json.append("}");
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 91f88d2b66..713ac39cfa 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -17,6 +17,7 @@
#include "GrAuditTrail.h"
#include "GrContext.h"
#include "GrRenderTarget.h"
+#include "SkGpuDevice.h"
#endif
#define SKDEBUGCANVAS_VERSION 1
@@ -330,6 +331,12 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
#if SK_SUPPORT_GPU
// draw any batches if required and issue a full reset onto GrAuditTrail
if (at) {
+ // get the render target of the top device so we can ignore batches drawn offscreen
+ SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_testing();
+ SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd);
+ uint32_t rtID = gbd->accessRenderTarget()->getUniqueID();
+
+ // get the bounding boxes to draw
GrAuditTrail::AutoEnable ae(at);
SkTArray<GrAuditTrail::BatchInfo> childrenBounds;
at->getBoundsByClientID(&childrenBounds, index);
@@ -337,6 +344,10 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) {
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(1);
for (int i = 0; i < childrenBounds.count(); i++) {
+ if (childrenBounds[i].fRenderTargetUniqueID != rtID) {
+ // offscreen draw, ignore for now
+ continue;
+ }
paint.setColor(SK_ColorBLACK);
canvas->drawRect(childrenBounds[i].fBounds, paint);
for (int j = 0; j < childrenBounds[i].fBatches.count(); j++) {