Rm makeRenderTargetContext in favor of deferred version (take 3)
authorRobert Phillips <robertphillips@google.com>
Mon, 24 Apr 2017 14:57:28 +0000 (10:57 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 25 Apr 2017 11:44:20 +0000 (11:44 +0000)
This is a reland of: https://skia-review.googlesource.com/c/13001/ (Rm makeRenderTargetContext in favor of deferred version)

TBR=bsalomon@google.com

Change-Id: If81f4d9fb889c091cd37ffde133d906fb3e37773
Reviewed-on: https://skia-review.googlesource.com/14027
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
27 files changed:
gm/windowrectangles.cpp
include/gpu/GrCaps.h
include/gpu/GrContext.h
src/core/SkSpecialSurface.cpp
src/gpu/GrClipStackClip.cpp
src/gpu/GrContext.cpp
src/gpu/GrRenderTargetOpList.cpp
src/gpu/GrTextureProducer.cpp
src/gpu/GrTextureToYUVPlanes.cpp
src/gpu/GrYUVProvider.cpp
src/gpu/SkGpuDevice.cpp
src/gpu/effects/GrConfigConversionEffect.cpp
src/gpu/effects/GrSimpleTextureEffect.h
src/gpu/text/GrAtlasTextContext.cpp
src/image/SkImage_Gpu.cpp
tests/ClearTest.cpp
tests/GLProgramsTest.cpp
tests/GpuSampleLocationsTest.cpp
tests/ImageStorageTest.cpp
tests/IntTextureTest.cpp
tests/PreFlushCallbackTest.cpp
tests/PrimitiveProcessorTest.cpp
tests/ProcessorTest.cpp
tests/RectangleTextureTest.cpp
tests/RenderTargetContextTest.cpp
tests/SRGBMipMapTest.cpp
tests/TessellatingPathRendererTests.cpp

index 8110574..544f5e0 100644 (file)
@@ -202,10 +202,10 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetCo
     const int padRight = (kDeviceRect.right() - kCoverRect.right()) / 2;
     const int padBottom = (kDeviceRect.bottom() - kCoverRect.bottom()) / 2;
     sk_sp<GrRenderTargetContext> maskRTC(
-        ctx->makeRenderTargetContextWithFallback(SkBackingFit::kExact,
-                                                 kCoverRect.width() + padRight,
-                                                 kCoverRect.height() + padBottom,
-                                                 kAlpha_8_GrPixelConfig, nullptr));
+        ctx->makeDeferredRenderTargetContextWithFallback(SkBackingFit::kExact,
+                                                         kCoverRect.width() + padRight,
+                                                         kCoverRect.height() + padBottom,
+                                                         kAlpha_8_GrPixelConfig, nullptr));
     if (!maskRTC ||
         !ctx->resourceProvider()->attachStencilAttachment(maskRTC->accessRenderTarget())) {
         return;
index 8b00580..abd10a1 100644 (file)
@@ -26,7 +26,6 @@ public:
     GrCaps(const GrContextOptions&);
 
     virtual SkString dump() const;
-
     const GrShaderCaps* shaderCaps() const { return fShaderCaps.get(); }
 
     bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; }
index 158699b..ec07e96 100644 (file)
@@ -183,25 +183,13 @@ public:
      */
     int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const;
 
-    /**
-     * Create both a GrRenderTarget and a matching GrRenderTargetContext to wrap it.
-     * We guarantee that "asTexture" will succeed for renderTargetContexts created
-     * via this entry point.
+    /*
+     * 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.
      */
-    sk_sp<GrRenderTargetContext> makeRenderTargetContext(
-                                                 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);
-
-    // 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, 
+                                                 SkBackingFit fit,
                                                  int width, int height,
                                                  GrPixelConfig config,
                                                  sk_sp<SkColorSpace> colorSpace,
@@ -215,18 +203,6 @@ public:
      * 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,
