Revert "Rm makeRenderTargetContext in favor of deferred version (take 2)"

This reverts commit 02242e82e4bf94a8f6862dadb5bf347ea5e31eb5.

Reason for revert: Maybe breaking Chrome DEPS roll

Original change's description:
> Rm makeRenderTargetContext in favor of deferred version (take 2)
> 
> This is a reland of: https://skia-review.googlesource.com/c/13001/ (Rm makeRenderTargetContext in favor of deferred version) 
> 
> Change-Id: Ife77b012d09c46895884a168fc5045bd92a4b919
> Reviewed-on: https://skia-review.googlesource.com/13196
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> 

TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: I2607116ed743f5d313da4a7b7f056776ed907702
Reviewed-on: https://skia-review.googlesource.com/14024
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp
index 544f5e0..8110574 100644
--- a/gm/windowrectangles.cpp
+++ b/gm/windowrectangles.cpp
@@ -202,10 +202,10 @@
     const int padRight = (kDeviceRect.right() - kCoverRect.right()) / 2;
     const int padBottom = (kDeviceRect.bottom() - kCoverRect.bottom()) / 2;
     sk_sp<GrRenderTargetContext> maskRTC(
-        ctx->makeDeferredRenderTargetContextWithFallback(SkBackingFit::kExact,
-                                                         kCoverRect.width() + padRight,
-                                                         kCoverRect.height() + padBottom,
-                                                         kAlpha_8_GrPixelConfig, nullptr));
+        ctx->makeRenderTargetContextWithFallback(SkBackingFit::kExact,
+                                                 kCoverRect.width() + padRight,
+                                                 kCoverRect.height() + padBottom,
+                                                 kAlpha_8_GrPixelConfig, nullptr));
     if (!maskRTC ||
         !ctx->resourceProvider()->attachStencilAttachment(maskRTC->accessRenderTarget())) {
         return;
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index ec07e96..158699b 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -183,12 +183,12 @@
      */
     int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const;
 
-    /*
-     * Create a new render target context backed by a deferred-style
-     * GrRenderTargetProxy. We guarantee that "asTextureProxy" will succeed for
-     * renderTargetContexts created via this entry point.
+    /**
+     * Create both a GrRenderTarget and a matching GrRenderTargetContext to wrap it.
+     * We guarantee that "asTexture" will succeed for renderTargetContexts created
+     * via this entry point.
      */
-    sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> makeRenderTargetContext(
                                                  SkBackingFit fit,
                                                  int width, int height,
                                                  GrPixelConfig config,
@@ -197,12 +197,36 @@
                                                  GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
                                                  const SkSurfaceProps* surfaceProps = nullptr,
                                                  SkBudgeted = SkBudgeted::kYes);
+
+    // Create a new render target context as above but have it backed by a deferred-style
+    // GrRenderTargetProxy rather than one that is backed by an actual GrRenderTarget
+    sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContext(
+                                                 SkBackingFit fit, 
+                                                 int width, int height,
+                                                 GrPixelConfig config,
+                                                 sk_sp<SkColorSpace> colorSpace,
+                                                 int sampleCnt = 0,
+                                                 GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
+                                                 const SkSurfaceProps* surfaceProps = nullptr,
+                                                 SkBudgeted = SkBudgeted::kYes);
     /*
      * This method will attempt to create a renderTargetContext that has, at least, the number of
      * channels and precision per channel as requested in 'config' (e.g., A8 and 888 can be
      * converted to 8888). It may also swizzle the channels (e.g., BGRA -> RGBA).
      * SRGB-ness will be preserved.
      */
+    sk_sp<GrRenderTargetContext> makeRenderTargetContextWithFallback(
+                                                 SkBackingFit fit,
+                                                 int width, int height,
+                                                 GrPixelConfig config,
+                                                 sk_sp<SkColorSpace> colorSpace,
+                                                 int sampleCnt = 0,
+                                                 GrSurfaceOrigin origin = kBottomLeft_GrSurfaceOrigin,
+                                                 const SkSurfaceProps* surfaceProps = nullptr,
+                                                 SkBudgeted budgeted = SkBudgeted::kYes);
+
+    // Create a new render target context as above but have it backed by a deferred-style
+    // GrRenderTargetProxy rather than one that is backed by an actual GrRenderTarget
     sk_sp<GrRenderTargetContext> makeDeferredRenderTargetContextWithFallback(
                                                  SkBackingFit fit,
                                                  int width, int height,
diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp
index 33ef97e..40afb57 100644
--- a/src/core/SkSpecialSurface.cpp
+++ b/src/core/SkSpecialSurface.cpp
@@ -164,7 +164,7 @@
         return nullptr;
     }
 
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
         SkBackingFit::kApprox, width, height, config, std::move(colorSpace)));
     if (!renderTargetContext) {
         return nullptr;
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 18df1d6..b010981 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -392,7 +392,7 @@
         return proxy;
     }
 
