Index: src/gpu/GrReorderCommandBuilder.cpp |
diff --git a/src/gpu/GrReorderCommandBuilder.cpp b/src/gpu/GrReorderCommandBuilder.cpp |
index 3ba95d7c966858501e0aed9bd09f4c803b3c2496..89d9f8bddd98d55082b9ccaa601bad24e9bda782 100644 |
--- a/src/gpu/GrReorderCommandBuilder.cpp |
+++ b/src/gpu/GrReorderCommandBuilder.cpp |
@@ -19,6 +19,9 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(State* state, Gr |
// 1) check every draw |
// 2) intersect with something |
// 3) find a 'blocker' |
+ // Experimentally we have found that most batching occurs within the first 10 comparisons. |
+ static const int kLookback = 10; |
bsalomon
2015/05/22 16:03:54
kMaxLookBack?
|
+ int i = 0; |
if (!this->cmdBuffer()->empty()) { |
GrTargetCommands::CmdBuffer::ReverseIter reverseIter(*this->cmdBuffer()); |
@@ -38,7 +41,7 @@ GrTargetCommands::Cmd* GrReorderCommandBuilder::recordDrawBatch(State* state, Gr |
// TODO temporary until we can navigate the other types of commands |
break; |
} |
- } while (reverseIter.previous()); |
+ } while (reverseIter.previous() && ++i < kLookback); |
} |
return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch, |