Index: src/gpu/GrReorderCommandBuilder.cpp |
diff --git a/src/gpu/GrReorderCommandBuilder.cpp b/src/gpu/GrReorderCommandBuilder.cpp |
index 8c318fd0d00b322b0d247b0a596b98802f0e33f6..4dc2201325852ef2f415d7958caea161356ce4f1 100644 |
--- a/src/gpu/GrReorderCommandBuilder.cpp |
+++ b/src/gpu/GrReorderCommandBuilder.cpp |
@@ -24,6 +24,7 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(State* state, Gr |
static const int kMaxLookback = 10; |
int i = 0; |
batch->setPipeline(state->getPipeline()); |
+ GrRenderTarget* rt = state->getPipeline()->getRenderTarget(); |
if (!this->cmdBuffer()->empty()) { |
GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer()); |
@@ -31,6 +32,11 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(State* state, Gr |
if (Cmd::kDrawBatch_CmdType == reverseIter->type()) { |
DrawBatch* previous = static_cast<DrawBatch*>(reverseIter.get()); |
+ // We cannot continue to search backwards if the render target changes |
+ if (previous->fBatch->pipeline()->getRenderTarget() != rt) { |
+ break; |
+ } |
+ |
if (previous->fBatch->combineIfPossible(batch)) { |
return NULL; |
} |