From d83ec0441279b79551b4ecb4598696249ea55145 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Mon, 10 Apr 2017 11:10:22 -0400 Subject: [PATCH] Rm makeRenderTargetContext in favor of deferred version Change-Id: Ifdf67453607256ba7cdb0837263377bd83907212 Reviewed-on: https://skia-review.googlesource.com/13001 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- gm/windowrectangles.cpp | 8 +-- include/gpu/GrContext.h | 34 ++--------- src/core/SkSpecialSurface.cpp | 2 +- src/gpu/GrClipStackClip.cpp | 2 +- src/gpu/GrContext.cpp | 61 +------------------- src/gpu/GrTextureProducer.cpp | 2 +- src/gpu/GrTextureToYUVPlanes.cpp | 10 ++-- src/gpu/GrYUVProvider.cpp | 2 +- src/gpu/SkGpuDevice.cpp | 14 ++--- src/gpu/effects/GrConfigConversionEffect.cpp | 6 +- src/gpu/text/GrAtlasTextContext.cpp | 2 +- src/image/SkImage_Gpu.cpp | 4 +- tests/ClearTest.cpp | 4 +- tests/GLProgramsTest.cpp | 4 +- tests/GpuSampleLocationsTest.cpp | 4 +- tests/ImageStorageTest.cpp | 4 +- tests/IntTextureTest.cpp | 2 +- tests/PreFlushCallbackTest.cpp | 6 +- tests/PrimitiveProcessorTest.cpp | 2 +- tests/ProcessorTest.cpp | 4 +- tests/RectangleTextureTest.cpp | 6 +- tests/RenderTargetContextTest.cpp | 25 ++------ tests/SRGBMipMapTest.cpp | 4 +- tests/TessellatingPathRendererTests.cpp | 3 +- 24 files changed, 64 insertions(+), 151 deletions(-) diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index 8110574a65..544f5e0c71 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -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 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; diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index d820202ca8..93b292d6ad 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -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 makeRenderTargetContext( - SkBackingFit fit, - int width, int height, - GrPixelConfig config, - sk_sp 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 makeDeferredRenderTargetContext( - SkBackingFit fit, + SkBackingFit fit, int width, int height, GrPixelConfig config, sk_sp 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 makeRenderTargetContextWithFallback( - SkBackingFit fit, - int width, int height, - GrPixelConfig config, - sk_sp 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 makeDeferredRenderTargetContextWithFallback( SkBackingFit fit, int width, int height, diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp index 40afb57cec..33ef97e5bd 100644 --- a/src/core/SkSpecialSurface.cpp +++ b/src/core/SkSpecialSurface.cpp @@ -164,7 +164,7 @@ sk_sp SkSpecialSurface::MakeRenderTarget(GrContext* context, return nullptr; } - sk_sp renderTargetContext(context->makeRenderTargetContext( + sk_sp renderTargetContext(context->makeDeferredRenderTargetContext( 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 b0109819d7..18df1d6711 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -392,7 +392,7 @@ sk_sp GrClipStackClip::createAlphaClipMask(GrContext* context, return proxy; } - sk_sp rtc(context->makeRenderTargetContextWithFallback( + sk_sp rtc(context->makeDeferredRenderTargetContextWithFallback( SkBackingFit::kApprox, reducedClip.width(), reducedClip.height(), diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index bfe094df7a..07ae6b226e 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -489,7 +489,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceProxy* srcProxy, SkColorSpace* sr // 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 tempRTC = fContext->makeRenderTargetContext( + sk_sp tempRTC = fContext->makeDeferredRenderTargetContext( tempDrawInfo.fTempSurfaceFit, tempDrawInfo.fTempSurfaceDesc.fWidth, tempDrawInfo.fTempSurfaceDesc.fHeight, @@ -776,23 +776,6 @@ static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) { } } -sk_sp GrContext::makeRenderTargetContextWithFallback( - SkBackingFit fit, - int width, int height, - GrPixelConfig config, - sk_sp 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 GrContext::makeDeferredRenderTargetContextWithFallback( SkBackingFit fit, int width, int height, @@ -810,46 +793,6 @@ sk_sp GrContext::makeDeferredRenderTargetContextWithFallb sampleCnt, origin, surfaceProps, budgeted); } -sk_sp GrContext::makeRenderTargetContext(SkBackingFit fit, - int width, int height, - GrPixelConfig config, - sk_sp 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 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 renderTargetContext( - this->contextPriv().makeWrappedRenderTargetContext(sk_ref_sp(tex->asRenderTarget()), - std::move(colorSpace), surfaceProps)); - if (!renderTargetContext) { - return nullptr; - } - - return renderTargetContext; -} - sk_sp GrContext::makeDeferredRenderTargetContext( SkBackingFit fit, int width, int height, @@ -859,6 +802,8 @@ sk_sp GrContext::makeDeferredRenderTargetContext( 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/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp index d226c3feb6..75796b1aa4 100644 --- a/src/gpu/GrTextureProducer.cpp +++ b/src/gpu/GrTextureProducer.cpp @@ -27,7 +27,7 @@ sk_sp GrTextureProducer::CopyOnGpu(GrContext* context, const SkRect dstRect = SkRect::MakeIWH(copyParams.fWidth, copyParams.fHeight); - sk_sp copyRTC = context->makeRenderTargetContextWithFallback( + sk_sp copyRTC = context->makeDeferredRenderTargetContextWithFallback( 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 0a0edee4df..c6f9794192 100644 --- a/src/gpu/GrTextureToYUVPlanes.cpp +++ b/src/gpu/GrTextureToYUVPlanes.cpp @@ -73,7 +73,7 @@ bool GrTextureToYUVPlanes(GrContext* context, sk_sp 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 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 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 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, diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp index cfd27d0d39..6b51303488 100644 --- a/src/gpu/GrYUVProvider.cpp +++ b/src/gpu/GrYUVProvider.cpp @@ -121,7 +121,7 @@ sk_sp GrYUVProvider::refAsTextureProxy(GrContext* ctx, } // We never want to perform color-space conversion during the decode - sk_sp renderTargetContext(ctx->makeRenderTargetContext( + sk_sp renderTargetContext(ctx->makeDeferredRenderTargetContext( SkBackingFit::kExact, desc.fWidth, desc.fHeight, desc.fConfig, nullptr, diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 11ed637250..a8d94a2012 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -168,7 +168,8 @@ sk_sp 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); @@ -1335,7 +1336,6 @@ sk_sp 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, @@ -1766,13 +1766,13 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApprox : SkBackingFit::kExact; - sk_sp rtc(fContext->makeRenderTargetContext( + sk_sp 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; diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 566a1afac8..fb0c6ba5cb 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -147,10 +147,12 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context const SkImageInfo ii = SkImageInfo::Make(kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType); - sk_sp readRTC(context->makeRenderTargetContext(SkBackingFit::kExact, + sk_sp readRTC(context->makeDeferredRenderTargetContext( + SkBackingFit::kExact, kSize, kSize, kConfig, nullptr)); - sk_sp tempRTC(context->makeRenderTargetContext(SkBackingFit::kExact, + sk_sp tempRTC(context->makeDeferredRenderTargetContext( + SkBackingFit::kExact, kSize, kSize, kConfig, nullptr)); if (!readRTC || !tempRTC) { diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 4e377c9595..d99f2828fc 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -352,7 +352,7 @@ DRAW_OP_TEST_DEFINE(TextBlobOp) { } // Setup dummy SkPaint / GrPaint / GrRenderTargetContext - sk_sp renderTargetContext(context->makeRenderTargetContext( + sk_sp renderTargetContext(context->makeDeferredRenderTargetContext( 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 119eb911e8..cd0f441d43 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -340,7 +340,7 @@ static sk_sp 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 renderTargetContext(ctx->makeRenderTargetContext( + sk_sp renderTargetContext(ctx->makeDeferredRenderTargetContext( SkBackingFit::kExact, width, height, kRGBA_8888_GrPixelConfig, @@ -871,7 +871,7 @@ sk_sp SkImage_Gpu::onMakeColorSpace(sk_sp colorSpace) con return sk_ref_sp(const_cast(this)); } - sk_sp renderTargetContext(fContext->makeRenderTargetContext( + sk_sp renderTargetContext(fContext->makeDeferredRenderTargetContext( 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 843c4c371c..45eb2afa2d 100644 --- a/tests/ClearTest.cpp +++ b/tests/ClearTest.cpp @@ -57,8 +57,8 @@ static bool reset_rtc(sk_sp* 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); diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 5400d92bc6..25cd3125b9 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -148,7 +148,7 @@ static sk_sp random_render_target_context(GrContext* cont : kBottomLeft_GrSurfaceOrigin; int sampleCnt = random->nextBool() ? SkTMin(4, caps->maxSampleCount()) : 0; - sk_sp renderTargetContext(context->makeRenderTargetContext( + sk_sp 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 renderTargetContext(context->makeRenderTargetContext( + sk_sp renderTargetContext(context->makeDeferredRenderTargetContext( SkBackingFit::kExact, kRenderTargetWidth, kRenderTargetHeight, diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp index 26d7e70148..6e685463b7 100644 --- a/tests/GpuSampleLocationsTest.cpp +++ b/tests/GpuSampleLocationsTest.cpp @@ -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); diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp index f3e3482b07..dc4d21294d 100644 --- a/tests/ImageStorageTest.cpp +++ b/tests/ImageStorageTest.cpp @@ -140,8 +140,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) { SkBudgeted::kYes, test.fData.get(), 0); sk_sp 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(), diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp index eacd0617a2..f583ee17c0 100644 --- a/tests/IntTextureTest.cpp +++ b/tests/IntTextureTest.cpp @@ -239,7 +239,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) { kRGBA_8888_sint_GrPixelConfig, nullptr, testData.get(), 0); - sk_sp rtContext = context->makeRenderTargetContext( + sk_sp rtContext = context->makeDeferredRenderTargetContext( SkBackingFit::kExact, kS, kS, kRGBA_8888_GrPixelConfig, nullptr); struct { diff --git a/tests/PreFlushCallbackTest.cpp b/tests/PreFlushCallbackTest.cpp index 7be01fb709..da7f93b583 100644 --- a/tests/PreFlushCallbackTest.cpp +++ b/tests/PreFlushCallbackTest.cpp @@ -419,7 +419,8 @@ private: static sk_sp make_upstream_image(GrContext* context, AtlasObject* object, int start, sk_sp fakeAtlas) { - sk_sp rtc(context->makeRenderTargetContext(SkBackingFit::kApprox, + sk_sp 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 rtc(context->makeRenderTargetContext(SkBackingFit::kApprox, + sk_sp rtc(context->makeDeferredRenderTargetContext( + SkBackingFit::kApprox, kFinalWidth, kFinalHeight, kRGBA_8888_GrPixelConfig, diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index 4e4edb7e35..6afc3acec8 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -105,7 +105,7 @@ private: DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - sk_sp renderTargetContext(context->makeRenderTargetContext( + sk_sp renderTargetContext(context->makeDeferredRenderTargetContext( SkBackingFit::kApprox, 1, 1, kRGBA_8888_GrPixelConfig, nullptr)); diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index 3eb4e16f20..e5bbc92759 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -137,7 +137,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { desc.fHeight = 10; for (int parentCnt = 0; parentCnt < 2; parentCnt++) { - sk_sp renderTargetContext(context->makeRenderTargetContext( + sk_sp 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 rtc = context->makeRenderTargetContext( + sk_sp rtc = context->makeDeferredRenderTargetContext( SkBackingFit::kExact, 256, 256, kRGBA_8888_GrPixelConfig, nullptr); GrSurfaceDesc desc; desc.fWidth = 256; diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index 41ee7b3c1c..e27955070b 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -21,9 +21,9 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* context, sk_sp rectProxy, uint32_t expectedPixelValues[]) { sk_sp 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}) { diff --git a/tests/RenderTargetContextTest.cpp b/tests/RenderTargetContextTest.cpp index 3db0473b62..7bf1ab73c0 100644 --- a/tests/RenderTargetContextTest.cpp +++ b/tests/RenderTargetContextTest.cpp @@ -15,17 +15,10 @@ static const int kSize = 64; -static sk_sp 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 get_rtc(GrContext* ctx) { + return ctx->makeDeferredRenderTargetContext(SkBackingFit::kExact, + kSize, kSize, + kRGBA_8888_GrPixelConfig, nullptr); } static void check_is_wrapped_status(skiatest::Reporter* reporter, @@ -42,16 +35,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 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 rtCtx(get_rtc(ctx, false)); + sk_sp rtCtx(get_rtc(ctx)); check_is_wrapped_status(reporter, rtCtx.get(), false); @@ -66,7 +53,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RenderTargetContextTest, reporter, ctxInfo) { // readPixels switches a deferred rtCtx to wrapped { - sk_sp rtCtx(get_rtc(ctx, false)); + sk_sp rtCtx(get_rtc(ctx)); check_is_wrapped_status(reporter, rtCtx.get(), false); diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp index 54c68aeb23..33d99f2208 100644 --- a/tests/SRGBMipMapTest.cpp +++ b/tests/SRGBMipMapTest.cpp @@ -136,9 +136,9 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) { // Create two render target contexts (L32 and S32) sk_sp srgbColorSpace = SkColorSpace::MakeSRGB(); - sk_sp l32RenderTargetContext = context->makeRenderTargetContext( + sk_sp l32RenderTargetContext = context->makeDeferredRenderTargetContext( SkBackingFit::kExact, rtS, rtS, kRGBA_8888_GrPixelConfig, nullptr); - sk_sp s32RenderTargetContext = context->makeRenderTargetContext( + sk_sp s32RenderTargetContext = context->makeDeferredRenderTargetContext( 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 8579c4dcbd..162dd7ea80 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -303,7 +303,8 @@ static void test_path(GrContext* ctx, DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { GrContext* ctx = ctxInfo.grContext(); - sk_sp rtc(ctx->makeRenderTargetContext(SkBackingFit::kApprox, + sk_sp rtc(ctx->makeDeferredRenderTargetContext( + SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr,