From 96b383a78c842be9441a336508031fe23ae787b3 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Tue, 13 Aug 2019 16:55:41 -0400 Subject: [PATCH] Remove GrRenderable param from GrProxyProvider::createTextureProxy() Every caller passes kNo. Change-Id: I9c21c77f57f6215246794b39fc8ec485d4ae23d0 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234331 Reviewed-by: Greg Daniel Commit-Queue: Brian Salomon --- gm/yuvtorgbeffect.cpp | 12 +++++----- src/gpu/GrBlurUtils.cpp | 4 ++-- src/gpu/GrProxyProvider.cpp | 24 +++++++------------ src/gpu/GrProxyProvider.h | 2 +- src/gpu/GrSWMaskHelper.cpp | 4 ++-- src/gpu/GrYUVProvider.cpp | 4 ++-- src/gpu/SkGr.cpp | 3 +-- .../effects/GrCircleBlurFragmentProcessor.fp | 2 +- src/gpu/effects/GrConfigConversionEffect.fp | 1 - src/gpu/effects/GrRectBlurEffect.fp | 2 +- .../GrCircleBlurFragmentProcessor.cpp | 4 ++-- .../generated/GrConfigConversionEffect.h | 2 +- src/gpu/effects/generated/GrRectBlurEffect.h | 4 ++-- tests/GrSurfaceTest.cpp | 6 ++--- tests/ImageFilterCacheTest.cpp | 3 +-- tests/ProcessorTest.cpp | 11 ++++----- tests/ReadWriteAlphaTest.cpp | 2 +- tests/SpecialImageTest.cpp | 6 ++--- 18 files changed, 42 insertions(+), 54 deletions(-) diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index dc67244a12..771246dbe7 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -100,8 +100,8 @@ protected: sk_sp proxies[3]; for (int i = 0; i < 3; ++i) { - proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + proxies[i] = proxyProvider->createTextureProxy(fImage[i], 1, SkBudgeted::kYes, + SkBackingFit::kExact); if (!proxies[i]) { *errorMsg = "Failed to create proxy"; return DrawResult::kFail; @@ -219,8 +219,8 @@ protected: sk_sp proxies[2]; for (int i = 0; i < 2; ++i) { - proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + proxies[i] = proxyProvider->createTextureProxy(fImage[i], 1, SkBudgeted::kYes, + SkBackingFit::kExact); if (!proxies[i]) { *errorMsg = "Failed to create proxy"; return DrawResult::kFail; @@ -316,8 +316,8 @@ protected: sk_sp proxies[3]; for (int i = 0; i < 3; ++i) { - proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + proxies[i] = proxyProvider->createTextureProxy(fImage[i], 1, SkBudgeted::kYes, + SkBackingFit::kExact); if (!proxies[i]) { *errorMsg = "Failed to create proxy"; return DrawResult::kFail; diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index 6a08f6f9d8..d6353ab898 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -149,8 +149,8 @@ static bool sw_draw_with_mask_filter(GrRecordingContext* context, return false; } - filteredMask = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1, - SkBudgeted::kYes, SkBackingFit::kApprox); + filteredMask = proxyProvider->createTextureProxy(std::move(image), 1, SkBudgeted::kYes, + SkBackingFit::kApprox); if (!filteredMask) { return false; } diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index bfa6a63443..95a5042686 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -246,7 +246,6 @@ sk_sp GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniq } sk_sp GrProxyProvider::createTextureProxy(sk_sp srcImage, - GrRenderable renderable, int sampleCnt, SkBudgeted budgeted, SkBackingFit fit, @@ -261,7 +260,7 @@ sk_sp GrProxyProvider::createTextureProxy(sk_sp srcImag const SkImageInfo& info = srcImage->imageInfo(); GrColorType ct = SkColorTypeToGrColorType(info.colorType()); - GrBackendFormat format = this->caps()->getDefaultBackendFormat(ct, renderable); + GrBackendFormat format = this->caps()->getDefaultBackendFormat(ct, GrRenderable::kNo); if (!format.isValid()) { SkBitmap copy8888; @@ -272,19 +271,12 @@ sk_sp GrProxyProvider::createTextureProxy(sk_sp srcImag copy8888.setImmutable(); srcImage = SkMakeImageFromRasterBitmap(copy8888, kNever_SkCopyPixelsMode); ct = GrColorType::kRGBA_8888; - format = this->caps()->getDefaultBackendFormat(ct, renderable); + format = this->caps()->getDefaultBackendFormat(ct, GrRenderable::kNo); if (!format.isValid()) { return nullptr; } } - if (renderable == GrRenderable::kYes) { - sampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, format); - if (!sampleCnt) { - return nullptr; - } - } - GrPixelConfig config = GrColorTypeToPixelConfig(ct); if (kUnknown_GrPixelConfig == config) { return nullptr; @@ -296,17 +288,17 @@ sk_sp GrProxyProvider::createTextureProxy(sk_sp srcImag desc.fConfig = config; sk_sp proxy = this->createLazyProxy( - [desc, format, renderable, sampleCnt, budgeted, srcImage, fit, + [desc, format, sampleCnt, budgeted, srcImage, fit, ct](GrResourceProvider* resourceProvider) { SkPixmap pixMap; SkAssertResult(srcImage->peekPixels(&pixMap)); GrMipLevel mipLevel = { pixMap.addr(), pixMap.rowBytes() }; return LazyInstantiationResult(resourceProvider->createTexture( - desc, format, renderable, sampleCnt, budgeted, fit, GrProtected::kNo, ct, - mipLevel, GrResourceProvider::Flags::kNoPendingIO)); + desc, format, GrRenderable::kNo, sampleCnt, budgeted, fit, GrProtected::kNo, + ct, mipLevel, GrResourceProvider::Flags::kNoPendingIO)); }, - format, desc, renderable, sampleCnt, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, + format, desc, GrRenderable::kNo, sampleCnt, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo, GrMipMapsStatus::kNotAllocated, surfaceFlags, fit, budgeted, GrProtected::kNo); if (!proxy) { @@ -377,8 +369,8 @@ sk_sp GrProxyProvider::createProxyFromBitmap(const SkBitmap& bit // If mips weren't requested (or this was too small to have any), then take the fast path if (GrMipMapped::kNo == mipMapped || 0 == SkMipMap::ComputeLevelCount(baseLevel->width(), baseLevel->height())) { - return this->createTextureProxy(std::move(baseLevel), GrRenderable::kNo, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + return this->createTextureProxy(std::move(baseLevel), 1, SkBudgeted::kYes, + SkBackingFit::kExact); } GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info()); diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h index 58c884e3a7..7c2fa254cd 100644 --- a/src/gpu/GrProxyProvider.h +++ b/src/gpu/GrProxyProvider.h @@ -65,7 +65,7 @@ public: * actually upload the data to the gpu. */ sk_sp createTextureProxy( - sk_sp srcImage, GrRenderable, int sampleCnt, SkBudgeted, SkBackingFit, + sk_sp srcImage, int sampleCnt, SkBudgeted, SkBackingFit, GrInternalSurfaceFlags = GrInternalSurfaceFlags::kNone); /* diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index 505a215389..879a028511 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -107,6 +107,6 @@ sk_sp GrSWMaskHelper::toTextureProxy(GrRecordingContext* context return nullptr; } - return context->priv().proxyProvider()->createTextureProxy(std::move(img), GrRenderable::kNo, 1, - SkBudgeted::kYes, fit); + return context->priv().proxyProvider()->createTextureProxy(std::move(img), 1, SkBudgeted::kYes, + fit); } diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp index 93eb6ab5b7..baabcf06ca 100644 --- a/src/gpu/GrYUVProvider.cpp +++ b/src/gpu/GrYUVProvider.cpp @@ -150,8 +150,8 @@ sk_sp GrYUVProvider::refAsTextureProxy(GrRecordingContext* ctx, dataStoragePtr); auto proxyProvider = ctx->priv().proxyProvider(); - yuvTextureProxies[i] = proxyProvider->createTextureProxy(yuvImage, GrRenderable::kNo, 1, - SkBudgeted::kYes, fit); + yuvTextureProxies[i] = + proxyProvider->createTextureProxy(yuvImage, 1, SkBudgeted::kYes, fit); SkASSERT(yuvTextureProxies[i]->width() == yuvSizeInfo.fSizes[i].fWidth); SkASSERT(yuvTextureProxies[i]->height() == yuvSizeInfo.fSizes[i].fHeight); diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index d979f190ca..fd63056420 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -194,8 +194,7 @@ sk_sp GrMakeCachedImageProxy(GrProxyProvider* proxyProvider, kTopLeft_GrSurfaceOrigin); } if (!proxy) { - proxy = proxyProvider->createTextureProxy(srcImage, GrRenderable::kNo, 1, SkBudgeted::kYes, - fit); + proxy = proxyProvider->createTextureProxy(srcImage, 1, SkBudgeted::kYes, fit); if (proxy && originalKey.isValid()) { proxyProvider->assignUniqueKeyToProxy(originalKey, proxy.get()); const SkBitmap* bm = as_IB(srcImage.get())->onPeekBitmap(); diff --git a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp index 9fe92951c1..4228a0333f 100644 --- a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp +++ b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp @@ -248,7 +248,7 @@ uniform half4 circleData; bm.setImmutable(); sk_sp image = SkImage::MakeFromBitmap(bm); - blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1, + blurProfile = proxyProvider->createTextureProxy(std::move(image), 1, SkBudgeted::kYes, SkBackingFit::kExact); if (!blurProfile) { return nullptr; diff --git a/src/gpu/effects/GrConfigConversionEffect.fp b/src/gpu/effects/GrConfigConversionEffect.fp index a4320b224e..ba58cc2848 100644 --- a/src/gpu/effects/GrConfigConversionEffect.fp +++ b/src/gpu/effects/GrConfigConversionEffect.fp @@ -65,7 +65,6 @@ sk_sp image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr); sk_sp dataProxy = proxyProvider->createTextureProxy(std::move(image), - GrRenderable::kNo, 1, SkBudgeted::kYes, SkBackingFit::kExact); diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp index 12e36141d6..f625af22b6 100644 --- a/src/gpu/effects/GrRectBlurEffect.fp +++ b/src/gpu/effects/GrRectBlurEffect.fp @@ -69,7 +69,7 @@ uniform half profileSize; return nullptr; } - blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, + blurProfile = proxyProvider->createTextureProxy(std::move(image), 1, SkBudgeted::kYes, SkBackingFit::kExact); if (!blurProfile) { diff --git a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp index 9445a5a67f..ccef347e1b 100644 --- a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp +++ b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp @@ -225,8 +225,8 @@ static sk_sp create_profile_texture(GrProxyProvider* proxyProvid bm.setImmutable(); sk_sp image = SkImage::MakeFromBitmap(bm); - blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + blurProfile = proxyProvider->createTextureProxy(std::move(image), 1, SkBudgeted::kYes, + SkBackingFit::kExact); if (!blurProfile) { return nullptr; } diff --git a/src/gpu/effects/generated/GrConfigConversionEffect.h b/src/gpu/effects/generated/GrConfigConversionEffect.h index 8cbabb6116..ee45889a64 100644 --- a/src/gpu/effects/generated/GrConfigConversionEffect.h +++ b/src/gpu/effects/generated/GrConfigConversionEffect.h @@ -69,7 +69,7 @@ public: sk_sp image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr); sk_sp dataProxy = proxyProvider->createTextureProxy( - std::move(image), GrRenderable::kNo, 1, SkBudgeted::kYes, SkBackingFit::kExact); + std::move(image), 1, SkBudgeted::kYes, SkBackingFit::kExact); if (!dataProxy) { return false; } diff --git a/src/gpu/effects/generated/GrRectBlurEffect.h b/src/gpu/effects/generated/GrRectBlurEffect.h index 361aa26f98..7083222cde 100644 --- a/src/gpu/effects/generated/GrRectBlurEffect.h +++ b/src/gpu/effects/generated/GrRectBlurEffect.h @@ -49,8 +49,8 @@ public: return nullptr; } - blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + blurProfile = proxyProvider->createTextureProxy(std::move(image), 1, SkBudgeted::kYes, + SkBackingFit::kExact); if (!blurProfile) { return nullptr; } diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 273a4503e3..ae2367c984 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -411,9 +411,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadOnlyTexture, reporter, context_info) { REPORTER_ASSERT(reporter, gpuWriteResult == (ioType == kRW_GrIOType)); // Copies should not work with a read-only texture - auto copySrc = proxyProvider->createTextureProxy( - SkImage::MakeFromRaster(write, nullptr, nullptr), GrRenderable::kNo, 1, - SkBudgeted::kYes, SkBackingFit::kExact); + auto copySrc = + proxyProvider->createTextureProxy(SkImage::MakeFromRaster(write, nullptr, nullptr), + 1, SkBudgeted::kYes, SkBackingFit::kExact); REPORTER_ASSERT(reporter, copySrc); auto copyResult = surfContext->testCopy(copySrc.get()); REPORTER_ASSERT(reporter, copyResult == (ioType == kRW_GrIOType)); diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp index 4ef5e00a99..20c8da5858 100644 --- a/tests/ImageFilterCacheTest.cpp +++ b/tests/ImageFilterCacheTest.cpp @@ -202,8 +202,7 @@ DEF_TEST(ImageFilterCache_ImageBackedRaster, reporter) { static sk_sp create_proxy(GrProxyProvider* proxyProvider) { SkBitmap srcBM = create_bm(); sk_sp srcImage(SkImage::MakeFromBitmap(srcBM)); - return proxyProvider->createTextureProxy(srcImage, GrRenderable::kNo, 1, SkBudgeted::kYes, - SkBackingFit::kExact); + return proxyProvider->createTextureProxy(srcImage, 1, SkBudgeted::kYes, SkBackingFit::kExact); } DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) { diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index 0799a5dab5..f5259c76ab 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -288,8 +288,8 @@ bool init_test_textures(GrResourceProvider* resourceProvider, kRGBA_8888_SkColorType, kPremul_SkAlphaType); SkPixmap pixmap(ii, rgbaData.get(), ii.minRowBytes()); sk_sp img = SkImage::MakeRasterCopy(pixmap); - proxies[0] = proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes, - SkBackingFit::kExact); + proxies[0] = + proxyProvider->createTextureProxy(img, 1, SkBudgeted::kYes, SkBackingFit::kExact); proxies[0]->instantiate(resourceProvider); } @@ -306,8 +306,8 @@ bool init_test_textures(GrResourceProvider* resourceProvider, kAlpha_8_SkColorType, kPremul_SkAlphaType); SkPixmap pixmap(ii, alphaData.get(), ii.minRowBytes()); sk_sp img = SkImage::MakeRasterCopy(pixmap); - proxies[1] = proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes, - SkBackingFit::kExact); + proxies[1] = + proxyProvider->createTextureProxy(img, 1, SkBudgeted::kYes, SkBackingFit::kExact); proxies[1]->instantiate(resourceProvider); } @@ -328,8 +328,7 @@ sk_sp make_input_texture(GrProxyProvider* proxyProvider, int wid SkImageInfo ii = SkImageInfo::Make(width, height, kRGBA_8888_SkColorType, kPremul_SkAlphaType); SkPixmap pixmap(ii, data.get(), ii.minRowBytes()); sk_sp img = SkImage::MakeRasterCopy(pixmap); - return proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes, - SkBackingFit::kExact); + return proxyProvider->createTextureProxy(img, 1, SkBudgeted::kYes, SkBackingFit::kExact); } // We tag logged data as unpremul to avoid conversion when encoding as PNG. The input texture diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index 053625558f..4c9bc1b490 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -70,7 +70,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) { SkPixmap pixmap(ii, alphaData, ii.minRowBytes()); sk_sp alphaImg = SkImage::MakeRasterCopy(pixmap); sk_sp proxy = proxyProvider->createTextureProxy( - alphaImg, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact); + alphaImg, 1, SkBudgeted::kNo, SkBackingFit::kExact); if (!proxy) { ERRORF(reporter, "Could not create alpha texture."); return; diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index 42dbcb8c83..0a8c30d5e2 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -221,7 +221,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) // gpu sk_sp rasterImage = SkImage::MakeFromBitmap(bm); sk_sp proxy = proxyProvider->createTextureProxy( - rasterImage, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact); + rasterImage, 1, SkBudgeted::kNo, SkBackingFit::kExact); if (!proxy) { return; } @@ -252,8 +252,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { SkBitmap bm = create_bm(); sk_sp rasterImage = SkImage::MakeFromBitmap(bm); - sk_sp proxy = proxyProvider->createTextureProxy( - rasterImage, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact); + sk_sp proxy = proxyProvider->createTextureProxy(rasterImage, 1, SkBudgeted::kNo, + SkBackingFit::kExact); if (!proxy) { return; }