diff options
author | Robert Phillips <robertphillips@google.com> | 2017-11-13 13:38:05 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-13 13:38:11 +0000 |
commit | 2d9cb57c83553be3434c04f860d5e9fec30cb453 (patch) | |
tree | 321f28bef2ac1bcb66786735ffa095c37fd81805 | |
parent | 8d5ce2d9ede0c241b906f1a0df9dac3cf3c3aa55 (diff) |
Revert "Patch up ref counting of proxies"
This reverts commit 8d5ce2d9ede0c241b906f1a0df9dac3cf3c3aa55.
Reason for revert: ASAN failures
Original change's description:
> Patch up ref counting of proxies
>
> Bug: skia:
> Change-Id: If746283d788368bf7aad6d285f181d8531768e61
> Reviewed-on: https://skia-review.googlesource.com/70024
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: Ia2addb2a5dacad9e9c0080d1e53084bc62b780e0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/70540
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r-- | include/private/GrSurfaceProxy.h | 2 | ||||
-rw-r--r-- | src/gpu/GrOnFlushResourceProvider.cpp | 16 | ||||
-rw-r--r-- | tests/GrMipMappedTest.cpp | 6 | ||||
-rw-r--r-- | tests/OnFlushCallbackTest.cpp | 12 |
4 files changed, 12 insertions, 24 deletions
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h index f99e199dee..23f62195c2 100644 --- a/include/private/GrSurfaceProxy.h +++ b/include/private/GrSurfaceProxy.h @@ -131,7 +131,7 @@ protected: SkASSERT(fTarget); SkASSERT(fTarget->fRefCnt > 0); - fTarget->fRefCnt += SkTMax(0, fRefCnt-1); // don't xfer the proxy's creation ref + fTarget->fRefCnt += (fRefCnt-1); // don't xfer the proxy's creation ref fTarget->fPendingReads += fPendingReads; fTarget->fPendingWrites += fPendingWrites; } diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp index c9fc77ed48..42237a7eda 100644 --- a/src/gpu/GrOnFlushResourceProvider.cpp +++ b/src/gpu/GrOnFlushResourceProvider.cpp @@ -39,14 +39,6 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext( return nullptr; } - // Since this is at flush time and these won't be allocated for us by the GrResourceAllocator - // we have to manually ensure it is allocated here. The proxy had best have been created - // with the kNoPendingIO flag! - if (!renderTargetContext->asSurfaceProxy()->instantiate( - fDrawingMgr->getContext()->resourceProvider())) { - return nullptr; - } - renderTargetContext->discard(); return renderTargetContext; @@ -67,14 +59,6 @@ sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext( return nullptr; } - // Since this is at flush time and these won't be allocated for us by the GrResourceAllocator - // we have to manually ensure it is allocated here. The proxy had best have been created - // with the kNoPendingIO flag! - if (!renderTargetContext->asSurfaceProxy()->instantiate( - fDrawingMgr->getContext()->resourceProvider())) { - return nullptr; - } - renderTargetContext->discard(); return renderTargetContext; diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp index c2a0df2e5d..f023018902 100644 --- a/tests/GrMipMappedTest.cpp +++ b/tests/GrMipMappedTest.cpp @@ -53,7 +53,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { mipMapped, backendHandle); - sk_sp<GrTextureProxy> proxy; + GrTextureProxy* proxy; sk_sp<SkImage> image; if (isRT) { sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture( @@ -65,12 +65,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { nullptr); SkGpuDevice* device = ((SkSurface_Gpu*)surface.get())->getDevice(); - proxy = device->accessRenderTargetContext()->asTextureProxyRef(); + proxy = device->accessRenderTargetContext()->asTextureProxy(); } else { image = SkImage::MakeFromTexture(context, backendTex, kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, nullptr); - proxy = as_IB(image)->asTextureProxyRef(); + proxy = as_IB(image)->peekProxy(); } REPORTER_ASSERT(reporter, proxy); if (!proxy) { diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp index c7af59ac9f..0c2edfba43 100644 --- a/tests/OnFlushCallbackTest.cpp +++ b/tests/OnFlushCallbackTest.cpp @@ -415,6 +415,8 @@ static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject for (int i = 0; i < 3; ++i) { SkRect r = SkRect::MakeXYWH(i*kDrawnTileSize, 0, kDrawnTileSize, kDrawnTileSize); + // TODO: here is the blocker for deferring creation of the atlas. The TextureSamplers + // created here currently require a hard GrTexture. auto fp = GrSimpleTextureEffect::Make(fakeAtlas, SkMatrix::I()); GrPaint paint; paint.addColorFragmentProcessor(std::move(fp)); @@ -479,10 +481,12 @@ sk_sp<GrTextureProxy> pre_create_atlas(GrContext* context) { desc.fWidth = 32; desc.fHeight = 16; desc.fConfig = kSkia8888_GrPixelConfig; - return GrSurfaceProxy::MakeDeferred(context->resourceProvider(), - desc, SkBackingFit::kExact, - SkBudgeted::kYes, - GrResourceProvider::kNoPendingIO_Flag); + sk_sp<GrSurfaceProxy> atlasDest = GrSurfaceProxy::MakeDeferred( + context->resourceProvider(), + desc, SkBackingFit::kExact, + SkBudgeted::kYes, + GrResourceProvider::kNoPendingIO_Flag); + return sk_ref_sp(atlasDest->asTextureProxy()); } #endif |