diff options
-rw-r--r-- | gm/texdata.cpp | 2 | ||||
-rw-r--r-- | include/private/SkDeferredDisplayList.h | 2 | ||||
-rw-r--r-- | src/core/SkDeferredDisplayListRecorder.cpp | 2 | ||||
-rw-r--r-- | src/core/SkSpecialImage.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrContext.cpp | 18 | ||||
-rw-r--r-- | src/gpu/GrContextPriv.h | 4 | ||||
-rw-r--r-- | src/gpu/GrProxyProvider.cpp | 6 | ||||
-rw-r--r-- | src/gpu/GrResourceProvider.cpp | 4 | ||||
-rw-r--r-- | src/gpu/SkGr.cpp | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.cpp | 3 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasGlyphCache.cpp | 3 | ||||
-rw-r--r-- | src/image/SkSurface_Base.h | 2 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 23 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.h | 5 | ||||
-rw-r--r-- | tests/CopySurfaceTest.cpp | 3 | ||||
-rw-r--r-- | tests/FloatingPointTextureTest.cpp | 2 | ||||
-rw-r--r-- | tests/GrMipMappedTest.cpp | 2 | ||||
-rw-r--r-- | tests/GrSurfaceTest.cpp | 2 | ||||
-rw-r--r-- | tests/IntTextureTest.cpp | 2 | ||||
-rw-r--r-- | tests/PackedConfigsTextureTest.cpp | 2 | ||||
-rw-r--r-- | tests/ReadPixelsTest.cpp | 2 | ||||
-rw-r--r-- | tests/ReadWriteAlphaTest.cpp | 4 | ||||
-rw-r--r-- | tests/RectangleTextureTest.cpp | 2 | ||||
-rw-r--r-- | tests/VkUploadPixelsTests.cpp | 6 |
24 files changed, 68 insertions, 37 deletions
diff --git a/gm/texdata.cpp b/gm/texdata.cpp index b4193a3423..1f7d107a30 100644 --- a/gm/texdata.cpp +++ b/gm/texdata.cpp @@ -100,7 +100,7 @@ DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) { } sk_sp<GrSurfaceContext> tContext = context->contextPriv().makeWrappedSurfaceContext( - std::move(proxy), nullptr); + std::move(proxy)); if (!tContext) { return; diff --git a/include/private/SkDeferredDisplayList.h b/include/private/SkDeferredDisplayList.h index b53390d174..392a952a1d 100644 --- a/include/private/SkDeferredDisplayList.h +++ b/include/private/SkDeferredDisplayList.h @@ -32,7 +32,7 @@ public: } // TODO: remove this. It is just scaffolding to get something up & running - bool draw(SkSurface*); + bool draw(SkSurface*) const; private: const SkSurfaceCharacterization fCharacterization; diff --git a/src/core/SkDeferredDisplayListRecorder.cpp b/src/core/SkDeferredDisplayListRecorder.cpp index ee168c9aaa..3f703733bc 100644 --- a/src/core/SkDeferredDisplayListRecorder.cpp +++ b/src/core/SkDeferredDisplayListRecorder.cpp @@ -79,7 +79,7 @@ std::unique_ptr<SkDeferredDisplayList> SkDeferredDisplayListRecorder::detach() { // Placeholder. Ultimately, the SkSurface_Gpu will pass the wrapped opLists to its // renderTargetContext. -bool SkDeferredDisplayList::draw(SkSurface* surface) { +bool SkDeferredDisplayList::draw(SkSurface* surface) const { surface->getCanvas()->drawImage(fImage.get(), 0, 0); return true; } diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp index 771950aa73..56ec66a191 100644 --- a/src/core/SkSpecialImage.cpp +++ b/src/core/SkSpecialImage.cpp @@ -411,7 +411,7 @@ public: } sk_sp<GrSurfaceContext> sContext = fContext->contextPriv().makeWrappedSurfaceContext( - fTextureProxy, nullptr); + fTextureProxy); if (!sContext) { return false; } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 66cc8b8f6e..0d7705dea3 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -25,7 +25,9 @@ #include "GrTexture.h" #include "GrTextureContext.h" #include "GrTracing.h" + #include "SkConvertPixels.h" +#include "SkDeferredDisplayList.h" #include "SkGr.h" #include "SkJSONWriter.h" #include "SkMakeUnique.h" @@ -263,6 +265,13 @@ bool GrContext::init(const GrContextOptions& options) { prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall; } + if (!fResourceCache) { + // DDL TODO: remove this crippling of the path renderer chain + // Disable the small path renderer bc of the proxies in the atlas. They need to be + // unified when the opLists are added back to the destination drawing manager. + prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall; + } + GrAtlasTextContext::Options atlasTextContextOptions; atlasTextContextOptions.fMaxDistanceFieldFontSize = options.fGlyphsAsPathsFontSize; atlasTextContextOptions.fMinDistanceFieldFontSize = options.fMinDistanceFieldFontSize; @@ -800,14 +809,16 @@ void GrContextPriv::flushSurfaceIO(GrSurfaceProxy* proxy) { //////////////////////////////////////////////////////////////////////////////// sk_sp<GrSurfaceContext> GrContextPriv::makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy> proxy, - sk_sp<SkColorSpace> colorSpace) { + sk_sp<SkColorSpace> colorSpace, + const SkSurfaceProps* props) { ASSERT_SINGLE_OWNER_PRIV if (proxy->asRenderTargetProxy()) { return this->drawingManager()->makeRenderTargetContext(std::move(proxy), - std::move(colorSpace), nullptr); + std::move(colorSpace), props); } else { SkASSERT(proxy->asTextureProxy()); + SkASSERT(!props); return this->drawingManager()->makeTextureContext(std::move(proxy), std::move(colorSpace)); } } @@ -828,7 +839,7 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrSurfac return nullptr; } - return this->makeWrappedSurfaceContext(std::move(proxy), nullptr); + return this->makeWrappedSurfaceContext(std::move(proxy)); } sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackendTexture& tex, @@ -903,7 +914,6 @@ void GrContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBO fContext->fDrawingManager->addOnFlushCallbackObject(onFlushCBObject); } - static inline GrPixelConfig GrPixelConfigFallback(GrPixelConfig config) { switch (config) { case kAlpha_8_GrPixelConfig: diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h index 2ce3947658..cf74e70fd6 100644 --- a/src/gpu/GrContextPriv.h +++ b/src/gpu/GrContextPriv.h @@ -29,7 +29,9 @@ public: GrDrawingManager* drawingManager() { return fContext->fDrawingManager.get(); } - sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>, sk_sp<SkColorSpace>); + sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>, + sk_sp<SkColorSpace> = nullptr, + const SkSurfaceProps* = nullptr); sk_sp<GrSurfaceContext> makeDeferredSurfaceContext(const GrSurfaceDesc&, GrMipMapped, diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 5bb58af36f..604dd1bb32 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -54,7 +54,7 @@ bool GrProxyProvider::assignUniqueKeyToProxy(const GrUniqueKey& key, GrTexturePr // If there is already a GrResource with this key then the caller has violated the normal // usage pattern of uniquely keyed resources (e.g., they have created one w/o first seeing // if it already existed in the cache). - SkASSERT(!fResourceCache->findAndRefUniqueResource(key)); + SkASSERT(!fResourceCache || !fResourceCache->findAndRefUniqueResource(key)); // Uncached resources can never have a unique key, unless they're wrapped resources. Wrapped // resources are a special case: the unique keys give us a weak ref so that we can reuse the @@ -133,6 +133,10 @@ sk_sp<GrTextureProxy> GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniq return result; } + if (!fResourceCache) { + return nullptr; + } + GrGpuResource* resource = fResourceCache->findAndRefUniqueResource(key); if (!resource) { return nullptr; diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index 33773a8060..9cf4e6c3e7 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -140,8 +140,8 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBackingFit::kExact, budgeted); if (proxy) { - sk_sp<GrSurfaceContext> sContext = - context->contextPriv().makeWrappedSurfaceContext(std::move(proxy), nullptr); + sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( + std::move(proxy)); if (sContext) { if (sContext->writePixels(srcInfo, mipLevel.fPixels, mipLevel.fRowBytes, 0, 0)) { return sk_ref_sp(sContext->asTextureProxy()->priv().peekTexture()); diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 2c262d8417..976339b96f 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -177,7 +177,7 @@ sk_sp<GrTextureProxy> GrCopyBaseMipMapToTextureProxy(GrContext* ctx, GrTexturePr } // Copy the base layer to our proxy - sk_sp<GrSurfaceContext> sContext = ctx->contextPriv().makeWrappedSurfaceContext(proxy, nullptr); + sk_sp<GrSurfaceContext> sContext = ctx->contextPriv().makeWrappedSurfaceContext(proxy); SkASSERT(sContext); SkAssertResult(sContext->copy(baseProxy)); diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp index ab02b6d6bb..f5697c9442 100644 --- a/src/gpu/effects/GrTextureStripAtlas.cpp +++ b/src/gpu/effects/GrTextureStripAtlas.cpp @@ -231,8 +231,7 @@ void GrTextureStripAtlas::lockTexture() { fKeyTable.rewind(); } SkASSERT(proxy); - fTexContext = fDesc.fContext->contextPriv().makeWrappedSurfaceContext(std::move(proxy), - nullptr); + fTexContext = fDesc.fContext->contextPriv().makeWrappedSurfaceContext(std::move(proxy)); } void GrTextureStripAtlas::unlockTexture() { diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp index edc751ec95..c36ad8798d 100644 --- a/src/gpu/text/GrAtlasGlyphCache.cpp +++ b/src/gpu/text/GrAtlasGlyphCache.cpp @@ -144,8 +144,7 @@ static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, const char* } sk_sp<GrSurfaceContext> sContext(context->contextPriv().makeWrappedSurfaceContext( - sk_ref_sp(sProxy), - nullptr)); + sk_ref_sp(sProxy))); if (!sContext || !sContext->asTextureProxy()) { return false; } diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h index b71d4c7043..cce3dc0a88 100644 --- a/src/image/SkSurface_Base.h +++ b/src/image/SkSurface_Base.h @@ -95,7 +95,7 @@ public: } virtual bool onCharacterize(SkSurfaceCharacterization*) const { return false; } - virtual bool onDraw(SkDeferredDisplayList*) { return false; } + virtual bool onDraw(const SkDeferredDisplayList*) { return false; } inline SkCanvas* getCachedCanvas(); inline sk_sp<SkImage> refCachedImage(); diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 3746d097c8..ab2a64f707 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -195,14 +195,14 @@ bool SkSurface_Gpu::isCompatible(const SkSurfaceCharacterization& data) const { data.surfaceProps() == rtc->surfaceProps(); } -bool SkSurface_Gpu::onDraw(SkDeferredDisplayList* dl) { - if (!this->isCompatible(dl->characterization())) { +bool SkSurface_Gpu::onDraw(const SkDeferredDisplayList* ddl) { + if (!this->isCompatible(ddl->characterization())) { return false; } // Ultimately need to pass opLists from the DeferredDisplayList on to the // SkGpuDevice's renderTargetContext. - return dl->draw(this); + return ddl->draw(this); } @@ -264,6 +264,23 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext* ctx, SkBudgeted budgeted return sk_make_sp<SkSurface_Gpu>(std::move(device)); } +sk_sp<SkSurface> SkSurface_Gpu::MakeWrappedRenderTarget(GrContext* context, + sk_sp<GrRenderTargetContext> rtc) { + if (!context) { + return nullptr; + } + + sk_sp<SkGpuDevice> device(SkGpuDevice::Make(context, std::move(rtc), + rtc->width(), rtc->height(), + SkGpuDevice::kUninit_InitContents)); + if (!device) { + return nullptr; + } + + return sk_make_sp<SkSurface_Gpu>(std::move(device)); +} + + sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context, const GrBackendTexture& tex, GrSurfaceOrigin origin, int sampleCnt, sk_sp<SkColorSpace> colorSpace, diff --git a/src/image/SkSurface_Gpu.h b/src/image/SkSurface_Gpu.h index cb21771aa9..134eef23da 100644 --- a/src/image/SkSurface_Gpu.h +++ b/src/image/SkSurface_Gpu.h @@ -19,6 +19,9 @@ public: SkSurface_Gpu(sk_sp<SkGpuDevice>); ~SkSurface_Gpu() override; + // This is an internal-only factory + static sk_sp<SkSurface> MakeWrappedRenderTarget(GrContext*, sk_sp<GrRenderTargetContext>); + GrBackendObject onGetTextureHandle(BackendHandleAccess) override; bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) override; SkCanvas* onNewCanvas() override; @@ -31,7 +34,7 @@ public: bool onWait(int numSemaphores, const GrBackendSemaphore* waitSemaphores) override; bool onCharacterize(SkSurfaceCharacterization*) const override; bool isCompatible(const SkSurfaceCharacterization&) const; - bool onDraw(SkDeferredDisplayList*) override; + bool onDraw(const SkDeferredDisplayList*) override; SkGpuDevice* getDevice() { return fDevice.get(); } diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp index 1c31bbf485..b8ccb1f26b 100644 --- a/tests/CopySurfaceTest.cpp +++ b/tests/CopySurfaceTest.cpp @@ -86,8 +86,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) { } sk_sp<GrSurfaceContext> dstContext = - context->contextPriv().makeWrappedSurfaceContext(std::move(dst), - nullptr); + context->contextPriv().makeWrappedSurfaceContext(std::move(dst)); bool result = dstContext->copy(src.get(), srcRect, dstPoint); diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp index fe347d2ce6..fe0975d514 100644 --- a/tests/FloatingPointTextureTest.cpp +++ b/tests/FloatingPointTextureTest.cpp @@ -61,7 +61,7 @@ void runFPTest(skiatest::Reporter* reporter, GrContext* context, } sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( - std::move(fpProxy), nullptr); + std::move(fpProxy)); REPORTER_ASSERT(reporter, sContext); bool result = context->contextPriv().readSurfacePixels(sContext.get(), diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp index b4ce1b2422..0436bd4213 100644 --- a/tests/GrMipMappedTest.cpp +++ b/tests/GrMipMappedTest.cpp @@ -204,7 +204,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, // queued up copy) before we delete the backend texture. Thus we use readPixels here // just to force the synchronization. sk_sp<GrSurfaceContext> surfContext = - context->contextPriv().makeWrappedSurfaceContext(genProxy, nullptr); + context->contextPriv().makeWrappedSurfaceContext(genProxy); SkBitmap bitmap; bitmap.allocPixels(imageInfo); diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index d1385b826c..3e246ccd93 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -196,7 +196,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info) } auto texCtx = context->contextPriv().makeWrappedSurfaceContext( - std::move(proxy), nullptr); + std::move(proxy)); SkImageInfo info = SkImageInfo::Make( kSize, kSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType); memset(data.get(), 0xAB, kSize * kSize * sizeof(uint32_t)); diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp index 0bbb0718dc..1d133d67a0 100644 --- a/tests/IntTextureTest.cpp +++ b/tests/IntTextureTest.cpp @@ -86,7 +86,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) { return; } - sContext = context->contextPriv().makeWrappedSurfaceContext(std::move(proxy), nullptr); + sContext = context->contextPriv().makeWrappedSurfaceContext(std::move(proxy)); if (!sContext) { return; } diff --git a/tests/PackedConfigsTextureTest.cpp b/tests/PackedConfigsTextureTest.cpp index 56950ec8a5..0555fc4376 100644 --- a/tests/PackedConfigsTextureTest.cpp +++ b/tests/PackedConfigsTextureTest.cpp @@ -125,7 +125,7 @@ static void run_test(skiatest::Reporter* reporter, GrContext* context, SkASSERT(proxy); sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( - std::move(proxy), nullptr); + std::move(proxy)); SkAssertResult(sContext->readPixels(dstInfo, readBuffer.begin(), 0, 0, 0)); diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index cae5e2e803..2198e673d5 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -468,7 +468,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Texture, reporter, ctxInfo) { bmp.rowBytes()); sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( - std::move(proxy), nullptr); + std::move(proxy)); test_readpixels_texture(reporter, std::move(sContext)); } diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index 57739ccda6..e6c8c89e7d 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -68,7 +68,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { return; } sk_sp<GrSurfaceContext> sContext(context->contextPriv().makeWrappedSurfaceContext( - std::move(proxy), nullptr)); + std::move(proxy))); const SkImageInfo ii = SkImageInfo::MakeA8(X_SIZE, Y_SIZE); sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii)); @@ -179,7 +179,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { } sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( - std::move(proxy), nullptr); + std::move(proxy)); for (auto rowBytes : kRowBytes) { size_t nonZeroRowBytes = rowBytes ? rowBytes : X_SIZE; diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index 16dc940e01..8994f56127 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -143,7 +143,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) { false, "RectangleTexture-copy-from"); sk_sp<GrSurfaceContext> rectContext = context->contextPriv().makeWrappedSurfaceContext( - std::move(rectProxy), nullptr); + std::move(rectProxy)); SkASSERT(rectContext); test_read_pixels(reporter, rectContext.get(), refPixels, "RectangleTexture-read"); diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index 6f79df7a87..3b3fecae7f 100644 --- a/tests/VkUploadPixelsTests.cpp +++ b/tests/VkUploadPixelsTests.cpp @@ -78,8 +78,7 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe srcBuffer, 0); REPORTER_ASSERT(reporter, proxy); if (proxy) { - sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( - proxy, nullptr); + sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(proxy); SkImageInfo dstInfo = SkImageInfo::Make(kWidth, kHeight, ct, kOpaque_SkAlphaType); @@ -110,8 +109,7 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe proxy = proxyProvider->createTextureProxy(surfDesc, SkBudgeted::kNo, srcBuffer, 0); REPORTER_ASSERT(reporter, proxy); if (proxy) { - sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( - proxy, nullptr); + sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext(proxy); SkImageInfo dstInfo = SkImageInfo::Make(kWidth, kHeight, ct, kOpaque_SkAlphaType); |