diff options
-rw-r--r-- | include/private/GrSurfaceProxy.h | 28 | ||||
-rw-r--r-- | src/gpu/GrBackendTextureImageGenerator.cpp | 5 | ||||
-rw-r--r-- | src/gpu/GrClipStackClip.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrProxyProvider.cpp | 33 | ||||
-rw-r--r-- | src/gpu/GrProxyProvider.h | 25 | ||||
-rw-r--r-- | src/gpu/GrReducedClip.cpp | 9 | ||||
-rw-r--r-- | src/gpu/GrReducedClip.h | 5 | ||||
-rw-r--r-- | src/gpu/GrSurfaceProxy.cpp | 31 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp | 17 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.h | 11 | ||||
-rw-r--r-- | tests/GrCCPRTest.cpp | 6 | ||||
-rw-r--r-- | tests/LazyProxyTest.cpp | 33 |
12 files changed, 115 insertions, 92 deletions
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index cc12fcb010..55b30a5d5b 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -185,31 +185,6 @@ public: // DDL TODO: remove this entry point static sk_sp<GrTextureProxy> MakeWrapped(sk_sp<GrTexture>, GrSurfaceOrigin); - using LazyInstantiateCallback = std::function<sk_sp<GrTexture>(GrResourceProvider*, - GrSurfaceOrigin* outOrigin)>; - - enum class Renderable : bool { - kNo = false, - kYes = true - }; - - /** - * Creates a texture proxy that will be instantiated by a user-supplied callback during flush. - * (Stencil is not supported by this method.) The width and height must either both be greater - * than 0 or both less than or equal to zero. A non-positive value is a signal that the width - * and height are currently unknown. - * - * When called, the callback must be able to cleanup any resources that it captured at creation. - * It also must support being passed in a null GrResourceProvider. When this happens, the - * callback should cleanup any resources it captured and return an empty sk_sp<GrTextureProxy>. - * DDL TODO: remove this entry point - */ - static sk_sp<GrTextureProxy> MakeLazy(LazyInstantiateCallback&&, const GrSurfaceDesc& desc, - GrMipMapped, SkBackingFit fit, SkBudgeted budgeted); - - static sk_sp<GrTextureProxy> MakeFullyLazy(LazyInstantiateCallback&&, Renderable, - GrPixelConfig); - enum class LazyState { kNot, // The proxy has no lazy callback that must be made. kPartially, // The proxy has a lazy callback but knows basic information about itself. @@ -383,6 +358,9 @@ protected: // Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources } + using LazyInstantiateCallback = std::function<sk_sp<GrTexture>(GrResourceProvider*, + GrSurfaceOrigin* outOrigin)>; + // Lazy-callback version GrSurfaceProxy(LazyInstantiateCallback&& callback, const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budgeted, uint32_t flags); diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp index efd366e63d..9b55704dce 100644 --- a/src/gpu/GrBackendTextureImageGenerator.cpp +++ b/src/gpu/GrBackendTextureImageGenerator.cpp @@ -10,6 +10,7 @@ #include "GrContext.h" #include "GrContextPriv.h" #include "GrGpu.h" +#include "GrProxyProvider.h" #include "GrRenderTargetContext.h" #include "GrResourceCache.h" #include "GrResourceProvider.h" @@ -91,6 +92,8 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture( return nullptr; } + auto proxyProvider = context->contextPriv().proxyProvider(); + uint32_t expectedID = SK_InvalidGenID; if (!fRefHelper->fBorrowingContextID.compare_exchange(&expectedID, context->uniqueID())) { if (fRefHelper->fBorrowingContextID != context->uniqueID()) { @@ -116,7 +119,7 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture( RefHelper* refHelper = fRefHelper; refHelper->ref(); - sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeLazy( + sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy( [refHelper, semaphore, backendTexture, surfaceOrigin] (GrResourceProvider* resourceProvider, GrSurfaceOrigin* outOrigin) { if (!resourceProvider) { diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index 35fd52df0e..8f82ea1228 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -190,6 +190,7 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar return true; } + GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); const auto* caps = context->caps()->shaderCaps(); int maxWindowRectangles = renderTargetContext->priv().maxWindowRectangles(); int maxAnalyticFPs = context->caps()->maxClipAnalyticFPs(); @@ -230,7 +231,8 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar // can cause a flush or otherwise change which opList our draw is going into. uint32_t opListID = renderTargetContext->getOpList()->uniqueID(); int rtWidth = renderTargetContext->width(), rtHeight = renderTargetContext->height(); - if (auto clipFPs = reducedClip.finishAndDetachAnalyticFPs(opListID, rtWidth, rtHeight)) { + if (auto clipFPs = reducedClip.finishAndDetachAnalyticFPs(proxyProvider, opListID, + rtWidth, rtHeight)) { out->addCoverageFP(std::move(clipFPs)); } diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 1255f7e8e3..bf5caeb26a 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -375,6 +375,39 @@ sk_sp<GrSurfaceProxy> GrProxyProvider::createWrappedRenderTargetProxy(const GrBa return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(rt), origin)); } +sk_sp<GrTextureProxy> GrProxyProvider::createLazyProxy(LazyInstantiateCallback&& callback, + const GrSurfaceDesc& desc, + GrMipMapped mipMapped, + SkBackingFit fit, SkBudgeted budgeted) { + SkASSERT((desc.fWidth <= 0 && desc.fHeight <= 0) || + (desc.fWidth > 0 && desc.fHeight > 0)); + uint32_t flags = GrResourceProvider::kNoPendingIO_Flag; + return sk_sp<GrTextureProxy>(SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags) ? + new GrTextureRenderTargetProxy(std::move(callback), desc, + mipMapped, fit, budgeted, flags) : + new GrTextureProxy(std::move(callback), desc, mipMapped, fit, + budgeted, flags)); + +} + +sk_sp<GrTextureProxy> GrProxyProvider::createFullyLazyProxy(LazyInstantiateCallback&& callback, + Renderable renderable, + GrPixelConfig config) { + GrSurfaceDesc desc; + if (Renderable::kYes == renderable) { + desc.fFlags = kRenderTarget_GrSurfaceFlag; + } + desc.fOrigin = kTopLeft_GrSurfaceOrigin; + desc.fWidth = -1; + desc.fHeight = -1; + desc.fConfig = config; + desc.fSampleCnt = 0; + + return this->createLazyProxy(std::move(callback), desc, GrMipMapped::kNo, + SkBackingFit::kApprox, SkBudgeted::kYes); + +} + bool GrProxyProvider::IsFunctionallyExact(GrSurfaceProxy* proxy) { return proxy->priv().isExact() || (SkIsPow2(proxy->width()) && SkIsPow2(proxy->height())); } diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h index 1150c794a6..4c93886da6 100644 --- a/src/gpu/GrProxyProvider.h +++ b/src/gpu/GrProxyProvider.h @@ -87,7 +87,6 @@ public: SkDestinationSurfaceColorMode mipColorMode = SkDestinationSurfaceColorMode::kLegacy); - /* * Create a mipmapped texture proxy without any data. * @@ -128,6 +127,30 @@ public: GrSurfaceOrigin origin, int sampleCnt); + using LazyInstantiateCallback = std::function<sk_sp<GrTexture>(GrResourceProvider*, + GrSurfaceOrigin* outOrigin)>; + + enum class Renderable : bool { + kNo = false, + kYes = true + }; + + /** + * Creates a texture proxy that will be instantiated by a user-supplied callback during flush. + * (Stencil is not supported by this method.) The width and height must either both be greater + * than 0 or both less than or equal to zero. A non-positive value is a signal that the width + * and height are currently unknown. + * + * When called, the callback must be able to cleanup any resources that it captured at creation. + * It also must support being passed in a null GrResourceProvider. When this happens, the + * callback should cleanup any resources it captured and return an empty sk_sp<GrTextureProxy>. + */ + sk_sp<GrTextureProxy> createLazyProxy(LazyInstantiateCallback&&, const GrSurfaceDesc&, + GrMipMapped, SkBackingFit, SkBudgeted); + + sk_sp<GrTextureProxy> createFullyLazyProxy(LazyInstantiateCallback&&, + Renderable, GrPixelConfig); + // 'proxy' is about to be used as a texture src or drawn to. This query can be used to // determine if it is going to need a texture domain or a full clear. static bool IsFunctionallyExact(GrSurfaceProxy* proxy); diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp index 85a19ed2e5..9d27f7696e 100644 --- a/src/gpu/GrReducedClip.cpp +++ b/src/gpu/GrReducedClip.cpp @@ -954,9 +954,9 @@ bool GrReducedClip::drawStencilClipMask(GrContext* context, return true; } -std::unique_ptr<GrFragmentProcessor> GrReducedClip::finishAndDetachAnalyticFPs(uint32_t opListID, - int rtWidth, - int rtHeight) { +std::unique_ptr<GrFragmentProcessor> GrReducedClip::finishAndDetachAnalyticFPs( + GrProxyProvider* proxyProvider, uint32_t opListID, + int rtWidth, int rtHeight) { // Make sure finishAndDetachAnalyticFPs hasn't been called already. SkDEBUGCODE(for (const auto& fp : fAnalyticFPs) { SkASSERT(fp); }) @@ -964,7 +964,8 @@ std::unique_ptr<GrFragmentProcessor> GrReducedClip::finishAndDetachAnalyticFPs(u fAnalyticFPs.reserve(fAnalyticFPs.count() + fCCPRClipPaths.count()); for (const SkPath& ccprClipPath : fCCPRClipPaths) { SkASSERT(fHasScissor); - auto fp = fCCPR->makeClipProcessor(opListID, ccprClipPath, fScissor, rtWidth, rtHeight); + auto fp = fCCPR->makeClipProcessor(proxyProvider, opListID, ccprClipPath, fScissor, + rtWidth, rtHeight); fAnalyticFPs.push_back(std::move(fp)); } fCCPRClipPaths.reset(); diff --git a/src/gpu/GrReducedClip.h b/src/gpu/GrReducedClip.h index f47b09ab64..c3838d8802 100644 --- a/src/gpu/GrReducedClip.h +++ b/src/gpu/GrReducedClip.h @@ -97,8 +97,9 @@ public: * the render target context, surface allocations, and even switching render targets (pre MDB) * may cause flushes or otherwise change which opList the actual draw is going into. */ - std::unique_ptr<GrFragmentProcessor> finishAndDetachAnalyticFPs(uint32_t opListID, int rtWidth, - int rtHeight); + std::unique_ptr<GrFragmentProcessor> finishAndDetachAnalyticFPs(GrProxyProvider*, + uint32_t opListID, + int rtWidth, int rtHeight); private: void walkStack(const SkClipStack&, const SkRect& queryBounds); diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index 0408b79c91..828b936c8b 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -250,37 +250,6 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex, GrSurfac } } -sk_sp<GrTextureProxy> GrSurfaceProxy::MakeLazy(LazyInstantiateCallback&& callback, - const GrSurfaceDesc& desc, - GrMipMapped mipMapped, - SkBackingFit fit, - SkBudgeted budgeted) { - SkASSERT((desc.fWidth <= 0 && desc.fHeight <= 0) || - (desc.fWidth > 0 && desc.fHeight > 0)); - uint32_t flags = GrResourceProvider::kNoPendingIO_Flag; - return sk_sp<GrTextureProxy>(SkToBool(kRenderTarget_GrSurfaceFlag & desc.fFlags) ? - new GrTextureRenderTargetProxy(std::move(callback), desc, - mipMapped, fit, budgeted, flags) : - new GrTextureProxy(std::move(callback), desc, mipMapped, fit, - budgeted, flags)); -} - -sk_sp<GrTextureProxy> GrSurfaceProxy::MakeFullyLazy(LazyInstantiateCallback&& callback, - Renderable renderable, GrPixelConfig config) { - GrSurfaceDesc desc; - if (Renderable::kYes == renderable) { - desc.fFlags = kRenderTarget_GrSurfaceFlag; - } - desc.fOrigin = kTopLeft_GrSurfaceOrigin; - desc.fWidth = -1; - desc.fHeight = -1; - desc.fConfig = config; - desc.fSampleCnt = 0; - - return MakeLazy(std::move(callback), desc, GrMipMapped::kNo, SkBackingFit::kApprox, - SkBudgeted::kYes); -} - int GrSurfaceProxy::worstCaseWidth() const { SkASSERT(LazyState::kFully != this->lazyInstantiationState()); if (fTarget) { diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp index 1e0bb29acd..91074cb714 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp @@ -12,6 +12,7 @@ #include "GrGpu.h" #include "GrGpuCommandBuffer.h" #include "GrOpFlushState.h" +#include "GrProxyProvider.h" #include "GrRenderTargetOpList.h" #include "GrStyle.h" #include "GrTexture.h" @@ -201,8 +202,9 @@ bool GrCoverageCountingPathRenderer::canMakeClipProcessor(const SkPath& deviceSp } std::unique_ptr<GrFragmentProcessor> GrCoverageCountingPathRenderer::makeClipProcessor( - uint32_t opListID, const SkPath& deviceSpacePath, const SkIRect& accessRect, int rtWidth, - int rtHeight) { + GrProxyProvider* proxyProvider, + uint32_t opListID, const SkPath& deviceSpacePath, const SkIRect& accessRect, + int rtWidth, int rtHeight) { using MustCheckBounds = GrCCClipProcessor::MustCheckBounds; SkASSERT(!fFlushing); @@ -211,7 +213,7 @@ std::unique_ptr<GrFragmentProcessor> GrCoverageCountingPathRenderer::makeClipPro ClipPath& clipPath = fRTPendingPathsMap[opListID].fClipPaths[deviceSpacePath.getGenerationID()]; if (clipPath.isUninitialized()) { // This ClipPath was just created during lookup. Initialize it. - clipPath.init(deviceSpacePath, accessRect, rtWidth, rtHeight); + clipPath.init(proxyProvider, deviceSpacePath, accessRect, rtWidth, rtHeight); } else { clipPath.addAccess(accessRect); } @@ -221,11 +223,12 @@ std::unique_ptr<GrFragmentProcessor> GrCoverageCountingPathRenderer::makeClipPro deviceSpacePath.getFillType()); } -void CCPR::ClipPath::init(const SkPath& deviceSpacePath, const SkIRect& accessRect, int rtWidth, - int rtHeight) { +void CCPR::ClipPath::init(GrProxyProvider* proxyProvider, + const SkPath& deviceSpacePath, const SkIRect& accessRect, + int rtWidth, int rtHeight) { SkASSERT(this->isUninitialized()); - fAtlasLazyProxy = GrSurfaceProxy::MakeFullyLazy( + fAtlasLazyProxy = proxyProvider->createFullyLazyProxy( [this](GrResourceProvider* resourceProvider, GrSurfaceOrigin* outOrigin) { if (!resourceProvider) { return sk_sp<GrTexture>(); @@ -252,7 +255,7 @@ void CCPR::ClipPath::init(const SkPath& deviceSpacePath, const SkIRect& accessRe *outOrigin = textureProxy->origin(); return sk_ref_sp(textureProxy->priv().peekTexture()); }, - GrSurfaceProxy::Renderable::kYes, kAlpha_half_GrPixelConfig); + GrProxyProvider::Renderable::kYes, kAlpha_half_GrPixelConfig); const SkRect& pathDevBounds = deviceSpacePath.getBounds(); if (SkTMax(pathDevBounds.height(), pathDevBounds.width()) > kPathCropThreshold) { diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h index e113338afe..4fb3cc7a6b 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.h +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.h @@ -135,8 +135,9 @@ public: } bool isUninitialized() const { return !fAtlasLazyProxy; } - void init(const SkPath& deviceSpacePath, const SkIRect& accessRect, int rtWidth, - int rtHeight); + void init(GrProxyProvider* proxyProvider, + const SkPath& deviceSpacePath, const SkIRect& accessRect, + int rtWidth, int rtHeight); void addAccess(const SkIRect& accessRect) { SkASSERT(!this->isUninitialized()); fAccessRect.join(accessRect); @@ -184,10 +185,10 @@ public: bool canMakeClipProcessor(const SkPath& deviceSpacePath) const; - std::unique_ptr<GrFragmentProcessor> makeClipProcessor(uint32_t oplistID, + std::unique_ptr<GrFragmentProcessor> makeClipProcessor(GrProxyProvider*, uint32_t oplistID, const SkPath& deviceSpacePath, - const SkIRect& accessRect, int rtWidth, - int rtHeight); + const SkIRect& accessRect, + int rtWidth, int rtHeight); // GrOnFlushCallbackObject overrides. void preFlush(GrOnFlushResourceProvider*, const uint32_t* opListIDs, int numOpListIDs, diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp index 36bd9dd5ff..9f770d6b50 100644 --- a/tests/GrCCPRTest.cpp +++ b/tests/GrCCPRTest.cpp @@ -33,9 +33,11 @@ public: CCPRClip(GrCoverageCountingPathRenderer* ccpr, const SkPath& path) : fCCPR(ccpr), fPath(path) {} private: - bool apply(GrContext*, GrRenderTargetContext* rtc, bool, bool, GrAppliedClip* out, + bool apply(GrContext* context, GrRenderTargetContext* rtc, bool, bool, GrAppliedClip* out, SkRect* bounds) const override { - out->addCoverageFP(fCCPR->makeClipProcessor(rtc->priv().testingOnly_getOpListID(), fPath, + GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); + out->addCoverageFP(fCCPR->makeClipProcessor(proxyProvider, + rtc->priv().testingOnly_getOpListID(), fPath, SkIRect::MakeWH(rtc->width(), rtc->height()), rtc->width(), rtc->height())); return true; diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index 1fe4fc4cb0..d43f07d959 100644 --- a/tests/LazyProxyTest.cpp +++ b/tests/LazyProxyTest.cpp @@ -11,6 +11,7 @@ #include "GrClip.h" #include "GrContextPriv.h" +#include "GrProxyProvider.h" #include "GrOnFlushResourceProvider.h" #include "GrRenderTargetContext.h" #include "GrRenderTargetContextPriv.h" @@ -54,9 +55,10 @@ public: public: DEFINE_OP_CLASS_ID - Op(LazyProxyTest* test, bool nullTexture) : GrDrawOp(ClassID()), fTest(test) { - fProxy = GrSurfaceProxy::MakeFullyLazy([this, nullTexture](GrResourceProvider* rp, - GrSurfaceOrigin* origin) { + Op(GrProxyProvider* proxyProvider, LazyProxyTest* test, bool nullTexture) + : GrDrawOp(ClassID()), fTest(test) { + fProxy = proxyProvider->createFullyLazyProxy([this, nullTexture]( + GrResourceProvider* rp, GrSurfaceOrigin* origin) { REPORTER_ASSERT(fTest->fReporter, !fTest->fHasOpTexture); fTest->fHasOpTexture = true; *origin = kTopLeft_GrSurfaceOrigin; @@ -72,7 +74,7 @@ public: REPORTER_ASSERT(fTest->fReporter, texture); return texture; } - }, GrSurfaceProxy::Renderable::kNo, kRGB_565_GrPixelConfig); + }, GrProxyProvider::Renderable::kNo, kRGB_565_GrPixelConfig); this->setBounds(SkRectPriv::MakeLargest(), GrOp::HasAABloat::kNo, GrOp::IsZeroArea::kNo); } @@ -102,18 +104,19 @@ public: class ClipFP : public GrFragmentProcessor { public: - ClipFP(LazyProxyTest* test, GrTextureProxy* atlas) + ClipFP(GrProxyProvider* proxyProvider, LazyProxyTest* test, GrTextureProxy* atlas) : GrFragmentProcessor(kTestFP_ClassID, kNone_OptimizationFlags) + , fProxyProvider(proxyProvider) , fTest(test) , fAtlas(atlas) { - fLazyProxy = GrSurfaceProxy::MakeFullyLazy([this](GrResourceProvider* rp, - GrSurfaceOrigin* origin) { + fLazyProxy = proxyProvider->createFullyLazyProxy([this](GrResourceProvider* rp, + GrSurfaceOrigin* origin) { REPORTER_ASSERT(fTest->fReporter, !fTest->fHasClipTexture); fTest->fHasClipTexture = true; *origin = kBottomLeft_GrSurfaceOrigin; fAtlas->instantiate(rp); return sk_ref_sp(fAtlas->priv().peekTexture()); - }, GrSurfaceProxy::Renderable::kYes, kAlpha_half_GrPixelConfig); + }, GrProxyProvider::Renderable::kYes, kAlpha_half_GrPixelConfig); fAccess.reset(fLazyProxy, GrSamplerState::Filter::kNearest, GrSamplerState::WrapMode::kClamp, kFragment_GrShaderFlag); this->addTextureSampler(&fAccess); @@ -122,12 +125,13 @@ public: private: const char* name() const override { return "LazyProxyTest::ClipFP"; } std::unique_ptr<GrFragmentProcessor> clone() const override { - return skstd::make_unique<ClipFP>(fTest, fAtlas); + return skstd::make_unique<ClipFP>(fProxyProvider, fTest, fAtlas); } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return nullptr; } void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor&) const override { return false; } + GrProxyProvider* const fProxyProvider; LazyProxyTest* const fTest; GrTextureProxy* const fAtlas; sk_sp<GrTextureProxy> fLazyProxy; @@ -142,9 +146,10 @@ public: , fAtlas(atlas) {} private: - bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out, + bool apply(GrContext* context, GrRenderTargetContext*, bool, bool, GrAppliedClip* out, SkRect* bounds) const override { - out->addCoverageFP(skstd::make_unique<ClipFP>(fTest, fAtlas)); + GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); + out->addCoverageFP(skstd::make_unique<ClipFP>(proxyProvider, fTest, fAtlas)); return true; } bool quickContains(const SkRect&) const final { return false; } @@ -171,6 +176,7 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) { mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderable[0] = true; mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fTexturable = true; sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions()); + GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider(); for (bool nullTexture : {false, true}) { LazyProxyTest test(reporter); ctx->contextPriv().addOnFlushCallbackObject(&test); @@ -183,7 +189,7 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) { kAlpha_half_GrPixelConfig, nullptr); REPORTER_ASSERT(reporter, mockAtlas); rtc->priv().testingOnly_addDrawOp(LazyProxyTest::Clip(&test, mockAtlas->asTextureProxy()), - skstd::make_unique<LazyProxyTest::Op>(&test, nullTexture)); + skstd::make_unique<LazyProxyTest::Op>(proxyProvider, &test, nullTexture)); ctx->contextPriv().testingOnly_flushAndRemoveOnFlushCallbackObject(&test); } } @@ -191,6 +197,7 @@ DEF_GPUTEST(LazyProxyTest, reporter, /* options */) { DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) { GrMockOptions mockOptions; sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions()); + auto proxyProvider = ctx->contextPriv().proxyProvider(); GrSurfaceDesc desc; desc.fWidth = 16; @@ -200,7 +207,7 @@ DEF_GPUTEST(LazyProxyReleaseTest, reporter, /* options */) { for (bool doInstantiate : {true, false}) { int testCount = 0; int* testCountPtr = &testCount; - sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeLazy( + sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy( [testCountPtr](GrResourceProvider* resourceProvider, GrSurfaceOrigin* outOrigin) { if (!resourceProvider) { *testCountPtr = -1; |