Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: src/gpu/GrReorderCommandBuilder.cpp

Issue 1150253003: Trivial patch to set a max lookback on reordering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tidy Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrReorderCommandBuilder.cpp
diff --git a/src/gpu/GrReorderCommandBuilder.cpp b/src/gpu/GrReorderCommandBuilder.cpp
index 3ba95d7c966858501e0aed9bd09f4c803b3c2496..14279de8242e4ea8be030b1b1023e7d3075efed4 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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698