index 40afb57..33ef97e 100644 (file)
@@ -164,7 +164,7 @@ sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context,
         return nullptr;
     }
 
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
         SkBackingFit::kApprox, width, height, config, std::move(colorSpace)));
     if (!renderTargetContext) {
         return nullptr;
index b010981..18df1d6 100644 (file)
@@ -392,7 +392,7 @@ sk_sp<GrTextureProxy> GrClipStackClip::createAlphaClipMask(GrContext* context,
         return proxy;
     }
 
-    sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContextWithFallback(
+    sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContextWithFallback(
                                                                              SkBackingFit::kApprox,
                                                                              reducedClip.width(),
                                                                              reducedClip.height(),
index 7d6a90a..2a3852c 100644 (file)
@@ -484,7 +484,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src,
         // 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->makeRenderTargetContext(
+        sk_sp<GrRenderTargetContext> tempRTC = fContext->makeDeferredRenderTargetContext(
                                                            tempDrawInfo.fTempSurfaceFit,
                                                            tempDrawInfo.fTempSurfaceDesc.fWidth,
                                                            tempDrawInfo.fTempSurfaceDesc.fHeight,
@@ -771,23 +771,6 @@ static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) {
     }
 }
 
-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,
@@ -805,48 +788,6 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContextWithFallb
                                                  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,
@@ -856,6 +797,8 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
                                                         GrSurfaceOrigin origin,
                                                         const SkSurfaceProps* surfaceProps,
                                                         SkBudgeted budgeted) {
+    SkASSERT(kDefault_GrSurfaceOrigin != origin);
+
     GrSurfaceDesc desc;
     desc.fFlags = kRenderTarget_GrSurfaceFlag;
     desc.fOrigin = origin;
index 0bc6708..3d4edb2 100644 (file)
@@ -227,8 +227,11 @@ void GrRenderTargetOpList::fullClear(GrRenderTargetContext* renderTargetContext,
     // 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
-    SkASSERT((fLastFullClearResourceID == renderTarget->uniqueID()) ==
-             (fLastFullClearProxyID == renderTargetContext->asRenderTargetProxy()->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()));
     if (fLastFullClearResourceID == renderTarget->uniqueID()) {
         // As currently implemented, fLastFullClearOp should be the last op because we would
         // have cleared it when another op was recorded.
index d226c3f..75796b1 100644 (file)
@@ -27,7 +27,7 @@ sk_sp<GrTextureProxy> GrTextureProducer::CopyOnGpu(GrContext* context,
 
     const SkRect dstRect = SkRect::MakeIWH(copyParams.fWidth, copyParams.fHeight);
 
-    sk_sp<GrRenderTargetContext> copyRTC = context->makeRenderTargetContextWithFallback(
+    sk_sp<GrRenderTargetContext> copyRTC = context->makeDeferredRenderTargetContextWithFallback(
         SkBackingFit::kExact, dstRect.width(), dstRect.height(), config, nullptr);
     if (!copyRTC) {
         return nullptr;
index 0a0edee..c6f9794 100644 (file)
@@ -73,7 +73,7 @@ bool GrTextureToYUVPlanes(GrContext* context, sk_sp<GrTextureProxy> proxy,
         // 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->makeRenderTargetContextWithFallback(
+            yuvRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
                                                                            SkBackingFit::kApprox,
                                                                            sizes[0].fWidth,
                                                                            sizes[0].fHeight,
@@ -83,7 +83,7 @@ bool GrTextureToYUVPlanes(GrContext* context, sk_sp<GrTextureProxy> proxy,
                 return false;
             }
         } else {
-            yRenderTargetContext = context->makeRenderTargetContextWithFallback(
+            yRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
                                                                              SkBackingFit::kApprox,
                                                                              sizes[0].fWidth,
                                                                              sizes[0].fHeight,
@@ -94,7 +94,7 @@ bool GrTextureToYUVPlanes(GrContext* context, sk_sp<GrTextureProxy> proxy,
             }
             if (sizes[1] == sizes[2]) {
                 // TODO: Add support for GL_RG when available.
-                uvRenderTargetContext = context->makeRenderTargetContextWithFallback(
+                uvRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
                                                                            SkBackingFit::kApprox,
                                                                            sizes[1].fWidth,
                                                                            sizes[1].fHeight,
@@ -104,13 +104,13 @@ bool GrTextureToYUVPlanes(GrContext* context, sk_sp<GrTextureProxy> proxy,
                     return false;
                 }
             } else {
-                uRenderTargetContext = context->makeRenderTargetContextWithFallback(
+                uRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
                                                                              SkBackingFit::kApprox,
                                                                              sizes[1].fWidth,
                                                                              sizes[1].fHeight,
                                                                              kAlpha_8_GrPixelConfig,
                                                                              nullptr);
-                vRenderTargetContext = context->makeRenderTargetContextWithFallback(
+                vRenderTargetContext = context->makeDeferredRenderTargetContextWithFallback(
                                                                              SkBackingFit::kApprox,
                                                                              sizes[2].fWidth,
                                                                              sizes[2].fHeight,
index cfd27d0..6b51303 100644 (file)
@@ -121,7 +121,7 @@ sk_sp<GrTextureProxy> GrYUVProvider::refAsTextureProxy(GrContext* ctx,
     }
 
     // We never want to perform color-space conversion during the decode
-    sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeDeferredRenderTargetContext(
                                                                           SkBackingFit::kExact,
                                                                           desc.fWidth, desc.fHeight,
                                                                           desc.fConfig, nullptr,
index 7046f1c..6ddae65 100644 (file)
@@ -168,7 +168,8 @@ sk_sp<GrRenderTargetContext> SkGpuDevice::MakeRenderTargetContext(
     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->makeRenderTargetContext(SkBackingFit::kExact,
+    return context->makeDeferredRenderTargetContext(
+                                    SkBackingFit::kExact,
                                     origInfo.width(), origInfo.height(),
                                     config, origInfo.refColorSpace(), sampleCount,
                                     origin, surfaceProps, budgeted);
@@ -1329,7 +1330,6 @@ sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() {
     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 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
     SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApprox
                                                             : SkBackingFit::kExact;
 
-    sk_sp<GrRenderTargetContext> rtc(fContext->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> rtc(fContext->makeDeferredRenderTargetContext(
                                                    fit,
                                                    cinfo.fInfo.width(), cinfo.fInfo.height(),
-                                                   fRenderTargetContext->config(), 
-                                                   fRenderTargetContext->refColorSpace(), 
-                                                   fRenderTargetContext->desc().fSampleCnt, 
-                                                   kDefault_GrSurfaceOrigin,
+                                                   fRenderTargetContext->config(),
+                                                   fRenderTargetContext->refColorSpace(),
+                                                   fRenderTargetContext->desc().fSampleCnt,
+                                                   kBottomLeft_GrSurfaceOrigin,
                                                    &props));
     if (!rtc) {
         return nullptr;
index 2e0886f..41c7e6f 100644 (file)
@@ -121,10 +121,12 @@ bool GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
     const SkImageInfo ii = SkImageInfo::Make(kSize, kSize,
                                              kRGBA_8888_SkColorType, kPremul_SkAlphaType);
 
-    sk_sp<GrRenderTargetContext> readRTC(context->makeRenderTargetContext(SkBackingFit::kExact,
+    sk_sp<GrRenderTargetContext> readRTC(context->makeDeferredRenderTargetContext(
+                                                                          SkBackingFit::kExact,
                                                                           kSize, kSize,
                                                                           kConfig, nullptr));
-    sk_sp<GrRenderTargetContext> tempRTC(context->makeRenderTargetContext(SkBackingFit::kExact,
+    sk_sp<GrRenderTargetContext> tempRTC(context->makeDeferredRenderTargetContext(
+                                                                          SkBackingFit::kExact,
                                                                           kSize, kSize,
                                                                           kConfig, nullptr));
     if (!readRTC || !readRTC->asTextureProxy() || !tempRTC) {
index 8edec81..7d5232c 100644 (file)
@@ -25,6 +25,14 @@ public:
                                            sk_sp<GrTextureProxy> proxy,
                                            sk_sp<GrColorSpaceXform> colorSpaceXform,
                                            const SkMatrix& matrix) {
+        // MDB TODO: remove this instantiation once instantiation is pushed past the
+        // TextureSamplers. Instantiation failure in the TextureSampler is difficult to
+        // recover from.
+        GrTexture* temp = proxy->instantiate(resourceProvider);
+        if (!temp) {
+            return nullptr;
+        }
+
         return sk_sp<GrFragmentProcessor>(
             new GrSimpleTextureEffect(resourceProvider, std::move(proxy),
                                       std::move(colorSpaceXform), matrix,
@@ -37,6 +45,14 @@ public:
                                            sk_sp<GrColorSpaceXform> colorSpaceXform,
                                            const SkMatrix& matrix,
                                            GrSamplerParams::FilterMode filterMode) {
+        // MDB TODO: remove this instantiation once instantiation is pushed past the
+        // TextureSamplers. Instantiation failure in the TextureSampler is difficult to
+        // recover from.
+        GrTexture* temp = proxy->instantiate(resourceProvider);
+        if (!temp) {
+            return nullptr;
+        }
+
         return sk_sp<GrFragmentProcessor>(
             new GrSimpleTextureEffect(resourceProvider, std::move(proxy),
                                       std::move(colorSpaceXform),
@@ -48,6 +64,14 @@ public:
                                            sk_sp<GrColorSpaceXform> colorSpaceXform,
                                            const SkMatrix& matrix,
                                            const GrSamplerParams& p) {
+        // MDB TODO: remove this instantiation once instantiation is pushed past the
+        // TextureSamplers. Instantiation failure in the TextureSampler is difficult to
+        // recover from.
+        GrTexture* temp = proxy->instantiate(resourceProvider);
+        if (!temp) {
+            return nullptr;
+        }
+
         return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(resourceProvider,
                                                                     std::move(proxy),
                                                                     std::move(colorSpaceXform),
index 4e377c9..d99f282 100644 (file)
@@ -352,7 +352,7 @@ DRAW_OP_TEST_DEFINE(TextBlobOp) {
     }
 
     // Setup dummy SkPaint / GrPaint / GrRenderTargetContext
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
         SkBackingFit::kApprox, 1024, 1024, kRGBA_8888_GrPixelConfig, nullptr));
 
     SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
index dd1b0c1..96a81f5 100644 (file)
@@ -385,7 +385,7 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
     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->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeDeferredRenderTargetContext(
                                                                          SkBackingFit::kExact,
                                                                          width, height,
                                                                          kRGBA_8888_GrPixelConfig,
@@ -922,7 +922,7 @@ sk_sp<SkImage> SkImage_Gpu::onMakeColorSpace(sk_sp<SkColorSpace> colorSpace) con
         return sk_ref_sp(const_cast<SkImage_Gpu*>(this));
     }
 
-    sk_sp<GrRenderTargetContext> renderTargetContext(fContext->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(fContext->makeDeferredRenderTargetContext(
         SkBackingFit::kExact, this->width(), this->height(), kRGBA_8888_GrPixelConfig, nullptr));
     if (!renderTargetContext) {
         return nullptr;
index 843c4c3..45eb2af 100644 (file)
@@ -57,8 +57,8 @@ static bool reset_rtc(sk_sp<GrRenderTargetContext>* rtc, GrContext* context, int
     }
     context->freeGpuResources();
 
-    *rtc = context->makeRenderTargetContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig,
-                                            nullptr);
+    *rtc = context->makeDeferredRenderTargetContext(SkBackingFit::kExact, w, h,
+                                                    kRGBA_8888_GrPixelConfig, nullptr);
 
     SkASSERT((*rtc)->accessRenderTarget()->uniqueID() != oldID);
 
index 5400d92..25cd312 100644 (file)
@@ -148,7 +148,7 @@ static sk_sp<GrRenderTargetContext> random_render_target_context(GrContext* cont
                                                 : kBottomLeft_GrSurfaceOrigin;
     int sampleCnt = random->nextBool() ? SkTMin(4, caps->maxSampleCount()) : 0;
 
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
                                                                            SkBackingFit::kExact,
                                                                            kRenderTargetWidth,
                                                                            kRenderTargetHeight,
@@ -345,7 +345,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
     drawingManager->flush(nullptr);
 
     // Validate that GrFPs work correctly without an input.
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
                                                                            SkBackingFit::kExact,
                                                                            kRenderTargetWidth,
                                                                            kRenderTargetHeight,
index 26d7e70..6e68546 100644 (file)
@@ -122,11 +122,11 @@ void test_sampleLocations(skiatest::Reporter* reporter, TestSampleLocationsInter
     for (int i = 0; i < numTestPatterns; ++i) {
         int numSamples = (int)kTestPatterns[i].size();
         GrAlwaysAssert(numSamples > 1 && SkIsPow2(numSamples));
-        bottomUps[i] = ctx->makeRenderTargetContextWithFallback(
+        bottomUps[i] = ctx->makeDeferredRenderTargetContextWithFallback(
                            SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr,
                            rand.nextRangeU(1 + numSamples / 2, numSamples),
                            kBottomLeft_GrSurfaceOrigin);
-        topDowns[i] = ctx->makeRenderTargetContextWithFallback(
+        topDowns[i] = ctx->makeDeferredRenderTargetContextWithFallback(
                           SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr,
                           rand.nextRangeU(1 + numSamples / 2, numSamples),
                           kTopLeft_GrSurfaceOrigin);
index f3e3482..dc4d212 100644 (file)
@@ -140,8 +140,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
                                                  SkBudgeted::kYes, test.fData.get(), 0);
 
                 sk_sp<GrRenderTargetContext> rtContext =
-                    context->makeRenderTargetContext(SkBackingFit::kExact, kS, kS,
-                                                     kRGBA_8888_GrPixelConfig, nullptr);
+                    context->makeDeferredRenderTargetContext(SkBackingFit::kExact, kS, kS,
+                                                             kRGBA_8888_GrPixelConfig, nullptr);
                 GrPaint paint;
                 paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
                 paint.addColorFragmentProcessor(TestFP::Make(context->resourceProvider(),
index daeb13e..72f05f9 100644 (file)
@@ -244,7 +244,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
                                               kRGBA_8888_sint_GrPixelConfig, nullptr,
                                               testData.get(), 0);
 
-    sk_sp<GrRenderTargetContext> rtContext = context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> rtContext = context->makeDeferredRenderTargetContext(
             SkBackingFit::kExact, kS, kS, kRGBA_8888_GrPixelConfig, nullptr);
 
     struct {
index 7be01fb..da7f93b 100644 (file)
@@ -419,7 +419,8 @@ private:
 static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject* object, int start,
                                                  sk_sp<GrTextureProxy> fakeAtlas) {
 
-    sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContext(SkBackingFit::kApprox,
+    sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContext(
+                                                                      SkBackingFit::kApprox,
                                                                       3*kDrawnTileSize,
                                                                       kDrawnTileSize,
                                                                       kRGBA_8888_GrPixelConfig,
@@ -554,7 +555,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(PreFlushCallbackTest, reporter, ctxInfo) {
     static const int kFinalWidth = 6*kDrawnTileSize;
     static const int kFinalHeight = kDrawnTileSize;
 
-    sk_sp<GrRenderTargetContext> rtc(context->makeRenderTargetContext(SkBackingFit::kApprox,
+    sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContext(
+                                                                      SkBackingFit::kApprox,
                                                                       kFinalWidth,
                                                                       kFinalHeight,
                                                                       kRGBA_8888_GrPixelConfig,
index 4e4edb7..6afc3ac 100644 (file)
@@ -105,7 +105,7 @@ private:
 DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
 
-    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
                                                                      SkBackingFit::kApprox,
                                                                      1, 1, kRGBA_8888_GrPixelConfig,
                                                                      nullptr));
index 3eb4e16..e5bbc92 100644 (file)
@@ -137,7 +137,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
     desc.fHeight = 10;
 
     for (int parentCnt = 0; parentCnt < 2; parentCnt++) {
-        sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext(
+        sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
                 SkBackingFit::kApprox, 1, 1, kRGBA_8888_GrPixelConfig, nullptr));
         {
             bool texelBufferSupport = context->caps()->shaderCaps()->texelBufferSupport();
@@ -290,7 +290,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
     // hard-code that value here:
     SkRandom random(seed);
 
-    sk_sp<GrRenderTargetContext> rtc = context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> rtc = context->makeDeferredRenderTargetContext(
             SkBackingFit::kExact, 256, 256, kRGBA_8888_GrPixelConfig, nullptr);
     GrSurfaceDesc desc;
     desc.fWidth = 256;
index 967d86c..cdcd8d7 100644 (file)
@@ -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->makeRenderTargetContext(SkBackingFit::kExact, rectProxy->width(),
-                                             rectProxy->height(), rectProxy->config(),
-                                             nullptr));
+            context->makeDeferredRenderTargetContext(SkBackingFit::kExact, rectProxy->width(),
+                                                     rectProxy->height(), rectProxy->config(),
+                                                     nullptr));
     for (auto filter : {GrSamplerParams::kNone_FilterMode,
                         GrSamplerParams::kBilerp_FilterMode,
                         GrSamplerParams::kMipMap_FilterMode}) {
index 760b258..dbb4185 100644 (file)
 
 static const int kSize = 64;
 
-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 sk_sp<GrRenderTargetContext> get_rtc(GrContext* ctx) {
+    return ctx->makeDeferredRenderTargetContext(SkBackingFit::kExact,
+                                                kSize, kSize,
+                                                kRGBA_8888_GrPixelConfig, nullptr);
 }
 
 static void check_is_wrapped_status(skiatest::Reporter* reporter,
@@ -47,16 +40,10 @@ static void check_is_wrapped_status(skiatest::Reporter* reporter,
 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, false));
+        sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx));
 
         check_is_wrapped_status(reporter, rtCtx.get(), false);
 
@@ -71,7 +58,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RenderTargetContextTest, reporter, ctxInfo) {
 
     // readPixels switches a deferred rtCtx to wrapped
     {
-        sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx, false));
+        sk_sp<GrRenderTargetContext> rtCtx(get_rtc(ctx));
 
         check_is_wrapped_status(reporter, rtCtx.get(), false);
 
index 54c68ae..33d99f2 100644 (file)
@@ -136,9 +136,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
 
     // Create two render target contexts (L32 and S32)
     sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeSRGB();
-    sk_sp<GrRenderTargetContext> l32RenderTargetContext = context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> l32RenderTargetContext = context->makeDeferredRenderTargetContext(
         SkBackingFit::kExact, rtS, rtS, kRGBA_8888_GrPixelConfig, nullptr);
-    sk_sp<GrRenderTargetContext> s32RenderTargetContext = context->makeRenderTargetContext(
+    sk_sp<GrRenderTargetContext> s32RenderTargetContext = context->makeDeferredRenderTargetContext(
         SkBackingFit::kExact, rtS, rtS, kSRGBA_8888_GrPixelConfig, std::move(srgbColorSpace));
 
     SkRect rect = SkRect::MakeWH(SkIntToScalar(rtS), SkIntToScalar(rtS));
index 8579c4d..162dd7e 100644 (file)
@@ -303,7 +303,8 @@ static void test_path(GrContext* ctx,
 DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
     GrContext* ctx = ctxInfo.grContext();
 
-    sk_sp<GrRenderTargetContext> rtc(ctx->makeRenderTargetContext(SkBackingFit::kApprox,
+    sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext(
+                                                                  SkBackingFit::kApprox,
                                                                   800, 800,
                                                                   kRGBA_8888_GrPixelConfig,
                                                                   nullptr,