aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-05-22 11:19:44 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-22 11:19:44 -0700
commit2a97c55ae3b2b62fef2045e839600dc13b481c4c (patch)
tree2fed5624ab25bd4000b14bc3c3cc14019f62fa9c
parentc9b8276bc9775442c429c7c0d803c88a5aa2dd78 (diff)
Trivial patch to set a max lookback on reordering
-rw-r--r--src/gpu/GrReorderCommandBuilder.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gpu/GrReorderCommandBuilder.cpp b/src/gpu/GrReorderCommandBuilder.cpp
index 3ba95d7c96..14279de824 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 kMaxLookback = 10;
+ 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 < kMaxLookback);
}
return GrNEW_APPEND_TO_RECORDER(*this->cmdBuffer(), DrawBatch, (state, batch,