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

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

Issue 1275543005: Move some work from backend onClear to base class clear (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move up to DrawTarget Created 5 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrReorderCommandBuilder.h" 8 #include "GrReorderCommandBuilder.h"
9 9
10 template <class Left, class Right> 10 template <class Left, class Right>
(...skipping 14 matching lines...) Expand all
25 int i = 0; 25 int i = 0;
26 batch->setPipeline(state->getPipeline()); 26 batch->setPipeline(state->getPipeline());
27 GrRenderTarget* rt = state->getPipeline()->getRenderTarget(); 27 GrRenderTarget* rt = state->getPipeline()->getRenderTarget();
28 if (!this->cmdBuffer()->empty()) { 28 if (!this->cmdBuffer()->empty()) {
29 GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer()) ; 29 GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer()) ;
30 30
31 do { 31 do {
32 if (Cmd::kDrawBatch_CmdType == reverseIter->type()) { 32 if (Cmd::kDrawBatch_CmdType == reverseIter->type()) {
33 DrawBatch* previous = static_cast<DrawBatch*>(reverseIter.get()) ; 33 DrawBatch* previous = static_cast<DrawBatch*>(reverseIter.get()) ;
34 34
35 // We cannot continue to search backwards if the render target c hanges
36 if (previous->fBatch->pipeline()->getRenderTarget() != rt) { 35 if (previous->fBatch->pipeline()->getRenderTarget() != rt) {
37 break; 36 break;
38 } 37 }
39 38 // We cannot continue to search backwards if the render target c hanges
40 if (previous->fBatch->combineIfPossible(batch)) { 39 if (previous->fBatch->combineIfPossible(batch)) {
41 return NULL; 40 return NULL;
42 } 41 }
43 42
44 if (intersect(previous->fBatch->bounds(), batch->bounds())) { 43 if (intersect(previous->fBatch->bounds(), batch->bounds())) {
45 break; 44 break;
46 } 45 }
47 } else if (Cmd::kClear_CmdType == reverseIter->type()) { 46 } else if (Cmd::kClear_CmdType == reverseIter->type()) {
48 Clear* previous = static_cast<Clear*>(reverseIter.get()); 47 Clear* previous = static_cast<Clear*>(reverseIter.get());
49 48
49 if (previous->renderTarget() != rt) {
50 break;
51 }
50 // We set the color to illegal if we are doing a discard. 52 // We set the color to illegal if we are doing a discard.
51 // If we can ignore the rect, then we do a full clear
52 if (previous->fColor == GrColor_ILLEGAL || 53 if (previous->fColor == GrColor_ILLEGAL ||
53 previous->fCanIgnoreRect ||
54 intersect(batch->bounds(), previous->fRect)) { 54 intersect(batch->bounds(), previous->fRect)) {
55 break; 55 break;
56 } 56 }
57 } else { 57 } else {
58 // TODO temporary until we can navigate the other types of comma nds 58 // TODO temporary until we can navigate the other types of comma nds
59 break; 59 break;
60 } 60 }
61 } while (reverseIter.previous() && ++i < kMaxLookback); 61 } while (reverseIter.previous() && ++i < kMaxLookback);
62 } 62 }
63 63
64 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch , 64 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch ,
65 this->batchT arget())); 65 this->batchT arget()));
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698