diff --git a/include/gpu/GrRecordingContext.h b/include/gpu/GrRecordingContext.h index 003111ee67..5f29423fff 100644 --- a/include/gpu/GrRecordingContext.h +++ b/include/gpu/GrRecordingContext.h @@ -128,8 +128,7 @@ protected: }; GrRecordingContext(sk_sp); - - bool init() override; + void setupDrawingManager(bool reduceOpsTaskSplitting); void abandonContext() override; diff --git a/src/gpu/GrDDLContext.cpp b/src/gpu/GrDDLContext.cpp index 82c547503a..3919df4d9a 100644 --- a/src/gpu/GrDDLContext.cpp +++ b/src/gpu/GrDDLContext.cpp @@ -32,6 +32,17 @@ public: } private: + bool init() override { + if (!INHERITED::init()) { + return false; + } + + // DDL contexts/drawing managers always attempt to reduce opsTask splitting. + this->setupDrawingManager(/* reduceOpsTaskSplitting */true); + + return true; + } + // Add to the set of unique program infos required by this DDL void recordProgramInfo(const GrProgramInfo* programInfo) final { if (!programInfo) { diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp index 1324a466af..5a32bac95a 100644 --- a/src/gpu/GrDirectContext.cpp +++ b/src/gpu/GrDirectContext.cpp @@ -49,6 +49,12 @@ # endif #endif +#ifdef SK_DISABLE_REDUCE_OPLIST_SPLITTING +static const bool kDefaultReduceOpsTaskSplitting = false; +#else +static const bool kDefaultReduceOpsTaskSplitting = false; +#endif + #define ASSERT_SINGLE_OWNER GR_ASSERT_SINGLE_OWNER(this->singleOwner()) GrDirectContext::GrDirectContext(GrBackendApi backend, const GrContextOptions& options) @@ -207,6 +213,15 @@ bool GrDirectContext::init() { fShaderErrorHandler = GrShaderUtils::DefaultShaderErrorHandler(); } + bool reduceOpsTaskSplitting = kDefaultReduceOpsTaskSplitting; + if (GrContextOptions::Enable::kNo == this->options().fReduceOpsTaskSplitting) { + reduceOpsTaskSplitting = false; + } else if (GrContextOptions::Enable::kYes == this->options().fReduceOpsTaskSplitting) { + reduceOpsTaskSplitting = true; + } + + this->setupDrawingManager(reduceOpsTaskSplitting); + GrDrawOpAtlas::AllowMultitexturing allowMultitexturing; if (GrContextOptions::Enable::kNo == this->options().fAllowMultipleGlyphCacheTextures || // multitexturing supported only if range can represent the index + texcoords fully diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h index a4cfd9d0d2..9795aad24a 100644 --- a/src/gpu/GrDrawingManager.h +++ b/src/gpu/GrDrawingManager.h @@ -182,7 +182,7 @@ private: GrTokenTracker fTokenTracker; bool fFlushing; - const bool fReduceOpsTaskSplitting; + bool fReduceOpsTaskSplitting; SkTArray fOnFlushCBObjects; diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp index bd21b491c3..0ca23e06ed 100644 --- a/src/gpu/GrRecordingContext.cpp +++ b/src/gpu/GrRecordingContext.cpp @@ -50,11 +50,7 @@ int GrRecordingContext::maxSurfaceSampleCountForColorType(SkColorType colorType) return this->caps()->maxRenderTargetSampleCount(format); } -bool GrRecordingContext::init() { - if (!INHERITED::init()) { - return false; - } - +void GrRecordingContext::setupDrawingManager(bool reduceOpsTaskSplitting) { GrPathRendererChain::Options prcOptions; prcOptions.fAllowPathMaskCaching = this->options().fAllowPathMaskCaching; #if GR_TEST_UTILS @@ -68,16 +64,9 @@ bool GrRecordingContext::init() { prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall; } - bool reduceOpsTaskSplitting = false; - if (GrContextOptions::Enable::kYes == this->options().fReduceOpsTaskSplitting) { - reduceOpsTaskSplitting = true; - } else if (GrContextOptions::Enable::kNo == this->options().fReduceOpsTaskSplitting) { - reduceOpsTaskSplitting = false; - } fDrawingManager.reset(new GrDrawingManager(this, prcOptions, reduceOpsTaskSplitting)); - return true; } void GrRecordingContext::abandonContext() {