| 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 #include "SkStringUtils.h" | 9 #include "SkStringUtils.h" |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 if (previous->batch()->renderTargetUniqueID() != batch->renderTa
rgetUniqueID()) { | 44 if (previous->batch()->renderTargetUniqueID() != batch->renderTa
rgetUniqueID()) { |
| 45 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget
\n", | 45 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget
\n", |
| 46 previous->batch()->name(), previous->batch()->u
niqueID()); | 46 previous->batch()->name(), previous->batch()->u
niqueID()); |
| 47 break; | 47 break; |
| 48 } | 48 } |
| 49 // We cannot continue to search backwards if the render target c
hanges | 49 // We cannot continue to search backwards if the render target c
hanges |
| 50 if (previous->batch()->combineIfPossible(batch, caps)) { | 50 if (previous->batch()->combineIfPossible(batch, caps)) { |
| 51 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", | 51 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", |
| 52 previous->batch()->name(), previous->batch()->u
niqueID()); | 52 previous->batch()->name(), previous->batch()->u
niqueID()); |
| 53 return NULL; | 53 return nullptr; |
| 54 } | 54 } |
| 55 | 55 |
| 56 if (intersect(previous->batch()->bounds(), batch->bounds())) { | 56 if (intersect(previous->batch()->bounds(), batch->bounds())) { |
| 57 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", | 57 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", |
| 58 previous->batch()->name(), previous->batch()->u
niqueID()); | 58 previous->batch()->name(), previous->batch()->u
niqueID()); |
| 59 break; | 59 break; |
| 60 } | 60 } |
| 61 } else { | 61 } else { |
| 62 GrBATCH_INFO("\t\tBreaking because of other %08x\n", reverseIter
->type()); | 62 GrBATCH_INFO("\t\tBreaking because of other %08x\n", reverseIter
->type()); |
| 63 // TODO temporary until we only have batches. | 63 // TODO temporary until we only have batches. |
| 64 break; | 64 break; |
| 65 } | 65 } |
| 66 } while (reverseIter.previous() && ++i < kMaxLookback); | 66 } while (reverseIter.previous() && ++i < kMaxLookback); |
| 67 #if GR_BATCH_SPEW | 67 #if GR_BATCH_SPEW |
| 68 if (!reverseIter.get()) { | 68 if (!reverseIter.get()) { |
| 69 GrBATCH_INFO("\t\tNo more commands to try and batch with\n"); | 69 GrBATCH_INFO("\t\tNo more commands to try and batch with\n"); |
| 70 } else if (i >= kMaxLookback) { | 70 } else if (i >= kMaxLookback) { |
| 71 GrBATCH_INFO("\t\tReached max lookback %d\n", i); | 71 GrBATCH_INFO("\t\tReached max lookback %d\n", i); |
| 72 } | 72 } |
| 73 #endif | 73 #endif |
| 74 } | 74 } |
| 75 #if GR_BATCH_SPEW | 75 #if GR_BATCH_SPEW |
| 76 else { | 76 else { |
| 77 GrBATCH_INFO("\t\tBreaking because empty command buffer\n"); | 77 GrBATCH_INFO("\t\tBreaking because empty command buffer\n"); |
| 78 } | 78 } |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (batch)); | 81 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (batch)); |
| 82 } | 82 } |
| OLD | NEW |