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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1498653002: Add option to control maximum GrBatch lookback (Closed) Base URL: https://skia.googlesource.com/skia.git@drect
Patch Set: fix rebase Created 5 years 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 | « src/gpu/GrDrawTarget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 59488c4d0352b596ea32334b956a291955bdeb5e..55f66249847c1970733415521fe2ba05251e0347 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -32,6 +32,9 @@
////////////////////////////////////////////////////////////////////////////////
+// Experimentally we have found that most batching occurs within the first 10 comparisons.
+static const int kDefaultMaxBatchLookback = 10;
+
GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* resourceProvider,
const Options& options)
: fGpu(SkRef(gpu))
@@ -44,6 +47,8 @@ GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r
fClipMaskManager.reset(new GrClipMaskManager(this, options.fClipBatchToBounds));
fDrawBatchBounds = options.fDrawBatchBounds;
+ fMaxBatchLookback = (options.fMaxBatchLookback < 0) ? kDefaultMaxBatchLookback :
+ options.fMaxBatchLookback;
rt->setLastDrawTarget(this);
@@ -469,8 +474,6 @@ void GrDrawTarget::recordBatch(GrBatch* batch) {
// 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;
GrBATCH_INFO("Re-Recording (%s, B%u)\n"
"\tBounds LRTB (%f, %f, %f, %f)\n",
@@ -480,7 +483,7 @@ void GrDrawTarget::recordBatch(GrBatch* batch) {
batch->bounds().fTop, batch->bounds().fBottom);
GrBATCH_INFO(SkTabString(batch->dumpInfo(), 1).c_str());
GrBATCH_INFO("\tOutcome:\n");
- int maxCandidates = SkTMin(kMaxLookback, fBatches.count());
+ int maxCandidates = SkTMin(fMaxBatchLookback, fBatches.count());
if (maxCandidates) {
int i = 0;
while (true) {
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698