Rename GrThreadSafeUniquelyKeyedProxyViewCache
Once triangulated paths are added this will no longer just be storing proxy views.
Bug: 1108408
Change-Id: I82fa47b0b85f738d9a25330c29bc2892c9bfeda4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323999
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
index 1e13968..2b1ac09 100644
--- a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
+++ b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
@@ -14,7 +14,7 @@
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
-#include "src/gpu/GrThreadSafeUniquelyKeyedProxyViewCache.h"
+#include "src/gpu/GrThreadSafeCache.h"
// Computes an unnormalized half kernel (right side). Returns the summation of all the half
// kernel values.
@@ -187,7 +187,7 @@
return nullptr;
}
- auto threadSafeViewCache = rContext->priv().threadSafeViewCache();
+ auto threadSafeCache = rContext->priv().threadSafeCache();
// Profile textures are cached by the ratio of sigma to circle radius and by the size of the
// profile texture (binned by powers of 2).
@@ -229,7 +229,7 @@
builder[0] = sigmaToCircleRRatioFixed;
builder.finish();
- GrSurfaceProxyView profileView = threadSafeViewCache->find(key);
+ GrSurfaceProxyView profileView = threadSafeCache->find(key);
if (profileView) {
SkASSERT(profileView.asTextureProxy());
SkASSERT(profileView.origin() == kTopLeft_GrSurfaceOrigin);
@@ -258,7 +258,7 @@
return nullptr;
}
- profileView = threadSafeViewCache->add(key, profileView);
+ profileView = threadSafeCache->add(key, profileView);
return GrTextureEffect::Make(std::move(profileView), kPremul_SkAlphaType, texM);
}
@@ -307,18 +307,18 @@
args.fUniformHandler->getUniformCStr(circleDataVar),
args.fUniformHandler->getUniformCStr(circleDataVar),
args.fUniformHandler->getUniformCStr(circleDataVar));
- SkString _sample13801 = this->invokeChild(0, args);
+ SkString _sample13763 = this->invokeChild(0, args);
fragBuilder->codeAppendf(
R"SkSL(
half4 inputColor = %s;)SkSL",
- _sample13801.c_str());
- SkString _coords13849("float2(half2(dist, 0.5))");
- SkString _sample13849 = this->invokeChild(1, args, _coords13849.c_str());
+ _sample13763.c_str());
+ SkString _coords13811("float2(half2(dist, 0.5))");
+ SkString _sample13811 = this->invokeChild(1, args, _coords13811.c_str());
fragBuilder->codeAppendf(
R"SkSL(
%s = inputColor * %s.w;
)SkSL",
- args.fOutputColor, _sample13849.c_str());
+ args.fOutputColor, _sample13811.c_str());
}
private:
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.cpp b/src/gpu/effects/generated/GrRRectBlurEffect.cpp
index 42543b5..4a5c62c 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.cpp
@@ -24,7 +24,7 @@
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrStyle.h"
-#include "src/gpu/GrThreadSafeUniquelyKeyedProxyViewCache.h"
+#include "src/gpu/GrThreadSafeCache.h"
#include "src/gpu/effects/GrTextureEffect.h"
static constexpr auto kBlurredRRectMaskOrigin = kTopLeft_GrSurfaceOrigin;
@@ -48,13 +48,12 @@
builder.finish();
}
-static bool fillin_view_on_gpu(
- GrDirectContext* dContext,
- const GrSurfaceProxyView& lazyView,
- sk_sp<GrThreadSafeUniquelyKeyedProxyViewCache::Trampoline> trampoline,
- const SkRRect& rrectToDraw,
- const SkISize& dimensions,
- float xformedSigma) {
+static bool fillin_view_on_gpu(GrDirectContext* dContext,
+ const GrSurfaceProxyView& lazyView,
+ sk_sp<GrThreadSafeCache::Trampoline> trampoline,
+ const SkRRect& rrectToDraw,
+ const SkISize& dimensions,
+ float xformedSigma) {
std::unique_ptr<GrRenderTargetContext> rtc = GrRenderTargetContext::MakeWithFallback(
dContext, GrColorType::kAlpha_8, nullptr, SkBackingFit::kExact, dimensions, 1,
GrMipmapped::kNo, GrProtected::kNo, kBlurredRRectMaskOrigin);
@@ -232,7 +231,7 @@
GrUniqueKey key;
make_blurred_rrect_key(&key, rrectToDraw, xformedSigma);
- auto threadSafeViewCache = rContext->priv().threadSafeViewCache();
+ auto threadSafeCache = rContext->priv().threadSafeCache();
// It seems like we could omit this matrix and modify the shader code to not normalize
// the coords used to sample the texture effect. However, the "proxyDims" value in the
@@ -247,14 +246,14 @@
if (GrDirectContext* dContext = rContext->asDirectContext()) {
// The gpu thread gets priority over the recording threads. If the gpu thread is first,
// it crams a lazy proxy into the cache and then fills it in later.
- auto[lazyView, trampoline] = GrThreadSafeUniquelyKeyedProxyViewCache::CreateLazyView(
- dContext, GrColorType::kAlpha_8, dimensions, kBlurredRRectMaskOrigin,
- SkBackingFit::kExact);
+ auto[lazyView, trampoline] =
+ GrThreadSafeCache::CreateLazyView(dContext, GrColorType::kAlpha_8, dimensions,
+ kBlurredRRectMaskOrigin, SkBackingFit::kExact);
if (!lazyView) {
return nullptr;
}
- view = threadSafeViewCache->findOrAdd(key, lazyView);
+ view = threadSafeCache->findOrAdd(key, lazyView);
if (view != lazyView) {
SkASSERT(view.asTextureProxy());
SkASSERT(view.origin() == kBlurredRRectMaskOrigin);
@@ -265,11 +264,11 @@
xformedSigma)) {
// In this case something has gone disastrously wrong so set up to drop the draw
// that needed this resource and reduce future pollution of the cache.
- threadSafeViewCache->remove(key);
+ threadSafeCache->remove(key);
return nullptr;
}
} else {
- view = threadSafeViewCache->find(key);
+ view = threadSafeCache->find(key);
if (view) {
SkASSERT(view.asTextureProxy());
SkASSERT(view.origin() == kBlurredRRectMaskOrigin);
@@ -281,7 +280,7 @@
return nullptr;
}
- view = threadSafeViewCache->add(key, view);
+ view = threadSafeCache->add(key, view);
}
SkASSERT(view.asTextureProxy());
@@ -377,18 +376,18 @@
args.fUniformHandler->getUniformCStr(proxyRectVar),
args.fUniformHandler->getUniformCStr(blurRadiusVar),
args.fUniformHandler->getUniformCStr(cornerRadiusVar));
- SkString _sample17268 = this->invokeChild(0, args);
+ SkString _sample17178 = this->invokeChild(0, args);
fragBuilder->codeAppendf(
R"SkSL(
half4 inputColor = %s;)SkSL",
- _sample17268.c_str());
- SkString _coords17316("float2(texCoord)");
- SkString _sample17316 = this->invokeChild(1, args, _coords17316.c_str());
+ _sample17178.c_str());
+ SkString _coords17226("float2(texCoord)");
+ SkString _sample17226 = this->invokeChild(1, args, _coords17226.c_str());
fragBuilder->codeAppendf(
R"SkSL(
%s = inputColor * %s;
)SkSL",
- args.fOutputColor, _sample17316.c_str());
+ args.fOutputColor, _sample17226.c_str());
}
private:
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.cpp b/src/gpu/effects/generated/GrRectBlurEffect.cpp
index 9763f3f..e0ed896 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRectBlurEffect.cpp
@@ -70,14 +70,14 @@
rectFVar.isValid() ? args.fUniformHandler->getUniformCStr(rectFVar) : "float4(0)",
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)",
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)");
- SkString _coords8175("float2(half2(xy.x, 0.5))");
- SkString _sample8175 = this->invokeChild(1, args, _coords8175.c_str());
+ SkString _coords8137("float2(half2(xy.x, 0.5))");
+ SkString _sample8137 = this->invokeChild(1, args, _coords8137.c_str());
fragBuilder->codeAppendf(
R"SkSL(
xCoverage = %s.w;)SkSL",
- _sample8175.c_str());
- SkString _coords8233("float2(half2(xy.y, 0.5))");
- SkString _sample8233 = this->invokeChild(1, args, _coords8233.c_str());
+ _sample8137.c_str());
+ SkString _coords8195("float2(half2(xy.y, 0.5))");
+ SkString _sample8195 = this->invokeChild(1, args, _coords8195.c_str());
fragBuilder->codeAppendf(
R"SkSL(
yCoverage = %s.w;
@@ -90,35 +90,35 @@
rect.xy = half2(float2(%s.xy) - pos);
rect.zw = half2(pos - float2(%s.zw));
})SkSL",
- _sample8233.c_str(),
+ _sample8195.c_str(),
rectFVar.isValid() ? args.fUniformHandler->getUniformCStr(rectFVar) : "float4(0)",
rectFVar.isValid() ? args.fUniformHandler->getUniformCStr(rectFVar) : "float4(0)",
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)",
rectHVar.isValid() ? args.fUniformHandler->getUniformCStr(rectHVar) : "half4(0)");
- SkString _coords9552("float2(half2(rect.x, 0.5))");
- SkString _sample9552 = this->invokeChild(1, args, _coords9552.c_str());
- SkString _coords9615("float2(half2(rect.z, 0.5))");
- SkString _sample9615 = this->invokeChild(1, args, _coords9615.c_str());
+ SkString _coords9514("float2(half2(rect.x, 0.5))");
+ SkString _sample9514 = this->invokeChild(1, args, _coords9514.c_str());
+ SkString _coords9577("float2(half2(rect.z, 0.5))");
+ SkString _sample9577 = this->invokeChild(1, args, _coords9577.c_str());
fragBuilder->codeAppendf(
R"SkSL(
xCoverage = (1.0 - %s.w) - %s.w;)SkSL",
- _sample9552.c_str(), _sample9615.c_str());
- SkString _coords9679("float2(half2(rect.y, 0.5))");
- SkString _sample9679 = this->invokeChild(1, args, _coords9679.c_str());
- SkString _coords9742("float2(half2(rect.w, 0.5))");
- SkString _sample9742 = this->invokeChild(1, args, _coords9742.c_str());
+ _sample9514.c_str(), _sample9577.c_str());
+ SkString _coords9641("float2(half2(rect.y, 0.5))");
+ SkString _sample9641 = this->invokeChild(1, args, _coords9641.c_str());
+ SkString _coords9704("float2(half2(rect.w, 0.5))");
+ SkString _sample9704 = this->invokeChild(1, args, _coords9704.c_str());
fragBuilder->codeAppendf(
R"SkSL(
yCoverage = (1.0 - %s.w) - %s.w;
})SkSL",
- _sample9679.c_str(), _sample9742.c_str());
- SkString _sample9811 = this->invokeChild(0, args);
+ _sample9641.c_str(), _sample9704.c_str());
+ SkString _sample9773 = this->invokeChild(0, args);
fragBuilder->codeAppendf(
R"SkSL(
half4 inputColor = %s;
%s = (inputColor * xCoverage) * yCoverage;
)SkSL",
- _sample9811.c_str(), args.fOutputColor);
+ _sample9773.c_str(), args.fOutputColor);
}
private:
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.h b/src/gpu/effects/generated/GrRectBlurEffect.h
index 0e67f7e..9dce2cc 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRectBlurEffect.h
@@ -25,7 +25,7 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrShaderCaps.h"
-#include "src/gpu/GrThreadSafeUniquelyKeyedProxyViewCache.h"
+#include "src/gpu/GrThreadSafeCache.h"
#include "src/gpu/effects/GrTextureEffect.h"
#include "src/gpu/GrFragmentProcessor.h"
@@ -34,7 +34,7 @@
public:
static std::unique_ptr<GrFragmentProcessor> MakeIntegralFP(GrRecordingContext* rContext,
float sixSigma) {
- auto threadSafeViewCache = rContext->priv().threadSafeViewCache();
+ auto threadSafeCache = rContext->priv().threadSafeCache();
int width = SkCreateIntegralTable(sixSigma, nullptr);
@@ -46,7 +46,7 @@
SkMatrix m = SkMatrix::Scale(width / sixSigma, 1.f);
- GrSurfaceProxyView view = threadSafeViewCache->find(key);
+ GrSurfaceProxyView view = threadSafeCache->find(key);
if (view) {
SkASSERT(view.origin() == kTopLeft_GrSurfaceOrigin);
@@ -65,7 +65,7 @@
return {};
}
- view = threadSafeViewCache->add(key, view);
+ view = threadSafeCache->add(key, view);
SkASSERT(view.origin() == kTopLeft_GrSurfaceOrigin);
return GrTextureEffect::Make(std::move(view), kPremul_SkAlphaType, m,