-    sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContextWithFallback(
+    sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContextWithFallback(
                                                                              SkBackingFit::kApprox,
                                                                              reducedClip.width(),
                                                                              reducedClip.height(),
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 2a3852c..7d6a90a 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -484,7 +484,7 @@
         // TODO: Need to decide the semantics of this function for color spaces. Do we support
         // conversion to a passed-in color space? For now, specifying nullptr means that this
         // path will do no conversion, so it will match the behavior of the non-draw path.
-        sk_sp<GrRenderTargetContext> tempRTC = fContext->makeDeferredRenderTargetContext(
+        sk_sp<GrRenderTargetContext> tempRTC = fContext->makeRenderTargetContext(
                                                            tempDrawInfo.fTempSurfaceFit,
                                                            tempDrawInfo.fTempSurfaceDesc.fWidth,
                                                            tempDrawInfo.fTempSurfaceDesc.fHeight,
@@ -771,6 +771,23 @@
     }
 }
 
+sk_sp<GrRenderTargetContext> GrContext::makeRenderTargetContextWithFallback(
+                                                                 SkBackingFit fit,
+                                                                 int width, int height,
+                                                                 GrPixelConfig config,
+                                                                 sk_sp<SkColorSpace> colorSpace,
+                                                                 int sampleCnt,
+                                                                 GrSurfaceOrigin origin,
+                                                                 const SkSurfaceProps* surfaceProps,
+                                                                 SkBudgeted budgeted) {
+    if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) {
+        config = GrPixelConfigFallback(config);
+    }
+
+    return this->makeRenderTargetContext(fit, width, height, config, std::move(colorSpace),
+                                         sampleCnt, origin, surfaceProps, budgeted);
+}
+
 sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContextWithFallback(
                                                                  SkBackingFit fit,
                                                                  int width, int height,
@@ -788,6 +805,48 @@
                                                  sampleCnt, origin, surfaceProps, budgeted);
 }
 
+sk_sp<GrRenderTargetContext> GrContext::makeRenderTargetContext(SkBackingFit fit,
+                                                                int width, int height,
+                                                                GrPixelConfig config,
+                                                                sk_sp<SkColorSpace> colorSpace,
+                                                                int sampleCnt,
+                                                                GrSurfaceOrigin origin,
+                                                                const SkSurfaceProps* surfaceProps,
+                                                                SkBudgeted budgeted) {
+    if (!this->caps()->isConfigRenderable(config, sampleCnt > 0)) {
+        return nullptr;
+    }
+
+    GrSurfaceDesc desc;
+    desc.fFlags = kRenderTarget_GrSurfaceFlag;
+    desc.fOrigin = origin;
+    desc.fWidth = width;
+    desc.fHeight = height;
+    desc.fConfig = config;
+    desc.fSampleCnt = sampleCnt;
+
+    sk_sp<GrTexture> tex;
+    if (SkBackingFit::kExact == fit) {
+        tex = this->resourceProvider()->createTexture(desc, budgeted);
+    } else {
+        tex.reset(this->resourceProvider()->createApproxTexture(desc, 0));
+    }
+    if (!tex) {
+        return nullptr;
+    }
+
+    sk_sp<GrRenderTargetContext> renderTargetContext(
+        this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(tex->asRenderTarget()),
+                                                           std::move(colorSpace), surfaceProps));
+    if (!renderTargetContext) {
+        return nullptr;
+    }
+
+    renderTargetContext->discard();
+
+    return renderTargetContext;
+}
+
 sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
                                                         SkBackingFit fit,
                                                         int width, int height,
