OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 if (previous->fBatch->combineIfPossible(batch)) { | 40 if (previous->fBatch->combineIfPossible(batch)) { |
41 return NULL; | 41 return NULL; |
42 } | 42 } |
43 | 43 |
44 if (intersect(previous->fBatch->bounds(), batch->bounds())) { | 44 if (intersect(previous->fBatch->bounds(), batch->bounds())) { |
45 break; | 45 break; |
46 } | 46 } |
47 } else if (Cmd::kClear_CmdType == reverseIter->type()) { | 47 } else if (Cmd::kClear_CmdType == reverseIter->type()) { |
48 Clear* previous = static_cast<Clear*>(reverseIter.get()); | 48 Clear* previous = static_cast<Clear*>(reverseIter.get()); |
49 | 49 |
| 50 // We cannot continue to search backwards if the render target c
hanges |
| 51 if (previous->renderTarget() != rt) { |
| 52 break; |
| 53 } |
| 54 |
50 // We set the color to illegal if we are doing a discard. | 55 // 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 | 56 // If we can ignore the rect, then we do a full clear |
52 if (previous->fColor == GrColor_ILLEGAL || | 57 if (previous->fColor == GrColor_ILLEGAL || |
53 previous->fCanIgnoreRect || | 58 previous->fCanIgnoreRect || |
54 intersect(batch->bounds(), previous->fRect)) { | 59 intersect(batch->bounds(), previous->fRect)) { |
55 break; | 60 break; |
56 } | 61 } |
57 } else { | 62 } else { |
58 // TODO temporary until we can navigate the other types of comma
nds | 63 // TODO temporary until we can navigate the other types of comma
nds |
59 break; | 64 break; |
60 } | 65 } |
61 } while (reverseIter.previous() && ++i < kMaxLookback); | 66 } while (reverseIter.previous() && ++i < kMaxLookback); |
62 } | 67 } |
63 | 68 |
64 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch
, | 69 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch
, |
65 this->batchT
arget())); | 70 this->batchT
arget())); |
66 } | 71 } |
OLD | NEW |