Hardwire opList lookAhead & lookBack parameters
If/when we double check these settings we can either re-add these parameters or change the code manually.
The driving goal here is to shrink GrRenderTargetOpList.
Change-Id: I7819de18f97e8282e8754e3438130f797ebb3c37
Reviewed-on: https://skia-review.googlesource.com/14381
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index ebcda38..c169b23 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1264,14 +1264,10 @@
DEFINE_bool(imm, false, "Run gpu configs in immediate mode.");
DEFINE_bool(drawOpClip, false, "Clip each GrDrawOp to its device bounds for testing.");
-DEFINE_int32(opLookback, -1, "Maximum GrOp lookback for combining, negative means default.");
-DEFINE_int32(opLookahead, -1, "Maximum GrOp lookahead for combining, negative means default.");
Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) const {
GrContextOptions grOptions;
grOptions.fImmediateMode = FLAGS_imm;
- grOptions.fMaxOpCombineLookback = FLAGS_opLookback;
- grOptions.fMaxOpCombineLookahead = FLAGS_opLookahead;
src.modifyGrContextOptions(&grOptions);
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 8b61c9c..f151704 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -40,11 +40,6 @@
immediately. Intended to ease debugging. */
bool fImmediateMode = false;
- /** For debugging, override the default maximum look-back or look-ahead window for GrOp
- combining. */
- int fMaxOpCombineLookback = -1;
- int fMaxOpCombineLookahead = -1;
-
/** Force us to do all swizzling manually in the shader and don't rely on extensions to do
swizzling. */
bool fUseShaderSwizzling = false;
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 92be35c..a2f2272 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -103,13 +103,10 @@
fDisableGpuYUVConversion = options.fDisableGpuYUVConversion;
fDidTestPMConversions = false;
- GrRenderTargetOpList::Options rtOpListOptions;
- rtOpListOptions.fMaxOpCombineLookback = options.fMaxOpCombineLookback;
- rtOpListOptions.fMaxOpCombineLookahead = options.fMaxOpCombineLookahead;
GrPathRendererChain::Options prcOptions;
prcOptions.fAllowPathMaskCaching = options.fAllowPathMaskCaching;
prcOptions.fGpuPathRenderers = options.fGpuPathRenderers;
- fDrawingManager.reset(new GrDrawingManager(this, rtOpListOptions, prcOptions,
+ fDrawingManager.reset(new GrDrawingManager(this, prcOptions,
options.fImmediateMode, &fSingleOwner));
fAtlasGlyphCache = new GrAtlasGlyphCache(this);
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 282226c..2258c9e 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -224,8 +224,7 @@
sk_sp<GrRenderTargetOpList> opList(new GrRenderTargetOpList(rtp,
fContext->getGpu(),
fContext->resourceProvider(),
- fContext->getAuditTrail(),
- fOptionsForOpLists));
+ fContext->getAuditTrail()));
SkASSERT(rtp->getLastOpList() == opList.get());
fOpLists.push_back() = opList;
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index e96fd3a..1990f9d 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -75,11 +75,9 @@
private:
GrDrawingManager(GrContext* context,
- const GrRenderTargetOpList::Options& optionsForOpLists,
const GrPathRendererChain::Options& optionsForPathRendererChain,
bool isImmediateMode, GrSingleOwner* singleOwner)
: fContext(context)
- , fOptionsForOpLists(optionsForOpLists)
, fOptionsForPathRendererChain(optionsForPathRendererChain)
, fSingleOwner(singleOwner)
, fAbandoned(false)
@@ -107,7 +105,6 @@
static const int kNumDFTOptions = 2; // DFT or no DFT
GrContext* fContext;
- GrRenderTargetOpList::Options fOptionsForOpLists;
GrPathRendererChain::Options fOptionsForPathRendererChain;
// In debug builds we guard against improper thread handling
diff --git a/src/gpu/GrPreFlushResourceProvider.cpp b/src/gpu/GrPreFlushResourceProvider.cpp
index 3c6ddc4..01d948a 100644
--- a/src/gpu/GrPreFlushResourceProvider.cpp
+++ b/src/gpu/GrPreFlushResourceProvider.cpp
@@ -36,8 +36,7 @@
sk_ref_sp(proxy->asRenderTargetProxy()),
fDrawingMgr->fContext->getGpu(),
fDrawingMgr->fContext->resourceProvider(),
- fDrawingMgr->fContext->getAuditTrail(),
- fDrawingMgr->fOptionsForOpLists));
+ fDrawingMgr->fContext->getAuditTrail()));
proxy->setLastOpList(opList.get());
sk_sp<GrRenderTargetContext> renderTargetContext(
@@ -66,8 +65,7 @@
sk_ref_sp(proxy->asRenderTargetProxy()),
fDrawingMgr->fContext->getGpu(),
fDrawingMgr->fContext->resourceProvider(),
- fDrawingMgr->fContext->getAuditTrail(),
- fDrawingMgr->fOptionsForOpLists));
+ fDrawingMgr->fContext->getAuditTrail()));
proxy->setLastOpList(opList.get());
sk_sp<GrRenderTargetContext> renderTargetContext(
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 3d4edb2..a7e109d 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -22,23 +22,18 @@
////////////////////////////////////////////////////////////////////////////////
// Experimentally we have found that most combining occurs within the first 10 comparisons.
-static const int kDefaultMaxOpLookback = 10;
-static const int kDefaultMaxOpLookahead = 10;
+static const int kMaxOpLookback = 10;
+static const int kMaxOpLookahead = 10;
GrRenderTargetOpList::GrRenderTargetOpList(sk_sp<GrRenderTargetProxy> proxy, GrGpu* gpu,
GrResourceProvider* resourceProvider,
- GrAuditTrail* auditTrail, const Options& options)
+ GrAuditTrail* auditTrail)
: INHERITED(std::move(proxy), auditTrail)
, fGpu(SkRef(gpu))
, fResourceProvider(resourceProvider)
, fLastClipStackGenID(SK_InvalidUniqueID)
, fClipAllocator(fClipAllocatorStorage, sizeof(fClipAllocatorStorage),
sizeof(fClipAllocatorStorage)) {
- fMaxOpLookback = (options.fMaxOpCombineLookback < 0) ? kDefaultMaxOpLookback
- : options.fMaxOpCombineLookback;
- fMaxOpLookahead = (options.fMaxOpCombineLookahead < 0) ? kDefaultMaxOpLookahead
- : options.fMaxOpCombineLookahead;
-
if (GrCaps::InstancedSupport::kNone != this->caps()->instancedSupport()) {
fInstancedRendering.reset(fGpu->createInstancedRendering());
}
@@ -332,7 +327,7 @@
op->bounds().fRight, op->bounds().fBottom);
GrOP_INFO(SkTabString(op->dumpInfo(), 1).c_str());
GrOP_INFO("\tOutcome:\n");
- int maxCandidates = SkTMin(fMaxOpLookback, fRecordedOps.count());
+ int maxCandidates = SkTMin(kMaxOpLookback, fRecordedOps.count());
// If we don't have a valid destination render target then we cannot reorder.
if (maxCandidates && renderTarget) {
int i = 0;
@@ -383,9 +378,6 @@
void GrRenderTargetOpList::forwardCombine() {
SkASSERT(!this->isClosed());
- if (fMaxOpLookahead <= 0) {
- return;
- }
for (int i = 0; i < fRecordedOps.count() - 1; ++i) {
GrOp* op = fRecordedOps[i].fOp.get();
GrRenderTarget* renderTarget = fRecordedOps[i].fRenderTarget.get();
@@ -394,7 +386,7 @@
if (!renderTarget) {
continue;
}
- int maxCandidateIdx = SkTMin(i + fMaxOpLookahead, fRecordedOps.count() - 1);
+ int maxCandidateIdx = SkTMin(i + kMaxOpLookahead, fRecordedOps.count() - 1);
int j = i + 1;
while (true) {
const RecordedOp& candidate = fRecordedOps[j];
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index dd265ed..88bb6fd 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -33,14 +33,7 @@
using DstTexture = GrXferProcessor::DstTexture;
public:
- /** Options for GrRenderTargetOpList behavior. */
- struct Options {
- int fMaxOpCombineLookback = -1;
- int fMaxOpCombineLookahead = -1;
- };
-
- GrRenderTargetOpList(sk_sp<GrRenderTargetProxy>, GrGpu*, GrResourceProvider*,
- GrAuditTrail*, const Options&);
+ GrRenderTargetOpList(sk_sp<GrRenderTargetProxy>, GrGpu*, GrResourceProvider*, GrAuditTrail*);
~GrRenderTargetOpList() override;
@@ -158,9 +151,6 @@
GrGpu* fGpu;
GrResourceProvider* fResourceProvider;
- int fMaxOpLookback;
- int fMaxOpLookahead;
-
std::unique_ptr<gr_instanced::InstancedRendering> fInstancedRendering;
int32_t fLastClipStackGenID;