| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 GrBATCH_INFO("\tOutcome:\n"); | 48 GrBATCH_INFO("\tOutcome:\n"); |
| 49 if (!this->cmdBuffer()->empty()) { | 49 if (!this->cmdBuffer()->empty()) { |
| 50 GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer())
; | 50 GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer())
; |
| 51 | 51 |
| 52 do { | 52 do { |
| 53 if (Cmd::kDrawBatch_CmdType == reverseIter->type()) { | 53 if (Cmd::kDrawBatch_CmdType == reverseIter->type()) { |
| 54 DrawBatch* previous = static_cast<DrawBatch*>(reverseIter.get())
; | 54 DrawBatch* previous = static_cast<DrawBatch*>(reverseIter.get())
; |
| 55 | 55 |
| 56 if (previous->batch()->pipeline()->getRenderTarget() != rt) { | 56 if (previous->batch()->pipeline()->getRenderTarget() != rt) { |
| 57 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget
\n", | 57 GrBATCH_INFO("\t\tBreaking because of (%s, B%u) Rendertarget
\n", |
| 58 previous->fBatch->name(), previous->fBatch->uni
queID()); | 58 previous->batch()->name(), previous->batch()->u
niqueID()); |
| 59 break; | 59 break; |
| 60 } | 60 } |
| 61 // We cannot continue to search backwards if the render target c
hanges | 61 // We cannot continue to search backwards if the render target c
hanges |
| 62 if (previous->batch()->combineIfPossible(batch, caps)) { | 62 if (previous->batch()->combineIfPossible(batch, caps)) { |
| 63 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", | 63 GrBATCH_INFO("\t\tCombining with (%s, B%u)\n", |
| 64 previous->fBatch->name(), previous->fBatch->uni
queID()); | 64 previous->batch()->name(), previous->batch()->u
niqueID()); |
| 65 return NULL; | 65 return NULL; |
| 66 } | 66 } |
| 67 | 67 |
| 68 if (intersect(previous->batch()->bounds(), batch->bounds())) { | 68 if (intersect(previous->batch()->bounds(), batch->bounds())) { |
| 69 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", | 69 GrBATCH_INFO("\t\tIntersects with (%s, B%u)\n", |
| 70 previous->fBatch->name(), previous->fBatch->uni
queID()); | 70 previous->batch()->name(), previous->batch()->u
niqueID()); |
| 71 break; | 71 break; |
| 72 } | 72 } |
| 73 } else if (Cmd::kClear_CmdType == reverseIter->type()) { | 73 } else if (Cmd::kClear_CmdType == reverseIter->type()) { |
| 74 Clear* previous = static_cast<Clear*>(reverseIter.get()); | 74 Clear* previous = static_cast<Clear*>(reverseIter.get()); |
| 75 | 75 |
| 76 // We cannot continue to search backwards if the render target c
hanges | 76 // We cannot continue to search backwards if the render target c
hanges |
| 77 if (previous->renderTarget() != rt) { | 77 if (previous->renderTarget() != rt) { |
| 78 GrBATCH_INFO("\t\tBreaking because of Clear's Rendertarget c
hange\n"); | 78 GrBATCH_INFO("\t\tBreaking because of Clear's Rendertarget c
hange\n"); |
| 79 break; | 79 break; |
| 80 } | 80 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 100 #endif | 100 #endif |
| 101 } | 101 } |
| 102 #if GR_BATCH_SPEW | 102 #if GR_BATCH_SPEW |
| 103 else { | 103 else { |
| 104 GrBATCH_INFO("\t\tBreaking because empty command buffer\n"); | 104 GrBATCH_INFO("\t\tBreaking because empty command buffer\n"); |
| 105 } | 105 } |
| 106 #endif | 106 #endif |
| 107 | 107 |
| 108 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (batch, this-
>batchTarget())); | 108 return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (batch, this-
>batchTarget())); |
| 109 } | 109 } |
| OLD | NEW |