@@ -797,8 +856,6 @@
                                                         GrSurfaceOrigin origin,
                                                         const SkSurfaceProps* surfaceProps,
                                                         SkBudgeted budgeted) {
-    SkASSERT(kDefault_GrSurfaceOrigin != origin);
-
     GrSurfaceDesc desc;
     desc.fFlags = kRenderTarget_GrSurfaceFlag;
     desc.fOrigin = origin;
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 04472c5..4d309f4 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -227,11 +227,8 @@
     // remove all the previously recorded ops and change the load op to clear with supplied
     // color.
     // TODO: this needs to be updated to use GrSurfaceProxy::UniqueID
-    // MDB TODO: re-enable once opLists are divided. This assertion fails when a rendering is
-    // aborted but the same RT is reused for the next draw. The clears really shouldn't be
-    // fused in that case.
-    //SkASSERT((fLastFullClearResourceID == renderTarget->uniqueID()) ==
-    //         (fLastFullClearProxyID == renderTargetContext->asRenderTargetProxy()->uniqueID()));
+    SkASSERT((fLastFullClearResourceID == renderTarget->uniqueID()) ==
+             (fLastFullClearProxyID == renderTargetContext->asRenderTargetProxy()->uniqueID()));
     if (fLastFullClearResourceID == renderTarget->uniqueID()) {
         // As currently implemented, fLastFullClearOp should be the last op because we would
         // have cleared it when another op was recorded.
diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp
index 75796b1..d226c3f 100644
--- a/src/gpu/GrTextureProducer.cpp
+++ b/src/gpu/GrTextureProducer.cpp
@@ -27,7 +27,7 @@
 
     const SkRect dstRect = SkRect::MakeIWH(copyParams.fWidth, copyParams.fHeight);
 
-    sk_sp<GrRenderTargetContext> copyRTC = context->makeDeferredRenderTargetContextWithFallback(
+    sk_sp<GrRenderTargetContext> copyRTC = context->makeRenderTargetContextWithFallback(
         SkBackingFit::kExact, dstRect.width(), dstRect.height(), config, nullptr);
     if (!copyRTC) {
         return nullptr;
diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp
index c6f9794..0a0edee 100644
--- a/src/gpu/GrTextureToYUVPlanes.cpp
+++ b/src/gpu/GrTextureToYUVPlanes.cpp
@@ -73,7 +73,7 @@
         // sizes however we optimize for two other cases - all planes are the same (1 draw to YUV),
         // and U and V are the same but Y differs (2 draws, one for Y, one for UV).
         if (sizes[0] == sizes[1] && sizes[1] == sizes[2]) {
-            yuvRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
+            yuvRenderTargetContext = context->makeRenderTargetContextWithFallback(
                                                                            SkBackingFit::kApprox,
                                                                            sizes[0].fWidth,
                                                                            sizes[0].fHeight,
@@ -83,7 +83,7 @@
                 return false;
             }
         } else {
-            yRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
+            yRenderTargetContext = context->makeRenderTargetContextWithFallback(
                                                                              SkBackingFit::kApprox,
                                                                              sizes[0].fWidth,
                                                                              sizes[0].fHeight,
@@ -94,7 +94,7 @@
             }
             if (sizes[1] == sizes[2]) {
                 // TODO: Add support for GL_RG when available.
-                uvRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
+                uvRenderTargetContext = context->makeRenderTargetContextWithFallback(
                                                                            SkBackingFit::kApprox,
                                                                            sizes[1].fWidth,
                                                                            sizes[1].fHeight,
@@ -104,13 +104,13 @@
                     return false;
                 }
             } else {
-                uRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
+                uRenderTargetContext = context->makeRenderTargetContextWithFallback(
                                                                              SkBackingFit::kApprox,
                                                                              sizes[1].fWidth,
                                                                              sizes[1].fHeight,
                                                                              kAlpha_8_GrPixelConfig,
                                                                              nullptr);
-                vRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
+                vRenderTargetContext = context->makeRenderTargetContextWithFallback(
                                                                              SkBackingFit::kApprox,
                                                                              sizes[2].fWidth,
                                                                              sizes[2].fHeight,
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 6b51303..cfd27d0 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -121,7 +121,7 @@
     }
 
     // We never want to perform color-space conversion during the decode
-    sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeRenderTargetContext(
                                                                           SkBackingFit::kExact,
                                                                           desc.fWidth, desc.fHeight,
                                                                           desc.fConfig, nullptr,
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 6ddae65..7046f1ce 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -168,8 +168,7 @@
     GrPixelConfig config = SkImageInfo2GrPixelConfig(origInfo, *context->caps());
     // This method is used to create SkGpuDevice's for SkSurface_Gpus. In this case
     // they need to be exact.
-    return context->makeDeferredRenderTargetContext(
-                                    SkBackingFit::kExact,
+    return context->makeRenderTargetContext(SkBackingFit::kExact,
                                     origInfo.width(), origInfo.height(),
                                     config, origInfo.refColorSpace(), sampleCount,
                                     origin, surfaceProps, budgeted);
@@ -1330,6 +1329,7 @@
     const SkImageInfo ii = this->imageInfo();
     const SkIRect srcRect = SkIRect::MakeWH(ii.width(), ii.height());
 
+    SkASSERT(proxy->priv().isExact());
     return SkSpecialImage::MakeDeferredFromGpu(fContext.get(),
                                                srcRect,
                                                kNeedNewImageUniqueID_SpecialImage,
@@ -1760,13 +1760,13 @@
     SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApprox
                                                             : SkBackingFit::kExact;
 
-    sk_sp<GrRenderTargetContext> rtc(fContext->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> rtc(fContext->makeRenderTargetContext(
                                                    fit,
                                                    cinfo.fInfo.width(), cinfo.fInfo.height(),
-                                                   fRenderTargetContext->config(),
-                                                   fRenderTargetContext->refColorSpace(),
-                                                   fRenderTargetContext->desc().fSampleCnt,
-                                                   kBottomLeft_GrSurfaceOrigin,
+                                                   fRenderTargetContext->config(), 
+                                                   fRenderTargetContext->refColorSpace(), 
+                                                   fRenderTargetContext->desc().fSampleCnt, 
+                                                   kDefault_GrSurfaceOrigin,
                                                    &props));
     if (!rtc) {
         return nullptr;
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 41c7e6f..2e0886f 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -121,12 +121,10 @@
     const SkImageInfo ii = SkImageInfo::Make(kSize, kSize,
                                              kRGBA_8888_SkColorType, kPremul_SkAlphaType);
 
-    sk_sp<GrRenderTargetContext> readRTC(context->makeDeferredRenderTargetContext(
-                                                                          SkBackingFit::kExact,
+    sk_sp<GrRenderTargetContext> readRTC(context->makeRenderTargetContext(SkBackingFit::kExact,
                                                                           kSize, kSize,
                                                                           kConfig, nullptr));
-    sk_sp<GrRenderTargetContext> tempRTC(context->makeDeferredRenderTargetContext(
-                                                                          SkBackingFit::kExact,
+    sk_sp<GrRenderTargetContext> tempRTC(context->makeRenderTargetContext(SkBackingFit::kExact,
                                                                           kSize, kSize,
                                                                           kConfig, nullptr));
     if (!readRTC || !readRTC->asTextureProxy() || !tempRTC) {
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index d99f282..4e377c9 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -352,7 +352,7 @@
     }
 
     // Setup dummy SkPaint / GrPaint / GrRenderTargetContext
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
         SkBackingFit::kApprox, 1024, 1024, kRGBA_8888_GrPixelConfig, nullptr));
 
     SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 96a81f5..dd1b0c1 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -385,7 +385,7 @@
     const int height = yuvSizes[0].fHeight;
 
     // Needs to be a render target in order to draw to it for the yuv->rgb conversion.
-    sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeRenderTargetContext(
                                                                          SkBackingFit::kExact,
                                                                          width, height,
                                                                          kRGBA_8888_GrPixelConfig,
@@ -922,7 +922,7 @@
         return sk_ref_sp(const_cast<SkImage_Gpu*>(this));
     }
 
-    sk_sp<GrRenderTargetContext> renderTargetContext(fContext->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(fContext->makeRenderTargetContext(
         SkBackingFit::kExact, this->width(), this->height(), kRGBA_8888_GrPixelConfig, nullptr));
     if (!renderTargetContext) {
         return nullptr;
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index 45eb2af..843c4c3 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -57,8 +57,8 @@
     }
     context->freeGpuResources();
 
-    *rtc = context->makeDeferredRenderTargetContext(SkBackingFit::kExact, w, h,
-                                                    kRGBA_8888_GrPixelConfig, nullptr);
+    *rtc = context->makeRenderTargetContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig,
+                                            nullptr);
 
     SkASSERT((*rtc)->accessRenderTarget()->uniqueID() != oldID);
 
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 25cd312..5400d92 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -148,7 +148,7 @@
                                                 : kBottomLeft_GrSurfaceOrigin;
     int sampleCnt = random->nextBool() ? SkTMin(4, caps->maxSampleCount()) : 0;
 
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
                                                                            SkBackingFit::kExact,
                                                                            kRenderTargetWidth,
                                                                            kRenderTargetHeight,
@@ -345,7 +345,7 @@
     drawingManager->flush(nullptr);
 
     // Validate that GrFPs work correctly without an input.
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
                                                                            SkBackingFit::kExact,
                                                                            kRenderTargetWidth,
                                                                            kRenderTargetHeight,
diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp
index 6e68546..26d7e70 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -122,11 +122,11 @@
     for (int i = 0; i < numTestPatterns; ++i) {
         int numSamples = (int)kTestPatterns[i].size();
         GrAlwaysAssert(numSamples > 1 && SkIsPow2(numSamples));
-        bottomUps[i] = ctx->makeDeferredRenderTargetContextWithFallback(
+        bottomUps[i] = ctx->makeRenderTargetContextWithFallback(
                            SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr,
                            rand.nextRangeU(1 + numSamples / 2, numSamples),
                            kBottomLeft_GrSurfaceOrigin);
-        topDowns[i] = ctx->makeDeferredRenderTargetContextWithFallback(
+        topDowns[i] = ctx->makeRenderTargetContextWithFallback(
                           SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr,
                           rand.nextRangeU(1 + numSamples / 2, numSamples),
                           kTopLeft_GrSurfaceOrigin);
diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp
index dc4d212..f3e3482 100644
--- a/tests/ImageStorageTest.cpp
+++ b/tests/ImageStorageTest.cpp
@@ -140,8 +140,8 @@
                                                  SkBudgeted::kYes, test.fData.get(), 0);
 
                 sk_sp<GrRenderTargetContext> rtContext =
-                    context->makeDeferredRenderTargetContext(SkBackingFit::kExact, kS, kS,
-                                                             kRGBA_8888_GrPixelConfig, nullptr);
+                    context->makeRenderTargetContext(SkBackingFit::kExact, kS, kS,
+                                                     kRGBA_8888_GrPixelConfig, nullptr);
                 GrPaint paint;
                 paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
                 paint.addColorFragmentProcessor(TestFP::Make(context->resourceProvider(),
diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp
index 72f05f9..daeb13e 100644
--- a/tests/IntTextureTest.cpp
+++ b/tests/IntTextureTest.cpp
@@ -244,7 +244,7 @@
                                               kRGBA_8888_sint_GrPixelConfig, nullptr,
                                               testData.get(), 0);
 
-    sk_sp<GrRenderTargetContext> rtContext = context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> rtContext = context->makeRenderTargetContext(
             SkBackingFit::kExact, kS, kS, kRGBA_8888_GrPixelConfig, nullptr);
 
     struct {
diff --git a/tests/PreFlushCallbackTest.cpp b/tests/PreFlushCallbackTest.cpp
index da7f93b..7be01fb 100644
--- a/tests/PreFlushCallbackTest.cpp
+++ b/tests/PreFlushCallbackTest.cpp
@@ -419,8 +419,7 @@
 static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject* object, int start,
                                                  sk_sp<GrTextureProxy> fakeAtlas) {
 
-    sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContext(
-                                                                      SkBackingFit::kApprox,
+    sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContext(SkBackingFit::kApprox,
                                                                       3*kDrawnTileSize,
                                                                       kDrawnTileSize,
                                                                       kRGBA_8888_GrPixelConfig,
@@ -555,8 +554,7 @@
     static const int kFinalWidth = 6*kDrawnTileSize;
     static const int kFinalHeight = kDrawnTileSize;
 
-    sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContext(
-                                                                      SkBackingFit::kApprox,
+    sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContext(SkBackingFit::kApprox,
                                                                       kFinalWidth,
                                                                       kFinalHeight,
                                                                       kRGBA_8888_GrPixelConfig,
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 6afc3ac..4e4edb7 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -105,7 +105,7 @@
 DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
 
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
                                                                      SkBackingFit::kApprox,
                                                                      1, 1, kRGBA_8888_GrPixelConfig,
                                                                      nullptr));
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index e5bbc92..3eb4e16 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -137,7 +137,7 @@
     desc.fHeight = 10;
 
     for (int parentCnt = 0; parentCnt < 2; parentCnt++) {
-        sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
+        sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
                 SkBackingFit::kApprox, 1, 1, kRGBA_8888_GrPixelConfig, nullptr));
         {
             bool texelBufferSupport = context->caps()->shaderCaps()->texelBufferSupport();
@@ -290,7 +290,7 @@
     // hard-code that value here:
     SkRandom random(seed);
 
-    sk_sp<GrRenderTargetContext> rtc = context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> rtc = context->makeRenderTargetContext(
             SkBackingFit::kExact, 256, 256, kRGBA_8888_GrPixelConfig, nullptr);
     GrSurfaceDesc desc;
     desc.fWidth = 256;
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index cdcd8d7..967d86c 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -22,9 +22,9 @@
 static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* context,
                                    sk_sp<GrTextureProxy> rectProxy, uint32_t expectedPixelValues[]) {
     sk_sp<GrRenderTargetContext> rtContext(
-            context->makeDeferredRenderTargetContext(SkBackingFit::kExact, rectProxy->width(),
-                                                     rectProxy->height(), rectProxy->config(),
-                                                     nullptr));
+            context->makeRenderTargetContext(SkBackingFit::kExact, rectProxy->width(),
+                                             rectProxy->height(), rectProxy->config(),
+                                             nullptr));
     for (auto filter : {GrSamplerParams::kNone_FilterMode,
                         GrSamplerParams::kBilerp_FilterMode,
                         GrSamplerParams::kMipMap_FilterMode}) {
diff --git a/tests/RenderTargetContextTest.cpp b/tests/RenderTargetContextTest.cpp
index dbb4185..760b258 100644
--- a/tests/RenderTargetContextTest.cpp
+++ b/tests/RenderTargetContextTest.cpp
@@ -20,10 +20,17 @@
 
 static const int kSize = 64;
 
-static sk_sp<GrRenderTargetContext> get_rtc(GrContext* ctx) {
-    return ctx->makeDeferredRenderTargetContext(SkBackingFit::kExact,
-                                                kSize, kSize,
-                                                kRGBA_8888_GrPixelConfig, nullptr);
+static sk_sp<GrRenderTargetContext> get_rtc(GrContext* ctx, bool wrapped) {
+
+    if (wrapped) {
+        return ctx->makeRenderTargetContext(SkBackingFit::kExact,
+                                            kSize, kSize,
+                                            kRGBA_8888_GrPixelConfig, nullptr);
+    } else {
+        return ctx->makeDeferredRenderTargetContext(SkBackingFit::kExact,
+                                                    kSize, kSize,
+                                                    kRGBA_8888_GrPixelConfig, nullptr);
+    }
 }
 
 static void check_is_wrapped_status(skiatest::Reporter* reporter,
@@ -40,10 +47,16 @@
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RenderTargetContextTest, reporter, ctxInfo) {
     GrContext* ctx = ctxInfo.grContext();
 
+    // A wrapped rtCtx's textureProxy is also wrapped
+    {
+        sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx, true));
+        check_is_wrapped_status(reporter, rtCtx.get(), true);
+    }
+
     // Calling instantiate on a GrRenderTargetContext's textureProxy also instantiates the
     // GrRenderTargetContext
     {
-        sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx));
+        sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx, false));
 
         check_is_wrapped_status(reporter, rtCtx.get(), false);
 
@@ -58,7 +71,7 @@
 
     // readPixels switches a deferred rtCtx to wrapped
     {
-        sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx));
+        sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx, false));
 
         check_is_wrapped_status(reporter, rtCtx.get(), false);
 
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index 33d99f2..54c68ae 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -136,9 +136,9 @@
 
     // Create two render target contexts (L32 and S32)
     sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeSRGB();
-    sk_sp<GrRenderTargetContext> l32RenderTargetContext = context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> l32RenderTargetContext = context->makeRenderTargetContext(
         SkBackingFit::kExact, rtS, rtS, kRGBA_8888_GrPixelConfig, nullptr);
-    sk_sp<GrRenderTargetContext> s32RenderTargetContext = context->makeDeferredRenderTargetContext(
+    sk_sp<GrRenderTargetContext> s32RenderTargetContext = context->makeRenderTargetContext(
         SkBackingFit::kExact, rtS, rtS, kSRGBA_8888_GrPixelConfig, std::move(srgbColorSpace));
 
     SkRect rect = SkRect::MakeWH(SkIntToScalar(rtS), SkIntToScalar(rtS));
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index 162dd7e..8579c4d 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -303,8 +303,7 @@
 DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
     GrContext* ctx = ctxInfo.grContext();
 
-    sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext(
-                                                                  SkBackingFit::kApprox,
+    sk_sp<GrRenderTargetContext> rtc(ctx->makeRenderTargetContext(SkBackingFit::kApprox,
                                                                   800, 800,
                                                                   kRGBA_8888_GrPixelConfig,
                                                                   nullptr,