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

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

Issue 1765123002: Fix up GrAuditTrail to allow arbitrary reordering (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fix up audit trail Created 4 years, 9 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/GrAuditTrail.cpp ('k') | tools/debugger/SkDebugCanvas.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
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 454 }
455 455
456 void GrDrawTarget::recordBatch(GrBatch* batch) { 456 void GrDrawTarget::recordBatch(GrBatch* batch) {
457 // A closed drawTarget should never receive new/more batches 457 // A closed drawTarget should never receive new/more batches
458 SkASSERT(!this->isClosed()); 458 SkASSERT(!this->isClosed());
459 459
460 // Check if there is a Batch Draw we can batch with by linearly searching ba ck until we either 460 // Check if there is a Batch Draw we can batch with by linearly searching ba ck until we either
461 // 1) check every draw 461 // 1) check every draw
462 // 2) intersect with something 462 // 2) intersect with something
463 // 3) find a 'blocker' 463 // 3) find a 'blocker'
464 GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, batch->name(), batch->bounds()); 464 GR_AUDIT_TRAIL_ADDBATCH(fAuditTrail, batch);
465 GrBATCH_INFO("Re-Recording (%s, B%u)\n" 465 GrBATCH_INFO("Re-Recording (%s, B%u)\n"
466 "\tBounds LRTB (%f, %f, %f, %f)\n", 466 "\tBounds LRTB (%f, %f, %f, %f)\n",
467 batch->name(), 467 batch->name(),
468 batch->uniqueID(), 468 batch->uniqueID(),
469 batch->bounds().fLeft, batch->bounds().fRight, 469 batch->bounds().fLeft, batch->bounds().fRight,
470 batch->bounds().fTop, batch->bounds().fBottom); 470 batch->bounds().fTop, batch->bounds().fBottom);
471 GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str()); 471 GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str());
472 GrBATCH_INFO("\tOutcome:\n"); 472 GrBATCH_INFO("\tOutcome:\n");
473 int maxCandidates = SkTMin(fMaxBatchLookback, fBatches.count()); 473 int maxCandidates = SkTMin(fMaxBatchLookback, fBatches.count());
474 if (maxCandidates) { 474 if (maxCandidates) {
475 int i = 0; 475 int i = 0;
476 while (true) { 476 while (true) {
477 GrBatch* candidate = fBatches.fromBack(i); 477 GrBatch* candidate = fBatches.fromBack(i);
478 // We cannot continue to search backwards if the render target chang es 478 // We cannot continue to search backwards if the render target chang es
479 if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID ()) { 479 if (candidate->renderTargetUniqueID() != batch->renderTargetUniqueID ()) {
480 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n", 480 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget\n",
481 candidate->name(), candidate->uniqueID()); 481 candidate->name(), candidate->uniqueID());
482 break; 482 break;
483 } 483 }
484 if (candidate->combineIfPossible(batch, *this->caps())) { 484 if (candidate->combineIfPossible(batch, *this->caps())) {
485 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", candidate->name() , 485 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", candidate->name() ,
486 candidate->uniqueID()); 486 candidate->uniqueID());
487 GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, candidate); 487 GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, candidate, batch);
488 return; 488 return;
489 } 489 }
490 // Stop going backwards if we would cause a painter's order violatio n. 490 // Stop going backwards if we would cause a painter's order violatio n.
491 // TODO: The bounds used here do not fully consider the clip. It may be advantageous 491 // TODO: The bounds used here do not fully consider the clip. It may be advantageous
492 // to clip each batch's bounds to the clip. 492 // to clip each batch's bounds to the clip.
493 if (intersect(candidate->bounds(), batch->bounds())) { 493 if (intersect(candidate->bounds(), batch->bounds())) {
494 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name( ), 494 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name( ),
495 candidate->uniqueID()); 495 candidate->uniqueID());
496 break; 496 break;
497 } 497 }
(...skipping 23 matching lines...) Expand all
521 candidate->name(), candidate->uniqueID()); 521 candidate->name(), candidate->uniqueID());
522 break; 522 break;
523 } 523 }
524 if (j == i +1) { 524 if (j == i +1) {
525 // We assume batch would have combined with candidate when the c andidate was added 525 // We assume batch would have combined with candidate when the c andidate was added
526 // via backwards combining in recordBatch. 526 // via backwards combining in recordBatch.
527 SkASSERT(!batch->combineIfPossible(candidate, *this->caps())); 527 SkASSERT(!batch->combineIfPossible(candidate, *this->caps()));
528 } else if (batch->combineIfPossible(candidate, *this->caps())) { 528 } else if (batch->combineIfPossible(candidate, *this->caps())) {
529 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", candidate->name() , 529 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", candidate->name() ,
530 candidate->uniqueID()); 530 candidate->uniqueID());
531 GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, candidate); 531 GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(fAuditTrail, batch, cand idate);
532 fBatches[j].reset(SkRef(batch)); 532 fBatches[j].reset(SkRef(batch));
533 fBatches[i].reset(nullptr); 533 fBatches[i].reset(nullptr);
534 break; 534 break;
535 } 535 }
536 // Stop going traversing if we would cause a painter's order violati on. 536 // Stop going traversing if we would cause a painter's order violati on.
537 // TODO: The bounds used here do not fully consider the clip. It may be advantageous 537 // TODO: The bounds used here do not fully consider the clip. It may be advantageous
538 // to clip each batch's bounds to the clip. 538 // to clip each batch's bounds to the clip.
539 if (intersect(candidate->bounds(), batch->bounds())) { 539 if (intersect(candidate->bounds(), batch->bounds())) {
540 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name( ), 540 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", candidate->name( ),
541 candidate->uniqueID()); 541 candidate->uniqueID());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 600 }
601 601
602 return true; 602 return true;
603 } 603 }
604 604
605 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) { 605 void GrDrawTarget::clearStencilClip(const SkIRect& rect, bool insideClip, GrRend erTarget* rt) {
606 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt); 606 GrBatch* batch = new GrClearStencilClipBatch(rect, insideClip, rt);
607 this->recordBatch(batch); 607 this->recordBatch(batch);
608 batch->unref(); 608 batch->unref();
609 } 609 }
OLDNEW
« no previous file with comments | « src/gpu/GrAuditTrail.cpp ('k') | tools/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698