Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 1577093003: Add batch names and bounds to json debug information (Closed) Base URL: https://skia.googlesource.com/skia.git@audittrail-wireupcontext
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 10
11 #include "GrAuditTrail.h"
11 #include "GrCaps.h" 12 #include "GrCaps.h"
12 #include "GrGpu.h" 13 #include "GrGpu.h"
13 #include "GrPath.h" 14 #include "GrPath.h"
14 #include "GrPipeline.h" 15 #include "GrPipeline.h"
15 #include "GrMemoryPool.h" 16 #include "GrMemoryPool.h"
16 #include "GrRenderTarget.h" 17 #include "GrRenderTarget.h"
17 #include "GrResourceProvider.h" 18 #include "GrResourceProvider.h"
18 #include "GrRenderTargetPriv.h" 19 #include "GrRenderTargetPriv.h"
19 #include "GrSurfacePriv.h" 20 #include "GrSurfacePriv.h"
20 #include "GrTexture.h" 21 #include "GrTexture.h"
21 #include "GrVertexBuffer.h" 22 #include "GrVertexBuffer.h"
22 23
24 #include "SkStrokeRec.h"
25
23 #include "batches/GrClearBatch.h" 26 #include "batches/GrClearBatch.h"
24 #include "batches/GrCopySurfaceBatch.h" 27 #include "batches/GrCopySurfaceBatch.h"
25 #include "batches/GrDiscardBatch.h" 28 #include "batches/GrDiscardBatch.h"
26 #include "batches/GrDrawBatch.h" 29 #include "batches/GrDrawBatch.h"
27 #include "batches/GrDrawPathBatch.h" 30 #include "batches/GrDrawPathBatch.h"
28 #include "batches/GrRectBatchFactory.h" 31 #include "batches/GrRectBatchFactory.h"
29 #include "batches/GrStencilPathBatch.h" 32 #include "batches/GrStencilPathBatch.h"
30 33
31 #include "SkStrokeRec.h"
32
33 //////////////////////////////////////////////////////////////////////////////// 34 ////////////////////////////////////////////////////////////////////////////////
34 35
35 // Experimentally we have found that most batching occurs within the first 10 co mparisons. 36 // Experimentally we have found that most batching occurs within the first 10 co mparisons.
36 static const int kDefaultMaxBatchLookback = 10; 37 static const int kDefaultMaxBatchLookback = 10;
37 38
38 GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r esourceProvider, 39 GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r esourceProvider,
39 const Options& options) 40 GrAuditTrail* auditTrail, const Options& options)
40 : fGpu(SkRef(gpu)) 41 : fGpu(SkRef(gpu))
41 , fResourceProvider(resourceProvider) 42 , fResourceProvider(resourceProvider)
43 , fAuditTrail(auditTrail)
42 , fFlags(0) 44 , fFlags(0)
43 , fRenderTarget(rt) { 45 , fRenderTarget(rt) {
44 // TODO: Stop extracting the context (currently needed by GrClipMaskManager) 46 // TODO: Stop extracting the context (currently needed by GrClipMaskManager)
45 fContext = fGpu->getContext(); 47 fContext = fGpu->getContext();
46 fClipMaskManager.reset(new GrClipMaskManager(this, options.fClipBatchToBound s)); 48 fClipMaskManager.reset(new GrClipMaskManager(this, options.fClipBatchToBound s));
47 49
48 fDrawBatchBounds = options.fDrawBatchBounds; 50 fDrawBatchBounds = options.fDrawBatchBounds;
49 fMaxBatchLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookba ck : 51 fMaxBatchLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookba ck :
50 options.fMaxBatchLookb ack; 52 options.fMaxBatchLookb ack;
51 53
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 461 }
460 462
461 void GrDrawTarget::recordBatch(GrBatch* batch) { 463 void GrDrawTarget::recordBatch(GrBatch* batch) {
462 // A closed drawTarget should never receive new/more batches 464 // A closed drawTarget should never receive new/more batches
463 SkASSERT(!this->isClosed()); 465 SkASSERT(!this->isClosed());
464 466
465 // Check if there is a Batch Draw we can batch with by linearly searching ba ck until we either 467 // Check if there is a Batch Draw we can batch with by linearly searching ba ck until we either
466 // 1) check every draw 468 // 1) check every draw
467 // 2) intersect with something 469 // 2) intersect with something
468 // 3) find a 'blocker' 470 // 3) find a 'blocker'
469 471 GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, batch->name(), batch->bounds());
470 GrBATCH_INFO("Re-Recording (%s, B%u)\n" 472 GrBATCH_INFO("Re-Recording (%s, B%u)\n"
471 "\tBounds LRTB (%f, %f, %f, %f)\n", 473 "\tBounds LRTB (%f, %f, %f, %f)\n",
472 batch->name(), 474 batch->name(),
473 batch->uniqueID(), 475 batch->uniqueID(),
474 batch->bounds().fLeft, batch->bounds().fRight, 476 batch->bounds().fLeft, batch->bounds().fRight,
475 batch->bounds().fTop, batch->bounds().fBottom); 477 batch->bounds().fTop, batch->bounds().fBottom);
476 GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str()); 478 GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str());
477 GrBATCH_INFO("\tOutcome:\n"); 479 GrBATCH_INFO("\tOutcome:\n");
478 int maxCandidates = SkTMin(fMaxBatchLookback, fBatches.count()); 480 int maxCandidates = SkTMin(fMaxBatchLookback, fBatches.count());
479 if (maxCandidates) { 481 if (maxCandidates) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 538 }
537 539
538 return true; 540 return true;
539 } 541 }
540 542
541 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 543 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
542 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 544 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
543 this->recordBatch(batch); 545 this->recordBatch(batch);
544 batch->unref(); 546 batch->unref();
545 } 547 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698