Reland "Reorder msaa and mipmap resolves to happen all at once"

This is a reland of fd1414608ba1174a26af27067575c65c2dc3d605

Original change's description:
> Reorder msaa and mipmap resolves to happen all at once
> 
> Makes it so every renderTask has only one textureResolveTask, and
> modifies GrTextureResolveTask to perform multiple resolves
> back-to-back.
> 
> Bug: skia:9406
> Change-Id: I93566cf4b23764bd846a1e0a0848642c9b3a507a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241936
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

Bug: skia:9406
Change-Id: I0e98ec6749e88628f8c1bae34351f5ff95cd2066
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242519
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 26be426..fd47421 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -421,8 +421,6 @@
         REPORTER_ASSERT(reporter, initialMipmapRegenTask);
         REPORTER_ASSERT(reporter,
                 initialMipmapRegenTask != mipmapRTC->testingOnly_PeekLastOpsTask());
-        REPORTER_ASSERT(reporter,
-                rtc1->testingOnly_PeekLastOpsTask()->dependsOn(initialMipmapRegenTask));
         REPORTER_ASSERT(reporter, !mipmapProxy->mipMapsAreDirty());
 
         // Draw the now-clean mipmap texture into a second target.
@@ -431,13 +429,17 @@
 
         // Make sure the mipmap texture still has the same regen task.
         REPORTER_ASSERT(reporter, mipmapProxy->getLastRenderTask() == initialMipmapRegenTask);
-        REPORTER_ASSERT(reporter,
-                rtc2->testingOnly_PeekLastOpsTask()->dependsOn(initialMipmapRegenTask));
         SkASSERT(!mipmapProxy->mipMapsAreDirty());
 
         // Reset everything so we can go again, this time with the first draw not mipmapped.
         context->flush();
 
+        // Mip regen tasks don't get added as dependencies until makeClosed().
+        REPORTER_ASSERT(reporter,
+                rtc1->testingOnly_PeekLastOpsTask()->dependsOn(initialMipmapRegenTask));
+        REPORTER_ASSERT(reporter,
+                rtc2->testingOnly_PeekLastOpsTask()->dependsOn(initialMipmapRegenTask));
+
         // Render something to dirty the mips.
         mipmapRTC->clear(nullptr, {.1f,.2f,.3f,.4f}, CanClearFullscreen::kYes);
         REPORTER_ASSERT(reporter, mipmapProxy->getLastRenderTask());
@@ -467,11 +469,14 @@
 
         // Make sure the mipmap texture now has a new last render task that regenerates the mips,
         // and that the mipmaps are now clean.
-        REPORTER_ASSERT(reporter, mipmapProxy->getLastRenderTask());
+        auto mipRegenTask2 = mipmapProxy->getLastRenderTask();
+        REPORTER_ASSERT(reporter, mipRegenTask2);
         REPORTER_ASSERT(reporter,
-                mipmapRTC->testingOnly_PeekLastOpsTask() != mipmapProxy->getLastRenderTask());
-        REPORTER_ASSERT(reporter,
-                rtc2->testingOnly_PeekLastOpsTask()->dependsOn(mipmapProxy->getLastRenderTask()));
+                mipmapRTC->testingOnly_PeekLastOpsTask() != mipRegenTask2);
         SkASSERT(!mipmapProxy->mipMapsAreDirty());
+
+        // Mip regen tasks don't get added as dependencies until makeClosed().
+        context->flush();
+        REPORTER_ASSERT(reporter, rtc2->testingOnly_PeekLastOpsTask()->dependsOn(mipRegenTask2));
     }
 }