@@ -629,44 +629,31 @@ void GrDrawingManager::createDDLTask(sk_sp<const SkDeferredDisplayList> ddl,
629629
630630#ifdef SK_DEBUG
631631void GrDrawingManager::validate () const {
632- if (fReduceOpsTaskSplitting ) {
633- SkASSERT (!fActiveOpsTask );
634- } else {
635- if (fActiveOpsTask ) {
636- SkASSERT (!fDAG .empty ());
637- SkASSERT (!fActiveOpsTask ->isClosed ());
638- SkASSERT (fActiveOpsTask == fDAG .back ().get ());
639- }
632+ if (fActiveOpsTask ) {
633+ SkASSERT (!fDAG .empty ());
634+ SkASSERT (!fActiveOpsTask ->isClosed ());
635+ SkASSERT (fActiveOpsTask == fDAG .back ().get ());
636+ }
640637
641- for (int i = 0 ; i < fDAG .count (); ++i) {
642- if (fActiveOpsTask != fDAG [i].get ()) {
643- // The resolveTask associated with the activeTask remains open for as long as the
644- // activeTask does.
645- bool isActiveResolveTask =
646- fActiveOpsTask && fActiveOpsTask ->fTextureResolveTask == fDAG [i].get ();
647- SkASSERT (isActiveResolveTask || fDAG [i]->isClosed ());
648- }
638+ for (int i = 0 ; i < fDAG .count (); ++i) {
639+ if (fActiveOpsTask != fDAG [i].get ()) {
640+ // The resolveTask associated with the activeTask remains open for as long as the
641+ // activeTask does.
642+ bool isActiveResolveTask =
643+ fActiveOpsTask && fActiveOpsTask ->fTextureResolveTask == fDAG [i].get ();
644+ SkASSERT (isActiveResolveTask || fDAG [i]->isClosed ());
649645 }
646+ }
650647
651- if (!fDAG .empty () && !fDAG .back ()->isClosed ()) {
652- SkASSERT (fActiveOpsTask == fDAG .back ().get ());
653- }
648+ if (!fDAG .empty () && !fDAG .back ()->isClosed ()) {
649+ SkASSERT (fActiveOpsTask == fDAG .back ().get ());
654650 }
655651}
656652#endif
657653
658- void GrDrawingManager::closeRenderTasksForNewRenderTask (GrSurfaceProxy* target) {
659- if (target && fReduceOpsTaskSplitting ) {
660- // In this case we need to close all the renderTasks that rely on the current contents of
661- // 'target'. That is bc we're going to update the content of the proxy so they need to be
662- // split in case they use both the old and new content. (This is a bit of an overkill: they
663- // really only need to be split if they ever reference proxy's contents again but that is
664- // hard to predict/handle).
665- if (GrRenderTask* lastRenderTask = this ->getLastRenderTask (target)) {
666- lastRenderTask->closeThoseWhoDependOnMe (*fContext ->priv ().caps ());
667- }
668- } else if (fActiveOpsTask ) {
669- // This is a temporary fix for the partial-MDB world. In that world we're not
654+ void GrDrawingManager::closeActiveOpsTask () {
655+ if (fActiveOpsTask ) {
656+ // This is a temporary fix for the partial-MDB world. In that world we're not
670657 // reordering so ops that (in the single opsTask world) would've just glommed onto the
671658 // end of the single opsTask but referred to a far earlier RT need to appear in their
672659 // own opsTask.
@@ -680,22 +667,19 @@ sk_sp<GrOpsTask> GrDrawingManager::newOpsTask(GrSurfaceProxyView surfaceView,
680667 SkDEBUGCODE (this ->validate ());
681668 SkASSERT (fContext );
682669
683- GrSurfaceProxy* proxy = surfaceView.proxy ();
684- this ->closeRenderTasksForNewRenderTask (proxy);
670+ this ->closeActiveOpsTask ();
685671
686672 sk_sp<GrOpsTask> opsTask (new GrOpsTask (this , fContext ->priv ().arenas (),
687673 std::move (surfaceView),
688674 fContext ->priv ().auditTrail ()));
689- SkASSERT (this ->getLastRenderTask (proxy) == opsTask.get ());
675+ SkASSERT (this ->getLastRenderTask (opsTask-> target ( 0 ). proxy () ) == opsTask.get ());
690676
691677 if (flushTimeOpsTask) {
692678 fOnFlushRenderTasks .push_back (opsTask);
693679 } else {
694680 this ->appendTask (opsTask);
695681
696- if (!fReduceOpsTaskSplitting ) {
697- fActiveOpsTask = opsTask.get ();
698- }
682+ fActiveOpsTask = opsTask.get ();
699683 }
700684
701685 SkDEBUGCODE (this ->validate ());
@@ -727,65 +711,36 @@ void GrDrawingManager::newWaitRenderTask(sk_sp<GrSurfaceProxy> proxy,
727711 sk_sp<GrWaitRenderTask> waitTask = sk_make_sp<GrWaitRenderTask>(GrSurfaceProxyView (proxy),
728712 std::move (semaphores),
729713 numSemaphores);
730- if (fReduceOpsTaskSplitting ) {
731- GrRenderTask* lastTask = this ->getLastRenderTask (proxy.get ());
732- if (lastTask && !lastTask->isClosed ()) {
733- // We directly make the currently open renderTask depend on waitTask instead of using
734- // the proxy version of addDependency. The waitTask will never need to trigger any
735- // resolves or mip map generation which is the main advantage of going through the proxy
736- // version. Additionally we would've had to temporarily set the wait task as the
737- // lastRenderTask on the proxy, add the dependency, and then reset the lastRenderTask to
738- // lastTask. Additionally we add all dependencies of lastTask to waitTask so that the
739- // waitTask doesn't get reordered before them and unnecessarily block those tasks.
740- // Note: Any previous Ops already in lastTask will get blocked by the wait semaphore
741- // even though they don't need to be for correctness.
742-
743- // Make sure we add the dependencies of lastTask to waitTask first or else we'll get a
744- // circular self dependency of waitTask on waitTask.
745- waitTask->addDependenciesFromOtherTask (lastTask);
746- lastTask->addDependency (waitTask.get ());
747- } else {
748- // If there is a last task we set the waitTask to depend on it so that it doesn't get
749- // reordered in front of the lastTask causing the lastTask to be blocked by the
750- // semaphore. Again we directly just go through adding the dependency to the task and
751- // not the proxy since we don't need to worry about resolving anything.
752- if (lastTask) {
753- waitTask->addDependency (lastTask);
754- }
755- this ->setLastRenderTask (proxy.get (), waitTask.get ());
756- }
757- this ->appendTask (waitTask);
714+
715+ if (fActiveOpsTask && (fActiveOpsTask ->target (0 ).proxy () == proxy.get ())) {
716+ SkASSERT (this ->getLastRenderTask (proxy.get ()) == fActiveOpsTask );
717+ this ->insertTaskBeforeLast (waitTask);
718+ // In this case we keep the current renderTask open but just insert the new waitTask
719+ // before it in the list. The waitTask will never need to trigger any resolves or mip
720+ // map generation which is the main advantage of going through the proxy version.
721+ // Additionally we would've had to temporarily set the wait task as the lastRenderTask
722+ // on the proxy, add the dependency, and then reset the lastRenderTask to
723+ // fActiveOpsTask. Additionally we make the waitTask depend on all of fActiveOpsTask
724+ // dependencies so that we don't unnecessarily reorder the waitTask before them.
725+ // Note: Any previous Ops already in fActiveOpsTask will get blocked by the wait
726+ // semaphore even though they don't need to be for correctness.
727+
728+ // Make sure we add the dependencies of fActiveOpsTask to waitTask first or else we'll
729+ // get a circular self dependency of waitTask on waitTask.
730+ waitTask->addDependenciesFromOtherTask (fActiveOpsTask );
731+ fActiveOpsTask ->addDependency (waitTask.get ());
758732 } else {
759- if (fActiveOpsTask && (fActiveOpsTask ->target (0 ).proxy () == proxy.get ())) {
760- SkASSERT (this ->getLastRenderTask (proxy.get ()) == fActiveOpsTask );
761- this ->insertTaskBeforeLast (waitTask);
762- // In this case we keep the current renderTask open but just insert the new waitTask
763- // before it in the list. The waitTask will never need to trigger any resolves or mip
764- // map generation which is the main advantage of going through the proxy version.
765- // Additionally we would've had to temporarily set the wait task as the lastRenderTask
766- // on the proxy, add the dependency, and then reset the lastRenderTask to
767- // fActiveOpsTask. Additionally we make the waitTask depend on all of fActiveOpsTask
768- // dependencies so that we don't unnecessarily reorder the waitTask before them.
769- // Note: Any previous Ops already in fActiveOpsTask will get blocked by the wait
770- // semaphore even though they don't need to be for correctness.
771-
772- // Make sure we add the dependencies of fActiveOpsTask to waitTask first or else we'll
773- // get a circular self dependency of waitTask on waitTask.
774- waitTask->addDependenciesFromOtherTask (fActiveOpsTask );
775- fActiveOpsTask ->addDependency (waitTask.get ());
776- } else {
777- // In this case we just close the previous RenderTask and start and append the waitTask
778- // to the DAG. Since it is the last task now we call setLastRenderTask on the proxy. If
779- // there is a lastTask on the proxy we make waitTask depend on that task. This
780- // dependency isn't strictly needed but it does keep the DAG from reordering the
781- // waitTask earlier and blocking more tasks.
782- if (GrRenderTask* lastTask = this ->getLastRenderTask (proxy.get ())) {
783- waitTask->addDependency (lastTask);
784- }
785- this ->setLastRenderTask (proxy.get (), waitTask.get ());
786- this ->closeRenderTasksForNewRenderTask (proxy.get ());
787- this ->appendTask (waitTask);
788- }
733+ // In this case we just close the previous RenderTask and start and append the waitTask
734+ // to the DAG. Since it is the last task now we call setLastRenderTask on the proxy. If
735+ // there is a lastTask on the proxy we make waitTask depend on that task. This
736+ // dependency isn't strictly needed but it does keep the DAG from reordering the
737+ // waitTask earlier and blocking more tasks.
738+ if (GrRenderTask* lastTask = this ->getLastRenderTask (proxy.get ())) {
739+ waitTask->addDependency (lastTask);
740+ }
741+ this ->setLastRenderTask (proxy.get (), waitTask.get ());
742+ this ->closeActiveOpsTask ();
743+ this ->appendTask (waitTask);
789744 }
790745 waitTask->makeClosed (caps);
791746
@@ -800,8 +755,7 @@ void GrDrawingManager::newTransferFromRenderTask(sk_sp<GrSurfaceProxy> srcProxy,
800755 size_t dstOffset) {
801756 SkDEBUGCODE (this ->validate ());
802757 SkASSERT (fContext );
803- // This copies from srcProxy to dstBuffer so it doesn't have a real target.
804- this ->closeRenderTasksForNewRenderTask (nullptr );
758+ this ->closeActiveOpsTask ();
805759
806760 GrRenderTask* task = this ->appendTask (sk_make_sp<GrTransferFromRenderTask>(
807761 srcProxy, srcRect, surfaceColorType, dstColorType,
@@ -828,7 +782,7 @@ bool GrDrawingManager::newCopyRenderTask(GrSurfaceProxyView srcView,
828782 SkDEBUGCODE (this ->validate ());
829783 SkASSERT (fContext );
830784
831- this ->closeRenderTasksForNewRenderTask (dstView. proxy () );
785+ this ->closeActiveOpsTask ( );
832786 const GrCaps& caps = *fContext ->priv ().caps ();
833787
834788 GrSurfaceProxy* srcProxy = srcView.proxy ();
0 commit comments