aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-10-09 10:54:08 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-09 15:20:33 +0000
commitabff956455637b12eab374fd44b99e1338799113 (patch)
tree77f932f38b3f00f904faeae1c847f1218f61d0c4
parent4e7cdd5a0052aa76bed6f80ec325be19e09e6ab1 (diff)
initClassID no longer auto-allocates ids
Auto-allocated IDs mean that the IDs depend upon the order in which classes happen to get initialized and are therefore not consistent from run to run. This change paves the way for a persistent shader cache by fixing the IDs in an enum. Bug: skia: Change-Id: I3e923c6c54f41b3b3eb616458abee83e0909c09f Reviewed-on: https://skia-review.googlesource.com/56401 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
-rw-r--r--src/core/SkColorMatrixFilterRowMajor255.cpp4
-rw-r--r--src/effects/GrAlphaThresholdFragmentProcessor.cpp3
-rw-r--r--src/effects/GrAlphaThresholdFragmentProcessor.h3
-rw-r--r--src/effects/GrCircleBlurFragmentProcessor.cpp3
-rw-r--r--src/effects/GrCircleBlurFragmentProcessor.h4
-rw-r--r--src/effects/SkArithmeticImageFilter.cpp3
-rw-r--r--src/effects/SkBlurMaskFilter.cpp6
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp7
-rw-r--r--src/effects/SkHighContrastFilter.cpp3
-rw-r--r--src/effects/SkLightingImageFilter.cpp35
-rw-r--r--src/effects/SkLumaColorFilter.cpp4
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp7
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp6
-rw-r--r--src/effects/SkOverdrawColorFilter.cpp3
-rw-r--r--src/effects/SkRRectsGaussianEdgeMaskFilter.cpp8
-rw-r--r--src/effects/SkTableColorFilter.cpp4
-rw-r--r--src/gpu/GrDefaultGeoProcFactory.cpp4
-rw-r--r--src/gpu/GrFragmentProcessor.cpp21
-rw-r--r--src/gpu/GrFragmentProcessor.h4
-rw-r--r--src/gpu/GrGeometryProcessor.h5
-rw-r--r--src/gpu/GrPathProcessor.cpp7
-rw-r--r--src/gpu/GrPrimitiveProcessor.h3
-rw-r--r--src/gpu/GrProcessor.cpp2
-rw-r--r--src/gpu/GrProcessor.h125
-rw-r--r--src/gpu/GrXferProcessor.cpp10
-rw-r--r--src/gpu/GrXferProcessor.h7
-rw-r--r--src/gpu/ccpr/GrCCPRCoverageProcessor.cpp5
-rw-r--r--src/gpu/ccpr/GrCCPRPathProcessor.cpp5
-rw-r--r--src/gpu/effects/GrBezierEffect.cpp12
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp9
-rw-r--r--src/gpu/effects/GrBitmapTextGeoProc.cpp4
-rw-r--r--src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp5
-rw-r--r--src/gpu/effects/GrBlurredEdgeFragmentProcessor.h6
-rw-r--r--src/gpu/effects/GrCircleEffect.cpp6
-rw-r--r--src/gpu/effects/GrCircleEffect.h7
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp5
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.h5
-rw-r--r--src/gpu/effects/GrConstColorProcessor.h6
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp9
-rw-r--r--src/gpu/effects/GrCoverageSetOpXP.cpp6
-rw-r--r--src/gpu/effects/GrCustomXfermode.cpp10
-rw-r--r--src/gpu/effects/GrDisableColorXP.cpp3
-rw-r--r--src/gpu/effects/GrDistanceFieldGeoProc.cpp12
-rw-r--r--src/gpu/effects/GrDitherEffect.cpp4
-rw-r--r--src/gpu/effects/GrDitherEffect.h5
-rw-r--r--src/gpu/effects/GrEllipseEffect.cpp6
-rw-r--r--src/gpu/effects/GrEllipseEffect.h7
-rw-r--r--src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp7
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp6
-rw-r--r--src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp8
-rw-r--r--src/gpu/effects/GrPorterDuffXferProcessor.cpp10
-rw-r--r--src/gpu/effects/GrRRectEffect.cpp6
-rw-r--r--src/gpu/effects/GrSRGBEffect.cpp3
-rw-r--r--src/gpu/effects/GrShadowGeoProc.cpp4
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp3
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.h10
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp14
-rw-r--r--src/gpu/effects/GrXfermodeFragmentProcessor.cpp9
-rw-r--r--src/gpu/effects/GrYUVEffect.cpp6
-rw-r--r--src/gpu/instanced/InstanceProcessor.cpp6
-rw-r--r--src/gpu/ops/GrAAConvexPathRenderer.cpp5
-rw-r--r--src/gpu/ops/GrDashOp.cpp8
-rw-r--r--src/gpu/ops/GrMSAAPathRenderer.cpp4
-rw-r--r--src/gpu/ops/GrOvalOpFactory.cpp13
-rw-r--r--src/gpu/ops/GrTextureOp.cpp6
-rw-r--r--src/shaders/SkPerlinNoiseShader.cpp12
-rw-r--r--src/shaders/gradients/SkGradientShader.cpp6
-rw-r--r--src/shaders/gradients/SkGradientShaderPriv.h2
-rw-r--r--src/shaders/gradients/SkLinearGradient.cpp7
-rw-r--r--src/shaders/gradients/SkRadialGradient.cpp8
-rw-r--r--src/shaders/gradients/SkSweepGradient.cpp10
-rw-r--r--src/shaders/gradients/SkTwoPointConicalGradient_gpu.cpp35
-rw-r--r--src/sksl/SkSLCPPCodeGenerator.cpp8
-rw-r--r--src/sksl/SkSLHCodeGenerator.cpp10
-rw-r--r--tests/GLProgramsTest.cpp5
-rw-r--r--tests/GrMeshTest.cpp4
-rw-r--r--tests/GrPipelineDynamicStateTest.cpp7
-rw-r--r--tests/ImageStorageTest.cpp6
-rw-r--r--tests/PrimitiveProcessorTest.cpp6
-rw-r--r--tests/ProcessorTest.cpp12
-rw-r--r--tests/SkSLFPTest.cpp8
81 files changed, 348 insertions, 354 deletions
diff --git a/src/core/SkColorMatrixFilterRowMajor255.cpp b/src/core/SkColorMatrixFilterRowMajor255.cpp
index 9c9aa1aff1..59b3f3c9f4 100644
--- a/src/core/SkColorMatrixFilterRowMajor255.cpp
+++ b/src/core/SkColorMatrixFilterRowMajor255.cpp
@@ -255,9 +255,9 @@ private:
// We could implement the constant input->constant output optimization but haven't. Other
// optimizations would be matrix-dependent.
- ColorMatrixEffect(const SkScalar matrix[20]) : INHERITED(kNone_OptimizationFlags) {
+ ColorMatrixEffect(const SkScalar matrix[20])
+ : INHERITED(kColorMatrixEffect_ClassID, kNone_OptimizationFlags) {
memcpy(fMatrix, matrix, sizeof(SkScalar) * 20);
- this->initClassID<ColorMatrixEffect>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index 34e9cdbb40..e1badf7f21 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
@@ -107,7 +107,7 @@ bool GrAlphaThresholdFragmentProcessor::onIsEqual(const GrFragmentProcessor& oth
}
GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor(
const GrAlphaThresholdFragmentProcessor& src)
- : INHERITED(src.optimizationFlags())
+ : INHERITED(kGrAlphaThresholdFragmentProcessor_ClassID, src.optimizationFlags())
, fImage(src.fImage)
, fColorXform(src.fColorXform)
, fMask(src.fMask)
@@ -115,7 +115,6 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor(
, fOuterThreshold(src.fOuterThreshold)
, fImageCoordTransform(src.fImageCoordTransform)
, fMaskCoordTransform(src.fMaskCoordTransform) {
- this->initClassID<GrAlphaThresholdFragmentProcessor>();
this->addTextureSampler(&fImage);
this->addTextureSampler(&fMask);
this->addCoordTransform(&fImageCoordTransform);
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.h b/src/effects/GrAlphaThresholdFragmentProcessor.h
index 3b649516c1..2d2b58aaee 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.h
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.h
@@ -44,7 +44,7 @@ private:
sk_sp<GrColorSpaceXform> colorXform,
sk_sp<GrTextureProxy> mask, float innerThreshold,
float outerThreshold, const SkIRect& bounds)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kGrAlphaThresholdFragmentProcessor_ClassID, kNone_OptimizationFlags)
, fImage(std::move(image))
, fColorXform(colorXform)
, fMask(std::move(mask))
@@ -58,7 +58,6 @@ private:
this->addTextureSampler(&fMask);
this->addCoordTransform(&fImageCoordTransform);
this->addCoordTransform(&fMaskCoordTransform);
- this->initClassID<GrAlphaThresholdFragmentProcessor>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp
index 68955f22aa..5a825f49f5 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -318,12 +318,11 @@ bool GrCircleBlurFragmentProcessor::onIsEqual(const GrFragmentProcessor& other)
}
GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(
const GrCircleBlurFragmentProcessor& src)
- : INHERITED(src.optimizationFlags())
+ : INHERITED(kGrCircleBlurFragmentProcessor_ClassID, src.optimizationFlags())
, fCircleRect(src.fCircleRect)
, fTextureRadius(src.fTextureRadius)
, fSolidRadius(src.fSolidRadius)
, fBlurProfileSampler(src.fBlurProfileSampler) {
- this->initClassID<GrCircleBlurFragmentProcessor>();
this->addTextureSampler(&fBlurProfileSampler);
}
std::unique_ptr<GrFragmentProcessor> GrCircleBlurFragmentProcessor::clone() const {
diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h
index e98714b4b0..6f209c99cc 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.h
+++ b/src/effects/GrCircleBlurFragmentProcessor.h
@@ -31,13 +31,13 @@ private:
GrCircleBlurFragmentProcessor(SkRect circleRect, float textureRadius, float solidRadius,
sk_sp<GrTextureProxy> blurProfileSampler,
GrResourceProvider* resourceProvider)
- : INHERITED((OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrCircleBlurFragmentProcessor_ClassID,
+ (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fCircleRect(circleRect)
, fTextureRadius(textureRadius)
, fSolidRadius(solidRadius)
, fBlurProfileSampler(std::move(blurProfileSampler)) {
this->addTextureSampler(&fBlurProfileSampler);
- this->initClassID<GrCircleBlurFragmentProcessor>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/effects/SkArithmeticImageFilter.cpp b/src/effects/SkArithmeticImageFilter.cpp
index 1bc3d06f22..27bf28e54b 100644
--- a/src/effects/SkArithmeticImageFilter.cpp
+++ b/src/effects/SkArithmeticImageFilter.cpp
@@ -350,13 +350,12 @@ private:
// This could implement the const input -> const output optimization but it's unlikely to help.
ArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor,
std::unique_ptr<GrFragmentProcessor> dst)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kArithmeticFP_ClassID, kNone_OptimizationFlags)
, fK1(k1)
, fK2(k2)
, fK3(k3)
, fK4(k4)
, fEnforcePMColor(enforcePMColor) {
- this->initClassID<ArithmeticFP>();
SkASSERT(dst);
SkDEBUGCODE(int dstIndex =) this->registerChildProcessor(std::move(dst));
SkASSERT(0 == dstIndex);
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 242b398db2..ca7de71914 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -974,12 +974,11 @@ sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture(
GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma,
sk_sp<GrTextureProxy> blurProfile,
GrSLPrecision precision)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrRectBlurEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRect(rect)
, fSigma(sigma)
, fBlurProfileSampler(std::move(blurProfile))
, fPrecision(precision) {
- this->initClassID<GrRectBlurEffect>();
this->addTextureSampler(&fBlurProfileSampler);
}
@@ -1206,11 +1205,10 @@ std::unique_ptr<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context,
GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect,
sk_sp<GrTextureProxy> ninePatchProxy)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrRRectBlurEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRRect(rrect)
, fSigma(sigma)
, fNinePatchSampler(std::move(ninePatchProxy)) {
- this->initClassID<GrRRectBlurEffect>();
this->addTextureSampler(&fNinePatchSampler);
}
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 97d18315ca..67db24eedd 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -464,7 +464,7 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(
sk_sp<GrTextureProxy> color,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkISize& colorDimensions)
- : INHERITED(OptimizationFlags(color->config()))
+ : INHERITED(kGrDisplacementMapEffect_ClassID, OptimizationFlags(color->config()))
, fDisplacementTransform(offsetMatrix, displacement.get())
, fDisplacementSampler(displacement)
, fColorTransform(color.get())
@@ -475,7 +475,6 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(
, fXChannelSelector(xChannelSelector)
, fYChannelSelector(yChannelSelector)
, fScale(scale) {
- this->initClassID<GrDisplacementMapEffect>();
this->addCoordTransform(&fDisplacementTransform);
this->addTextureSampler(&fDisplacementSampler);
this->addCoordTransform(&fColorTransform);
@@ -483,7 +482,8 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(
}
GrDisplacementMapEffect::GrDisplacementMapEffect(const GrDisplacementMapEffect& that)
- : INHERITED(OptimizationFlags(that.fColorSampler.proxy()->config()))
+ : INHERITED(kGrDisplacementMapEffect_ClassID,
+ OptimizationFlags(that.fColorSampler.proxy()->config()))
, fDisplacementTransform(that.fDisplacementTransform)
, fDisplacementSampler(that.fDisplacementSampler)
, fColorTransform(that.fColorTransform)
@@ -493,7 +493,6 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(const GrDisplacementMapEffect&
, fXChannelSelector(that.fXChannelSelector)
, fYChannelSelector(that.fYChannelSelector)
, fScale(that.fScale) {
- this->initClassID<GrDisplacementMapEffect>();
this->addCoordTransform(&fDisplacementTransform);
this->addTextureSampler(&fDisplacementSampler);
this->addCoordTransform(&fColorTransform);
diff --git a/src/effects/SkHighContrastFilter.cpp b/src/effects/SkHighContrastFilter.cpp
index 7618861c5f..1d67b3f182 100644
--- a/src/effects/SkHighContrastFilter.cpp
+++ b/src/effects/SkHighContrastFilter.cpp
@@ -179,9 +179,8 @@ public:
private:
HighContrastFilterEffect(const SkHighContrastConfig& config)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kHighContrastFilterEffect_ClassID, kNone_OptimizationFlags)
, fConfig(config) {
- this->initClassID<HighContrastFilterEffect>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 37f1c7bb05..8a8174a099 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -602,7 +602,7 @@ public:
const GrTextureDomain& domain() const { return fDomain; }
protected:
- GrLightingEffect(sk_sp<GrTextureProxy>, sk_sp<const SkImageFilterLight> light,
+ GrLightingEffect(ClassID classID, sk_sp<GrTextureProxy>, sk_sp<const SkImageFilterLight> light,
SkScalar surfaceScale, const SkMatrix& matrix, BoundaryMode boundaryMode,
const SkIRect* srcBounds);
@@ -1691,14 +1691,15 @@ static GrTextureDomain create_domain(GrTextureProxy* proxy, const SkIRect* srcBo
}
}
-GrLightingEffect::GrLightingEffect(sk_sp<GrTextureProxy> proxy,
+GrLightingEffect::GrLightingEffect(ClassID classID,
+ sk_sp<GrTextureProxy> proxy,
sk_sp<const SkImageFilterLight> light,
SkScalar surfaceScale,
const SkMatrix& matrix,
BoundaryMode boundaryMode,
const SkIRect* srcBounds)
// Perhaps this could advertise the opaque or coverage-as-alpha optimizations?
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(classID, kNone_OptimizationFlags)
, fCoordTransform(proxy.get())
, fDomain(create_domain(proxy.get(), srcBounds, GrTextureDomain::kDecal_Mode))
, fTextureSampler(std::move(proxy))
@@ -1706,13 +1707,12 @@ GrLightingEffect::GrLightingEffect(sk_sp<GrTextureProxy> proxy,
, fSurfaceScale(surfaceScale)
, fFilterMatrix(matrix)
, fBoundaryMode(boundaryMode) {
- this->initClassID<GrLightingEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
GrLightingEffect::GrLightingEffect(const GrLightingEffect& that)
- : INHERITED(that.optimizationFlags())
+ : INHERITED(that.classID(), that.optimizationFlags())
, fCoordTransform(that.fCoordTransform)
, fDomain(that.fDomain)
, fTextureSampler(that.fTextureSampler)
@@ -1720,7 +1720,6 @@ GrLightingEffect::GrLightingEffect(const GrLightingEffect& that)
, fSurfaceScale(that.fSurfaceScale)
, fFilterMatrix(that.fFilterMatrix)
, fBoundaryMode(that.fBoundaryMode) {
- this->initClassID<GrLightingEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
@@ -1741,16 +1740,12 @@ GrDiffuseLightingEffect::GrDiffuseLightingEffect(sk_sp<GrTextureProxy> proxy,
SkScalar kd,
BoundaryMode boundaryMode,
const SkIRect* srcBounds)
- : INHERITED(std::move(proxy), std::move(light), surfaceScale, matrix, boundaryMode,
- srcBounds)
- , fKD(kd) {
- this->initClassID<GrDiffuseLightingEffect>();
-}
+ : INHERITED(kGrDiffuseLightingEffect_ClassID, std::move(proxy), std::move(light),
+ surfaceScale, matrix, boundaryMode, srcBounds)
+ , fKD(kd) {}
GrDiffuseLightingEffect::GrDiffuseLightingEffect(const GrDiffuseLightingEffect& that)
- : INHERITED(that), fKD(that.fKD) {
- this->initClassID<GrDiffuseLightingEffect>();
-}
+ : INHERITED(that), fKD(that.fKD) {}
bool GrDiffuseLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrDiffuseLightingEffect& s = sBase.cast<GrDiffuseLightingEffect>();
@@ -1986,17 +1981,13 @@ GrSpecularLightingEffect::GrSpecularLightingEffect(sk_sp<GrTextureProxy> proxy,
SkScalar shininess,
BoundaryMode boundaryMode,
const SkIRect* srcBounds)
- : INHERITED(std::move(proxy), std::move(light), surfaceScale, matrix, boundaryMode,
- srcBounds)
+ : INHERITED(kGrSpecularLightingEffect_ClassID, std::move(proxy), std::move(light),
+ surfaceScale, matrix, boundaryMode, srcBounds)
, fKS(ks)
- , fShininess(shininess) {
- this->initClassID<GrSpecularLightingEffect>();
-}
+ , fShininess(shininess) {}
GrSpecularLightingEffect::GrSpecularLightingEffect(const GrSpecularLightingEffect& that)
- : INHERITED(that), fKS(that.fKS), fShininess(that.fShininess) {
- this->initClassID<GrSpecularLightingEffect>();
-}
+ : INHERITED(that), fKS(that.fKS), fShininess(that.fShininess) {}
bool GrSpecularLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
const GrSpecularLightingEffect& s = sBase.cast<GrSpecularLightingEffect>();
diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp
index ecd1a3a302..3b3845e46e 100644
--- a/src/effects/SkLumaColorFilter.cpp
+++ b/src/effects/SkLumaColorFilter.cpp
@@ -78,8 +78,8 @@ private:
typedef GrGLSLFragmentProcessor INHERITED;
};
- LumaColorFilterEffect() : INHERITED(kConstantOutputForConstantInput_OptimizationFlag) {
- this->initClassID<LumaColorFilterEffect>();
+ LumaColorFilterEffect()
+ : INHERITED(kLumaColorFilterEffect_ClassID, kConstantOutputForConstantInput_OptimizationFlag) {
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 1c529a93ca..d08bbae5ac 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -98,7 +98,8 @@ private:
float yInvZoom,
float xInvInset,
float yInvInset)
- : INHERITED{ModulateByConfigOptimizationFlags(proxy->config())}
+ : INHERITED{kGrMagnifierEffect_ClassID,
+ ModulateByConfigOptimizationFlags(proxy->config())}
// TODO: no GrSamplerState::Filter::kBilerp?
, fCoordTransform(proxy.get())
, fTextureSampler(std::move(proxy))
@@ -109,13 +110,12 @@ private:
, fYInvZoom(yInvZoom)
, fXInvInset(xInvInset)
, fYInvInset(yInvInset) {
- this->initClassID<GrMagnifierEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
explicit GrMagnifierEffect(const GrMagnifierEffect& that)
- : INHERITED(that.optimizationFlags())
+ : INHERITED(kGrMagnifierEffect_ClassID, that.optimizationFlags())
, fCoordTransform(that.fCoordTransform)
, fTextureSampler(that.fTextureSampler)
, fColorSpaceXform(that.fColorSpaceXform)
@@ -125,7 +125,6 @@ private:
, fYInvZoom(that.fYInvZoom)
, fXInvInset(that.fXInvInset)
, fYInvInset(that.fYInvInset) {
- this->initClassID<GrMagnifierEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index c9b4dc91da..3315558e22 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -324,14 +324,13 @@ GrMorphologyEffect::GrMorphologyEffect(sk_sp<GrTextureProxy> proxy,
int radius,
Type type,
const float range[2])
- : INHERITED(ModulateByConfigOptimizationFlags(proxy->config()))
+ : INHERITED(kGrMorphologyEffect_ClassID, ModulateByConfigOptimizationFlags(proxy->config()))
, fCoordTransform(proxy.get())
, fTextureSampler(std::move(proxy))
, fDirection(direction)
, fRadius(radius)
, fType(type)
, fUseRange(SkToBool(range)) {
- this->initClassID<GrMorphologyEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
if (fUseRange) {
@@ -341,14 +340,13 @@ GrMorphologyEffect::GrMorphologyEffect(sk_sp<GrTextureProxy> proxy,
}
GrMorphologyEffect::GrMorphologyEffect(const GrMorphologyEffect& that)
- : INHERITED(that.optimizationFlags())
+ : INHERITED(kGrMorphologyEffect_ClassID, that.optimizationFlags())
, fCoordTransform(that.fCoordTransform)
, fTextureSampler(that.fTextureSampler)
, fDirection(that.fDirection)
, fRadius(that.fRadius)
, fType(that.fType)
, fUseRange(that.fUseRange) {
- this->initClassID<GrMorphologyEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
if (that.fUseRange) {
diff --git a/src/effects/SkOverdrawColorFilter.cpp b/src/effects/SkOverdrawColorFilter.cpp
index be5a623396..a4fa0704d9 100644
--- a/src/effects/SkOverdrawColorFilter.cpp
+++ b/src/effects/SkOverdrawColorFilter.cpp
@@ -128,8 +128,7 @@ std::unique_ptr<GrFragmentProcessor> OverdrawFragmentProcessor::Make(const SkPMC
// This could implement the constant input -> constant output optimization, but we don't really
// care given how this is used.
OverdrawFragmentProcessor::OverdrawFragmentProcessor(const GrColor4f* colors)
- : INHERITED(kNone_OptimizationFlags) {
- this->initClassID<OverdrawFragmentProcessor>();
+ : INHERITED(kOverdrawFragmentProcessor_ClassID, kNone_OptimizationFlags) {
memcpy(fColors, colors, SkOverdrawColorFilter::kNumColors * sizeof(GrColor4f));
}
diff --git a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
index b0e7ca3529..2f697a3a63 100644
--- a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
+++ b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
@@ -458,23 +458,23 @@ private:
}
RRectsGaussianEdgeFP(const SkRRect& first, const SkRRect& second, SkScalar radius)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kRRectsGaussianEdgeFP_ClassID,
+ kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fFirst(first)
, fSecond(second)
, fRadius(radius) {
- this->initClassID<RRectsGaussianEdgeFP>();
fFirstMode = ComputeMode(fFirst);
fSecondMode = ComputeMode(fSecond);
}
RRectsGaussianEdgeFP(const RRectsGaussianEdgeFP& that)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kRRectsGaussianEdgeFP_ClassID,
+ kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fFirst(that.fFirst)
, fFirstMode(that.fFirstMode)
, fSecond(that.fSecond)
, fSecondMode(that.fSecondMode)
, fRadius(that.fRadius) {
- this->initClassID<RRectsGaussianEdgeFP>();
}
static Mode ComputeMode(const SkRRect& rr) {
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 6ebcfa66e8..6e4e06853f 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -472,11 +472,11 @@ std::unique_ptr<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context,
}
ColorTableEffect::ColorTableEffect(sk_sp<GrTextureProxy> proxy, GrTextureStripAtlas* atlas, int row)
- : INHERITED(kNone_OptimizationFlags) // Not bothering with table-specific optimizations.
+ : INHERITED(kColorTableEffect_ClassID,
+ kNone_OptimizationFlags) // Not bothering with table-specific optimizations.
, fTextureSampler(std::move(proxy))
, fAtlas(atlas)
, fRow(row) {
- this->initClassID<ColorTableEffect>();
this->addTextureSampler(&fTextureSampler);
}
diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index 32d16ffa75..a0c1f2a26f 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -248,14 +248,14 @@ private:
const SkMatrix& localMatrix,
uint8_t coverage,
bool localCoordsWillBeRead)
- : fColor(color)
+ : INHERITED(kDefaultGeoProc_ClassID)
+ , fColor(color)
, fViewMatrix(viewMatrix)
, fLocalMatrix(localMatrix)
, fCoverage(coverage)
, fFlags(gpTypeFlags)
, fLocalCoordsWillBeRead(localCoordsWillBeRead)
, fColorSpaceXform(std::move(colorSpaceXform)) {
- this->initClassID<DefaultGeoProc>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
if (fFlags & kColorAttribute_GPFlag) {
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index ca49da860c..90bbb33e60 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -123,9 +123,9 @@ public:
private:
PremulInputFragmentProcessor()
- : INHERITED(kPreservesOpaqueInput_OptimizationFlag |
+ : INHERITED(kPremulInputFragmentProcessor_ClassID,
+ kPreservesOpaqueInput_OptimizationFlag |
kConstantOutputForConstantInput_OptimizationFlag) {
- this->initClassID<PremulInputFragmentProcessor>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
@@ -165,9 +165,9 @@ public:
private:
UnpremulInputFragmentProcessor()
- : INHERITED(kPreservesOpaqueInput_OptimizationFlag |
+ : INHERITED(kUnpremulInputFragmentProcessor_ClassID,
+ kPreservesOpaqueInput_OptimizationFlag |
kConstantOutputForConstantInput_OptimizationFlag) {
- this->initClassID<UnpremulInputFragmentProcessor>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
@@ -243,9 +243,8 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::SwizzleOutput(
private:
SwizzleFragmentProcessor(const GrSwizzle& swizzle)
- : INHERITED(kAll_OptimizationFlags)
+ : INHERITED(kSwizzleFragmentProcessor_ClassID, kAll_OptimizationFlags)
, fSwizzle(swizzle) {
- this->initClassID<SwizzleFragmentProcessor>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
@@ -310,8 +309,7 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::MakeInputPremulAndMulB
private:
PremulFragmentProcessor(std::unique_ptr<GrFragmentProcessor> processor)
- : INHERITED(OptFlags(processor.get())) {
- this->initClassID<PremulFragmentProcessor>();
+ : INHERITED(kPremulFragmentProcessor_ClassID, OptFlags(processor.get())) {
this->registerChildProcessor(std::move(processor));
}
@@ -412,8 +410,8 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(
}
ReplaceInputFragmentProcessor(std::unique_ptr<GrFragmentProcessor> child, GrColor4f color)
- : INHERITED(OptFlags(child.get(), color)), fColor(color) {
- this->initClassID<ReplaceInputFragmentProcessor>();
+ : INHERITED(kReplaceInputFragmentProcessor_ClassID, OptFlags(child.get(), color))
+ , fColor(color) {
this->registerChildProcessor(std::move(child));
}
@@ -494,9 +492,8 @@ std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(
}
SeriesFragmentProcessor(std::unique_ptr<GrFragmentProcessor>* children, int cnt)
- : INHERITED(OptFlags(children, cnt)) {
+ : INHERITED(kSeriesFragmentProcessor_ClassID, OptFlags(children, cnt)) {
SkASSERT(cnt > 1);
- this->initClassID<SeriesFragmentProcessor>();
for (int i = 0; i < cnt; ++i) {
this->registerChildProcessor(std::move(children[i]));
}
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index 0c3efd1dfb..4ec92627ad 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -275,7 +275,9 @@ protected:
}
}
- GrFragmentProcessor(OptimizationFlags optimizationFlags) : fFlags(optimizationFlags) {
+ GrFragmentProcessor(ClassID classID, OptimizationFlags optimizationFlags)
+ : INHERITED(classID)
+ , fFlags(optimizationFlags) {
SkASSERT((fFlags & ~kAll_OptimizationFlags) == 0);
}
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index d8962c21ac..acd122eef5 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -19,8 +19,9 @@
*/
class GrGeometryProcessor : public GrPrimitiveProcessor {
public:
- GrGeometryProcessor()
- : fWillUseGeoShader(false)
+ GrGeometryProcessor(ClassID classID)
+ : INHERITED(classID)
+ , fWillUseGeoShader(false)
, fLocalCoordsType(kUnused_LocalCoordsType)
, fSampleShading(0.0) {}
diff --git a/src/gpu/GrPathProcessor.cpp b/src/gpu/GrPathProcessor.cpp
index 24326e94a0..49980eb008 100644
--- a/src/gpu/GrPathProcessor.cpp
+++ b/src/gpu/GrPathProcessor.cpp
@@ -115,11 +115,10 @@ private:
GrPathProcessor::GrPathProcessor(GrColor color,
const SkMatrix& viewMatrix,
const SkMatrix& localMatrix)
- : fColor(color)
+ : INHERITED(kGrPathProcessor_ClassID)
+ , fColor(color)
, fViewMatrix(viewMatrix)
- , fLocalMatrix(localMatrix) {
- this->initClassID<GrPathProcessor>();
-}
+ , fLocalMatrix(localMatrix) {}
void GrPathProcessor::getGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index eb59d98b15..375b5129ba 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -52,6 +52,9 @@ public:
InputRate fInputRate;
};
+ GrPrimitiveProcessor(ClassID classID)
+ : GrResourceIOProcessor(classID) {}
+
int numAttribs() const { return fAttribs.count(); }
const Attribute& getAttrib(int index) const { return fAttribs[index]; }
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index b8ca63e7a9..89a31717df 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -115,8 +115,6 @@ public:
};
}
-int32_t GrProcessor::gCurrProcessorClassID = GrProcessor::kIllegalProcessorClassID;
-
///////////////////////////////////////////////////////////////////////////////
void* GrProcessor::operator new(size_t size) { return MemoryPoolAccessor().pool()->allocate(size); }
diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h
index de0598fed9..7f513169f8 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -64,6 +64,96 @@ private:
*/
class GrProcessor {
public:
+ enum ClassID {
+ kAARectEffect_ClassID,
+ kArithmeticFP_ClassID,
+ kBigKeyProcessor_ClassID,
+ kBlockInputFragmentProcessor_ClassID,
+ kCircleGeometryProcessor_ClassID,
+ kCircleInside2PtConicalEffect_ClassID,
+ kCircleOutside2PtConicalEffect_ClassID,
+ kCircularRRectEffect_ClassID,
+ kColorMatrixEffect_ClassID,
+ kColorTableEffect_ClassID,
+ kComposeOneFragmentProcessor_ClassID,
+ kComposeTwoFragmentProcessor_ClassID,
+ kCoverageSetOpXP_ClassID,
+ kCustomXP_ClassID,
+ kDashingCircleEffect_ClassID,
+ kDashingLineEffect_ClassID,
+ kDefaultGeoProc_ClassID,
+ kDIEllipseGeometryProcessor_ClassID,
+ kDisableColorXP_ClassID,
+ kEdge2PtConicalEffect_ClassID,
+ kEllipseGeometryProcessor_ClassID,
+ kEllipticalRRectEffect_ClassID,
+ kFocalInside2PtConicalEffect_ClassID,
+ kFocalOutside2PtConicalEffect_ClassID,
+ kGP_ClassID,
+ kGrAlphaThresholdFragmentProcessor_ClassID,
+ kGrBicubicEffect_ClassID,
+ kGrBitmapTextGeoProc_ClassID,
+ kGrBlurredEdgeFragmentProcessor_ClassID,
+ kGrCCPRCoverageProcessor_ClassID,
+ kGrCCPRPathProcessor_ClassID,
+ kGrCircleBlurFragmentProcessor_ClassID,
+ kGrCircleEffect_ClassID,
+ kGrConfigConversionEffect_ClassID,
+ kGrConicEffect_ClassID,
+ kGrConstColorProcessor_ClassID,
+ kGrConvexPolyEffect_ClassID,
+ kGrCubicEffect_ClassID,
+ kGrDeviceSpaceTextureDecalFragmentProcessor_ClassID,
+ kGrDiffuseLightingEffect_ClassID,
+ kGrDisplacementMapEffect_ClassID,
+ kGrDistanceFieldA8TextGeoProc_ClassID,
+ kGrDistanceFieldLCDTextGeoProc_ClassID,
+ kGrDistanceFieldPathGeoProc_ClassID,
+ kGrDitherEffect_ClassID,
+ kGrEllipseEffect_ClassID,
+ kGrGaussianConvolutionFragmentProcessor_ClassID,
+ kGrImprovedPerlinNoiseEffect_ClassID,
+ kGrLightingEffect_ClassID,
+ kGrLinearGradient_ClassID,
+ kGrMagnifierEffect_ClassID,
+ kGrMatrixConvolutionEffect_ClassID,
+ kGrMeshTestProcessor_ClassID,
+ kGrMorphologyEffect_ClassID,
+ kGrNonlinearColorSpaceXformEffect_ClassID,
+ kGrPathProcessor_ClassID,
+ kGrPerlinNoise2Effect_ClassID,
+ kGrPipelineDynamicStateTestProcessor_ClassID,
+ kGrQuadEffect_ClassID,
+ kGrRadialGradient_ClassID,
+ kGrRectBlurEffect_ClassID,
+ kGrRRectBlurEffect_ClassID,
+ kGrRRectShadowGeoProc_ClassID,
+ kGrSimpleTextureEffect_ClassID,
+ kGrSpecularLightingEffect_ClassID,
+ kGrSRGBEffect_ClassID,
+ kGrSweepGradient_ClassID,
+ kGrTextureDomainEffect_ClassID,
+ kHighContrastFilterEffect_ClassID,
+ kInstanceProcessor_ClassID,
+ kLumaColorFilterEffect_ClassID,
+ kMSAAQuadProcessor_ClassID,
+ kOverdrawFragmentProcessor_ClassID,
+ kPDLCDXferProcessor_ClassID,
+ kPorterDuffXferProcessor_ClassID,
+ kPremulFragmentProcessor_ClassID,
+ kPremulInputFragmentProcessor_ClassID,
+ kQuadEdgeEffect_ClassID,
+ kReplaceInputFragmentProcessor_ClassID,
+ kRRectsGaussianEdgeFP_ClassID,
+ kSeriesFragmentProcessor_ClassID,
+ kShaderPDXferProcessor_ClassID,
+ kSwizzleFragmentProcessor_ClassID,
+ kTestFP_ClassID,
+ kTextureGeometryProcessor_ClassID,
+ kUnpremulInputFragmentProcessor_ClassID,
+ kYUVtoRGBEffect_ClassID
+ };
+
virtual ~GrProcessor() = default;
/** Human-meaningful string to identify this prcoessor; may be embedded in generated shader
@@ -102,10 +192,12 @@ public:
/** Helper for down-casting to a GrProcessor subclass */
template <typename T> const T& cast() const { return *static_cast<const T*>(this); }
- uint32_t classID() const { SkASSERT(kIllegalProcessorClassID != fClassID); return fClassID; }
+ ClassID classID() const { return fClassID; }
protected:
- GrProcessor() : fClassID(kIllegalProcessorClassID), fRequiredFeatures(kNone_RequiredFeatures) {}
+ GrProcessor(ClassID classID)
+ : fClassID(classID)
+ , fRequiredFeatures(kNone_RequiredFeatures) {}
/**
* If the prcoessor will generate code that uses platform specific built-in features, then it
@@ -118,34 +210,12 @@ protected:
fRequiredFeatures |= other.fRequiredFeatures;
}
- template <typename PROC_SUBCLASS> void initClassID() {
- static uint32_t kClassID = GenClassID();
- fClassID = kClassID;
- }
-
private:
GrProcessor(const GrProcessor&) = delete;
GrProcessor& operator=(const GrProcessor&) = delete;
- static uint32_t GenClassID() {
- // fCurrProcessorClassID has been initialized to kIllegalProcessorClassID. The
- // atomic inc returns the old value not the incremented value. So we add
- // 1 to the returned value.
- uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrProcessorClassID)) + 1;
- if (!id) {
- SK_ABORT("This should never wrap as it should only be called once for each GrProcessor "
- "subclass.");
- }
- return id;
- }
-
- enum {
- kIllegalProcessorClassID = 0,
- };
- static int32_t gCurrProcessorClassID;
-
- uint32_t fClassID;
- RequiredFeatures fRequiredFeatures;
+ ClassID fClassID;
+ RequiredFeatures fRequiredFeatures;
};
GR_MAKE_BITFIELD_OPS(GrProcessor::RequiredFeatures);
@@ -180,7 +250,8 @@ public:
bool instantiate(GrResourceProvider* resourceProvider) const;
protected:
- GrResourceIOProcessor() {}
+ GrResourceIOProcessor(ClassID classID)
+ : INHERITED(classID) {}
/**
* Subclasses call these from their constructor to register sampler/image sources. The processor
diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp
index c7383f2947..8f7377e0b2 100644
--- a/src/gpu/GrXferProcessor.cpp
+++ b/src/gpu/GrXferProcessor.cpp
@@ -9,14 +9,16 @@
#include "GrPipeline.h"
#include "gl/GrGLCaps.h"
-GrXferProcessor::GrXferProcessor()
- : fWillReadDstColor(false)
+GrXferProcessor::GrXferProcessor(ClassID classID)
+ : INHERITED(classID)
+ , fWillReadDstColor(false)
, fDstReadUsesMixedSamples(false)
, fIsLCD(false) {}
-GrXferProcessor::GrXferProcessor(bool willReadDstColor, bool hasMixedSamples,
+GrXferProcessor::GrXferProcessor(ClassID classID, bool willReadDstColor, bool hasMixedSamples,
GrProcessorAnalysisCoverage coverage)
- : fWillReadDstColor(willReadDstColor)
+ : INHERITED(classID)
+ , fWillReadDstColor(willReadDstColor)
, fDstReadUsesMixedSamples(willReadDstColor && hasMixedSamples)
, fIsLCD(GrProcessorAnalysisCoverage::kLCD == coverage) {}
diff --git a/src/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h
index 419c83df70..90b0de95df 100644
--- a/src/gpu/GrXferProcessor.h
+++ b/src/gpu/GrXferProcessor.h
@@ -189,8 +189,9 @@ public:
}
protected:
- GrXferProcessor();
- GrXferProcessor(bool willReadDstColor, bool hasMixedSamples, GrProcessorAnalysisCoverage);
+ GrXferProcessor(ClassID classID);
+ GrXferProcessor(ClassID classID, bool willReadDstColor, bool hasMixedSamples,
+ GrProcessorAnalysisCoverage);
private:
/**
@@ -219,7 +220,7 @@ private:
bool fDstReadUsesMixedSamples;
bool fIsLCD;
- typedef GrFragmentProcessor INHERITED;
+ typedef GrProcessor INHERITED;
};
/**
diff --git a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
index 7354c03592..d27ea4c077 100644
--- a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
@@ -42,14 +42,13 @@ const char* GrCCPRCoverageProcessor::GetProcessorName(Mode mode) {
}
GrCCPRCoverageProcessor::GrCCPRCoverageProcessor(Mode mode, GrBuffer* pointsBuffer)
- : fMode(mode)
+ : INHERITED(kGrCCPRCoverageProcessor_ClassID)
+ , fMode(mode)
, fInstanceAttrib(this->addInstanceAttrib("instance", InstanceArrayFormat(mode))) {
fPointsBufferAccess.reset(kRG_float_GrPixelConfig, pointsBuffer, kVertex_GrShaderFlag);
this->addBufferAccess(&fPointsBufferAccess);
this->setWillUseGeoShader();
-
- this->initClassID<GrCCPRCoverageProcessor>();
}
void GrCCPRCoverageProcessor::getGLSLProcessorKey(const GrShaderCaps&,
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
index bac52ce447..585f3beb94 100644
--- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
@@ -50,7 +50,8 @@ GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey);
GrCCPRPathProcessor::GrCCPRPathProcessor(GrResourceProvider* rp, sk_sp<GrTextureProxy> atlas,
SkPath::FillType fillType, const GrShaderCaps& shaderCaps)
- : fFillType(fillType) {
+ : INHERITED(kGrCCPRPathProcessor_ClassID)
+ , fFillType(fillType) {
this->addInstanceAttrib("devbounds", kFloat4_GrVertexAttribType);
this->addInstanceAttrib("devbounds45", kFloat4_GrVertexAttribType);
this->addInstanceAttrib("view_matrix", kFloat4_GrVertexAttribType);
@@ -82,8 +83,6 @@ GrCCPRPathProcessor::GrCCPRPathProcessor(GrResourceProvider* rp, sk_sp<GrTexture
GrSamplerState::WrapMode::kClamp, kFragment_GrShaderFlag);
fAtlasAccess.instantiate(rp);
this->addTextureSampler(&fAtlasAccess);
-
- this->initClassID<GrCCPRPathProcessor>();
}
void GrCCPRPathProcessor::getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const {
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 354bc67bda..0b4ee0758b 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -234,13 +234,13 @@ GrGLSLPrimitiveProcessor* GrConicEffect::createGLSLInstance(const GrShaderCaps&)
GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
GrPrimitiveEdgeType edgeType, const SkMatrix& localMatrix,
bool usesLocalCoords)
- : fColor(color)
+ : INHERITED(kGrConicEffect_ClassID)
+ , fColor(color)
, fViewMatrix(viewMatrix)
, fLocalMatrix(viewMatrix)
, fUsesLocalCoords(usesLocalCoords)
, fCoverageScale(coverage)
, fEdgeType(edgeType) {
- this->initClassID<GrConicEffect>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInConicCoeffs = &this->addVertexAttrib("inConicCoeffs", kHalf4_GrVertexAttribType);
}
@@ -436,13 +436,13 @@ GrGLSLPrimitiveProcessor* GrQuadEffect::createGLSLInstance(const GrShaderCaps&)
GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t coverage,
GrPrimitiveEdgeType edgeType, const SkMatrix& localMatrix,
bool usesLocalCoords)
- : fColor(color)
+ : INHERITED(kGrQuadEffect_ClassID)
+ , fColor(color)
, fViewMatrix(viewMatrix)
, fLocalMatrix(localMatrix)
, fUsesLocalCoords(usesLocalCoords)
, fCoverageScale(coverage)
, fEdgeType(edgeType) {
- this->initClassID<GrQuadEffect>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInHairQuadEdge = &this->addVertexAttrib("inHairQuadEdge", kHalf4_GrVertexAttribType);
}
@@ -663,11 +663,11 @@ GrGLSLPrimitiveProcessor* GrCubicEffect::createGLSLInstance(const GrShaderCaps&)
GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, const SkMatrix&
devKLMMatrix, GrPrimitiveEdgeType edgeType)
- : fColor(color)
+ : INHERITED(kGrCubicEffect_ClassID)
+ , fColor(color)
, fViewMatrix(viewMatrix)
, fDevKLMMatrix(devKLMMatrix)
, fEdgeType(edgeType) {
- this->initClassID<GrCubicEffect>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
}
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 1a93977cf0..e95b7a43b9 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -134,13 +134,12 @@ GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& matrix,
const GrSamplerState::WrapMode wrapModes[2])
- : INHERITED{ModulateByConfigOptimizationFlags(proxy->config())}
+ : INHERITED{kGrBicubicEffect_ClassID, ModulateByConfigOptimizationFlags(proxy->config())}
, fCoordTransform(matrix, proxy.get())
, fDomain(GrTextureDomain::IgnoredDomain())
, fTextureSampler(std::move(proxy),
GrSamplerState(wrapModes, GrSamplerState::Filter::kNearest))
, fColorSpaceXform(std::move(colorSpaceXform)) {
- this->initClassID<GrBicubicEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
@@ -149,23 +148,21 @@ GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& matrix,
const SkRect& domain)
- : INHERITED(ModulateByConfigOptimizationFlags(proxy->config()))
+ : INHERITED(kGrBicubicEffect_ClassID, ModulateByConfigOptimizationFlags(proxy->config()))
, fCoordTransform(matrix, proxy.get())
, fDomain(proxy.get(), domain, GrTextureDomain::kClamp_Mode)
, fTextureSampler(std::move(proxy))
, fColorSpaceXform(std::move(colorSpaceXform)) {
- this->initClassID<GrBicubicEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
GrBicubicEffect::GrBicubicEffect(const GrBicubicEffect& that)
- : INHERITED(that.optimizationFlags())
+ : INHERITED(kGrBicubicEffect_ClassID, that.optimizationFlags())
, fCoordTransform(that.fCoordTransform)
, fDomain(that.fDomain)
, fTextureSampler(that.fTextureSampler)
, fColorSpaceXform(that.fColorSpaceXform) {
- this->initClassID<GrBicubicEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 4370219f67..ddf882ee16 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -124,12 +124,12 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color,
const sk_sp<GrTextureProxy> proxies[kMaxTextures],
const GrSamplerState& params, GrMaskFormat format,
const SkMatrix& localMatrix, bool usesLocalCoords)
- : fColor(color)
+ : INHERITED(kGrBitmapTextGeoProc_ClassID)
+ , fColor(color)
, fLocalMatrix(localMatrix)
, fUsesLocalCoords(usesLocalCoords)
, fInColor(nullptr)
, fMaskFormat(format) {
- this->initClassID<GrBitmapTextGeoProc>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat ||
diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
index 1f894cca33..551adeac8f 100644
--- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
@@ -52,9 +52,8 @@ bool GrBlurredEdgeFragmentProcessor::onIsEqual(const GrFragmentProcessor& other)
}
GrBlurredEdgeFragmentProcessor::GrBlurredEdgeFragmentProcessor(
const GrBlurredEdgeFragmentProcessor& src)
- : INHERITED(src.optimizationFlags()), fMode(src.fMode) {
- this->initClassID<GrBlurredEdgeFragmentProcessor>();
-}
+ : INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, src.optimizationFlags())
+ , fMode(src.fMode) {}
std::unique_ptr<GrFragmentProcessor> GrBlurredEdgeFragmentProcessor::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrBlurredEdgeFragmentProcessor(*this));
}
diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h
index 61cc53baa5..e27905ca29 100644
--- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h
+++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h
@@ -27,9 +27,9 @@ public:
const char* name() const override { return "BlurredEdgeFragmentProcessor"; }
private:
- GrBlurredEdgeFragmentProcessor(int mode) : INHERITED(kNone_OptimizationFlags), fMode(mode) {
- this->initClassID<GrBlurredEdgeFragmentProcessor>();
- }
+ GrBlurredEdgeFragmentProcessor(int mode)
+ : INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, kNone_OptimizationFlags)
+ , fMode(mode) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
diff --git a/src/gpu/effects/GrCircleEffect.cpp b/src/gpu/effects/GrCircleEffect.cpp
index ef4f9137ba..3c0e11b621 100644
--- a/src/gpu/effects/GrCircleEffect.cpp
+++ b/src/gpu/effects/GrCircleEffect.cpp
@@ -90,12 +90,10 @@ bool GrCircleEffect::onIsEqual(const GrFragmentProcessor& other) const {
return true;
}
GrCircleEffect::GrCircleEffect(const GrCircleEffect& src)
- : INHERITED(src.optimizationFlags())
+ : INHERITED(kGrCircleEffect_ClassID, src.optimizationFlags())
, fEdgeType(src.fEdgeType)
, fCenter(src.fCenter)
- , fRadius(src.fRadius) {
- this->initClassID<GrCircleEffect>();
-}
+ , fRadius(src.fRadius) {}
std::unique_ptr<GrFragmentProcessor> GrCircleEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrCircleEffect(*this));
}
diff --git a/src/gpu/effects/GrCircleEffect.h b/src/gpu/effects/GrCircleEffect.h
index 0d88dcb099..7f115050bf 100644
--- a/src/gpu/effects/GrCircleEffect.h
+++ b/src/gpu/effects/GrCircleEffect.h
@@ -29,12 +29,11 @@ public:
private:
GrCircleEffect(int edgeType, SkPoint center, float radius)
- : INHERITED((OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrCircleEffect_ClassID,
+ (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fEdgeType(edgeType)
, fCenter(center)
- , fRadius(radius) {
- this->initClassID<GrCircleEffect>();
- }
+ , fRadius(radius) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 2c12c7e8dc..0d2a139816 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -54,9 +54,8 @@ bool GrConfigConversionEffect::onIsEqual(const GrFragmentProcessor& other) const
return true;
}
GrConfigConversionEffect::GrConfigConversionEffect(const GrConfigConversionEffect& src)
- : INHERITED(src.optimizationFlags()), fPmConversion(src.fPmConversion) {
- this->initClassID<GrConfigConversionEffect>();
-}
+ : INHERITED(kGrConfigConversionEffect_ClassID, src.optimizationFlags())
+ , fPmConversion(src.fPmConversion) {}
std::unique_ptr<GrFragmentProcessor> GrConfigConversionEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrConfigConversionEffect(*this));
}
diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h
index f17b32fa0e..470f060d8b 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -139,9 +139,8 @@ public:
private:
GrConfigConversionEffect(int pmConversion)
- : INHERITED(kNone_OptimizationFlags), fPmConversion(pmConversion) {
- this->initClassID<GrConfigConversionEffect>();
- }
+ : INHERITED(kGrConfigConversionEffect_ClassID, kNone_OptimizationFlags)
+ , fPmConversion(pmConversion) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
diff --git a/src/gpu/effects/GrConstColorProcessor.h b/src/gpu/effects/GrConstColorProcessor.h
index 7079a8dffb..1429e9ba77 100644
--- a/src/gpu/effects/GrConstColorProcessor.h
+++ b/src/gpu/effects/GrConstColorProcessor.h
@@ -57,8 +57,10 @@ private:
}
GrConstColorProcessor(GrColor4f color, InputMode mode)
- : INHERITED(OptFlags(color, mode)), fColor(color), fMode(mode) {
- this->initClassID<GrConstColorProcessor>();
+ : INHERITED(kGrConstColorProcessor_ClassID
+ , OptFlags(color, mode))
+ , fColor(color)
+ , fMode(mode) {
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 97f456953d..8528384f13 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -34,10 +34,9 @@ private:
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kAARectEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRect(rect)
, fEdgeType(edgeType) {
- this->initClassID<AARectEffect>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@@ -326,10 +325,9 @@ GrGLSLFragmentProcessor* GrConvexPolyEffect::onCreateGLSLInstance() const {
}
GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, const SkScalar edges[])
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrConvexPolyEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fEdgeType(edgeType)
, fEdgeCount(n) {
- this->initClassID<GrConvexPolyEffect>();
// Factory function should have already ensured this.
SkASSERT(n <= kMaxEdges);
memcpy(fEdges, edges, 3 * n * sizeof(SkScalar));
@@ -341,10 +339,9 @@ GrConvexPolyEffect::GrConvexPolyEffect(GrPrimitiveEdgeType edgeType, int n, cons
}
GrConvexPolyEffect::GrConvexPolyEffect(const GrConvexPolyEffect& that)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrConvexPolyEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fEdgeType(that.fEdgeType)
, fEdgeCount(that.fEdgeCount) {
- this->initClassID<GrConvexPolyEffect>();
memcpy(fEdges, that.fEdges, 3 * that.fEdgeCount * sizeof(SkScalar));
}
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index 0e7dcf7359..2524c9c298 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -19,9 +19,9 @@
class CoverageSetOpXP : public GrXferProcessor {
public:
CoverageSetOpXP(SkRegion::Op regionOp, bool invertCoverage)
- : fRegionOp(regionOp), fInvertCoverage(invertCoverage) {
- this->initClassID<CoverageSetOpXP>();
- }
+ : INHERITED(kCoverageSetOpXP_ClassID)
+ , fRegionOp(regionOp)
+ , fInvertCoverage(invertCoverage) {}
const char* name() const override { return "Coverage Set Op"; }
diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp
index 94d8ce23d9..98bda3e5e6 100644
--- a/src/gpu/effects/GrCustomXfermode.cpp
+++ b/src/gpu/effects/GrCustomXfermode.cpp
@@ -72,16 +72,14 @@ static bool can_use_hw_blend_equation(GrBlendEquation equation,
class CustomXP : public GrXferProcessor {
public:
CustomXP(SkBlendMode mode, GrBlendEquation hwBlendEquation)
- : fMode(mode)
- , fHWBlendEquation(hwBlendEquation) {
- this->initClassID<CustomXP>();
- }
+ : INHERITED(kCustomXP_ClassID)
+ , fMode(mode)
+ , fHWBlendEquation(hwBlendEquation) {}
CustomXP(bool hasMixedSamples, SkBlendMode mode, GrProcessorAnalysisCoverage coverage)
- : INHERITED(true, hasMixedSamples, coverage)
+ : INHERITED(kCustomXP_ClassID, true, hasMixedSamples, coverage)
, fMode(mode)
, fHWBlendEquation(static_cast<GrBlendEquation>(-1)) {
- this->initClassID<CustomXP>();
}
const char* name() const override { return "Custom Xfermode"; }
diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp
index a0beecdf2d..314be6ee13 100644
--- a/src/gpu/effects/GrDisableColorXP.cpp
+++ b/src/gpu/effects/GrDisableColorXP.cpp
@@ -18,7 +18,8 @@
*/
class DisableColorXP : public GrXferProcessor {
public:
- DisableColorXP() { this->initClassID<DisableColorXP>(); }
+ DisableColorXP()
+ : INHERITED(kDisableColorXP_ClassID) {}
const char* name() const override { return "Disable Color"; }
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index dcbb5d5df9..6cffd9d465 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -237,7 +237,8 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(
#endif
uint32_t flags,
bool usesLocalCoords)
- : fColor(color)
+ : INHERITED(kGrDistanceFieldA8TextGeoProc_ClassID)
+ , fColor(color)
, fViewMatrix(viewMatrix)
#ifdef SK_GAMMA_APPLY_TO_A8
, fDistanceAdjust(distanceAdjust)
@@ -246,7 +247,6 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(
, fInColor(nullptr)
, fUsesLocalCoords(usesLocalCoords) {
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
- this->initClassID<GrDistanceFieldA8TextGeoProc>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType);
@@ -498,13 +498,13 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(
const GrSamplerState& params,
uint32_t flags,
bool usesLocalCoords)
- : fColor(color)
+ : INHERITED(kGrDistanceFieldPathGeoProc_ClassID)
+ , fColor(color)
, fViewMatrix(viewMatrix)
, fFlags(flags & kNonLCD_DistanceFieldEffectMask)
, fInColor(nullptr)
, fUsesLocalCoords(usesLocalCoords) {
SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask));
- this->initClassID<GrDistanceFieldPathGeoProc>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType);
@@ -817,13 +817,13 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
const GrSamplerState& params,
DistanceAdjust distanceAdjust,
uint32_t flags, bool usesLocalCoords)
- : fColor(color)
+ : INHERITED(kGrDistanceFieldLCDTextGeoProc_ClassID)
+ , fColor(color)
, fViewMatrix(viewMatrix)
, fDistanceAdjust(distanceAdjust)
, fFlags(flags & kLCD_DistanceFieldEffectMask)
, fUsesLocalCoords(usesLocalCoords) {
SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_DistanceFieldEffectFlag));
- this->initClassID<GrDistanceFieldLCDTextGeoProc>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
fInTextureCoords = &this->addVertexAttrib("inTextureCoords", kUShort2_GrVertexAttribType);
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 158c47e86d..53aa0d2b24 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -60,9 +60,7 @@ bool GrDitherEffect::onIsEqual(const GrFragmentProcessor& other) const {
return true;
}
GrDitherEffect::GrDitherEffect(const GrDitherEffect& src)
- : INHERITED(src.optimizationFlags()), fRangeType(src.fRangeType) {
- this->initClassID<GrDitherEffect>();
-}
+ : INHERITED(kGrDitherEffect_ClassID, src.optimizationFlags()), fRangeType(src.fRangeType) {}
std::unique_ptr<GrFragmentProcessor> GrDitherEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrDitherEffect(*this));
}
diff --git a/src/gpu/effects/GrDitherEffect.h b/src/gpu/effects/GrDitherEffect.h
index d428c3ced1..fb60b5aca2 100644
--- a/src/gpu/effects/GrDitherEffect.h
+++ b/src/gpu/effects/GrDitherEffect.h
@@ -51,9 +51,8 @@ public:
const char* name() const override { return "DitherEffect"; }
private:
- GrDitherEffect(int rangeType) : INHERITED(kNone_OptimizationFlags), fRangeType(rangeType) {
- this->initClassID<GrDitherEffect>();
- }
+ GrDitherEffect(int rangeType)
+ : INHERITED(kGrDitherEffect_ClassID, kNone_OptimizationFlags), fRangeType(rangeType) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
diff --git a/src/gpu/effects/GrEllipseEffect.cpp b/src/gpu/effects/GrEllipseEffect.cpp
index 0790211e8c..a79ec1c76f 100644
--- a/src/gpu/effects/GrEllipseEffect.cpp
+++ b/src/gpu/effects/GrEllipseEffect.cpp
@@ -114,12 +114,10 @@ bool GrEllipseEffect::onIsEqual(const GrFragmentProcessor& other) const {
return true;
}
GrEllipseEffect::GrEllipseEffect(const GrEllipseEffect& src)
- : INHERITED(src.optimizationFlags())
+ : INHERITED(kGrEllipseEffect_ClassID, src.optimizationFlags())
, fEdgeType(src.fEdgeType)
, fCenter(src.fCenter)
- , fRadii(src.fRadii) {
- this->initClassID<GrEllipseEffect>();
-}
+ , fRadii(src.fRadii) {}
std::unique_ptr<GrFragmentProcessor> GrEllipseEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrEllipseEffect(*this));
}
diff --git a/src/gpu/effects/GrEllipseEffect.h b/src/gpu/effects/GrEllipseEffect.h
index 1425f39945..98f44a995a 100644
--- a/src/gpu/effects/GrEllipseEffect.h
+++ b/src/gpu/effects/GrEllipseEffect.h
@@ -29,12 +29,11 @@ public:
private:
GrEllipseEffect(int edgeType, SkPoint center, SkPoint radii)
- : INHERITED((OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrEllipseEffect_ClassID,
+ (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fEdgeType(edgeType)
, fCenter(center)
- , fRadii(radii) {
- this->initClassID<GrEllipseEffect>();
- }
+ , fRadii(radii) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
bool onIsEqual(const GrFragmentProcessor&) const override;
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index ee27aa82b5..5fae103498 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -201,13 +201,13 @@ GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
float gaussianSigma,
GrTextureDomain::Mode mode,
int bounds[2])
- : INHERITED(ModulateByConfigOptimizationFlags(proxy->config()))
+ : INHERITED(kGrGaussianConvolutionFragmentProcessor_ClassID,
+ ModulateByConfigOptimizationFlags(proxy->config()))
, fCoordTransform(proxy.get())
, fTextureSampler(std::move(proxy))
, fRadius(radius)
, fDirection(direction)
, fMode(mode) {
- this->initClassID<GrGaussianConvolutionFragmentProcessor>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
SkASSERT(radius <= kMaxKernelRadius);
@@ -219,13 +219,12 @@ GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
const GrGaussianConvolutionFragmentProcessor& that)
- : INHERITED(that.optimizationFlags())
+ : INHERITED(kGrGaussianConvolutionFragmentProcessor_ClassID, that.optimizationFlags())
, fCoordTransform(that.fCoordTransform)
, fTextureSampler(that.fTextureSampler)
, fRadius(that.fRadius)
, fDirection(that.fDirection)
, fMode(that.fMode) {
- this->initClassID<GrGaussianConvolutionFragmentProcessor>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
memcpy(fKernel, that.fKernel, that.width() * sizeof(float));
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 73fce4d630..ffbcf500ab 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -155,7 +155,7 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy
bool convolveAlpha)
// To advertise either the modulation or opaqueness optimizations we'd have to examine the
// parameters.
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kGrMatrixConvolutionEffect_ClassID, kNone_OptimizationFlags)
, fCoordTransform(proxy.get())
, fDomain(proxy.get(), GrTextureDomain::MakeTexelDomainForMode(bounds, tileMode), tileMode)
, fTextureSampler(std::move(proxy))
@@ -163,7 +163,6 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy
, fGain(SkScalarToFloat(gain))
, fBias(SkScalarToFloat(bias) / 255.0f)
, fConvolveAlpha(convolveAlpha) {
- this->initClassID<GrMatrixConvolutionEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
for (int i = 0; i < kernelSize.width() * kernelSize.height(); i++) {
@@ -174,7 +173,7 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy
}
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(const GrMatrixConvolutionEffect& that)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kGrMatrixConvolutionEffect_ClassID, kNone_OptimizationFlags)
, fCoordTransform(that.fCoordTransform)
, fDomain(that.fDomain)
, fTextureSampler(that.fTextureSampler)
@@ -182,7 +181,6 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(const GrMatrixConvolutionEf
, fGain(that.fGain)
, fBias(that.fBias)
, fConvolveAlpha(that.fConvolveAlpha) {
- this->initClassID<GrMatrixConvolutionEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
memcpy(fKernel, that.fKernel, sizeof(float) * fKernelSize.width() * fKernelSize.height());
diff --git a/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp b/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
index fee7f17992..7bdb04ec59 100644
--- a/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
+++ b/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
@@ -138,10 +138,10 @@ private:
GrNonlinearColorSpaceXformEffect::GrNonlinearColorSpaceXformEffect(
uint32_t ops, const SkColorSpaceTransferFn& srcTransferFn,
const SkColorSpaceTransferFn& dstTransferFn, const SkMatrix44& gamutXform)
- : INHERITED(kPreservesOpaqueInput_OptimizationFlag)
+ : INHERITED(kGrNonlinearColorSpaceXformEffect_ClassID,
+ kPreservesOpaqueInput_OptimizationFlag)
, fGamutXform(gamutXform)
, fOps(ops) {
- this->initClassID<GrNonlinearColorSpaceXformEffect>();
fSrcTransferFnCoeffs[0] = srcTransferFn.fA;
fSrcTransferFnCoeffs[1] = srcTransferFn.fB;
@@ -162,10 +162,10 @@ GrNonlinearColorSpaceXformEffect::GrNonlinearColorSpaceXformEffect(
GrNonlinearColorSpaceXformEffect::GrNonlinearColorSpaceXformEffect(
const GrNonlinearColorSpaceXformEffect& that)
- : INHERITED(kPreservesOpaqueInput_OptimizationFlag)
+ : INHERITED(kGrNonlinearColorSpaceXformEffect_ClassID,
+ kPreservesOpaqueInput_OptimizationFlag)
, fGamutXform(that.fGamutXform)
, fOps(that.fOps) {
- this->initClassID<GrNonlinearColorSpaceXformEffect>();
memcpy(fSrcTransferFnCoeffs, that.fSrcTransferFnCoeffs, sizeof(fSrcTransferFnCoeffs));
memcpy(fDstTransferFnCoeffs, that.fDstTransferFnCoeffs, sizeof(fDstTransferFnCoeffs));
}
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index 4f23bdcf29..f4af7a4679 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -397,9 +397,8 @@ static BlendFormula get_lcd_blend_formula(SkBlendMode xfermode) {
class PorterDuffXferProcessor : public GrXferProcessor {
public:
PorterDuffXferProcessor(BlendFormula blendFormula, GrProcessorAnalysisCoverage coverage)
- : INHERITED(false, false, coverage)
+ : INHERITED(kPorterDuffXferProcessor_ClassID, false, false, coverage)
, fBlendFormula(blendFormula) {
- this->initClassID<PorterDuffXferProcessor>();
}
const char* name() const override { return "Porter Duff"; }
@@ -509,8 +508,8 @@ class ShaderPDXferProcessor : public GrXferProcessor {
public:
ShaderPDXferProcessor(bool hasMixedSamples, SkBlendMode xfermode,
GrProcessorAnalysisCoverage coverage)
- : INHERITED(true, hasMixedSamples, coverage), fXfermode(xfermode) {
- this->initClassID<ShaderPDXferProcessor>();
+ : INHERITED(kShaderPDXferProcessor_ClassID, true, hasMixedSamples, coverage)
+ , fXfermode(xfermode) {
}
const char* name() const override { return "Porter Duff Shader"; }
@@ -656,10 +655,9 @@ private:
///////////////////////////////////////////////////////////////////////////////
PDLCDXferProcessor::PDLCDXferProcessor(GrColor blendConstant, uint8_t alpha)
- : INHERITED(false, false, GrProcessorAnalysisCoverage::kLCD)
+ : INHERITED(kPDLCDXferProcessor_ClassID, false, false, GrProcessorAnalysisCoverage::kLCD)
, fBlendConstant(blendConstant)
, fAlpha(alpha) {
- this->initClassID<PDLCDXferProcessor>();
}
sk_sp<const GrXferProcessor> PDLCDXferProcessor::Make(SkBlendMode mode,
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 7ad354cee3..8df9bcb206 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -90,11 +90,10 @@ std::unique_ptr<GrFragmentProcessor> CircularRRectEffect::Make(GrPrimitiveEdgeTy
CircularRRectEffect::CircularRRectEffect(GrPrimitiveEdgeType edgeType, uint32_t circularCornerFlags,
const SkRRect& rrect)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kCircularRRectEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRRect(rrect)
, fEdgeType(edgeType)
, fCircularCornerFlags(circularCornerFlags) {
- this->initClassID<CircularRRectEffect>();
}
std::unique_ptr<GrFragmentProcessor> CircularRRectEffect::clone() const {
@@ -425,10 +424,9 @@ std::unique_ptr<GrFragmentProcessor> EllipticalRRectEffect::Make(GrPrimitiveEdge
}
EllipticalRRectEffect::EllipticalRRectEffect(GrPrimitiveEdgeType edgeType, const SkRRect& rrect)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kEllipticalRRectEffect_ClassID, kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fRRect(rrect)
, fEdgeType(edgeType) {
- this->initClassID<EllipticalRRectEffect>();
}
std::unique_ptr<GrFragmentProcessor> EllipticalRRectEffect::clone() const {
diff --git a/src/gpu/effects/GrSRGBEffect.cpp b/src/gpu/effects/GrSRGBEffect.cpp
index 0e56dfcdb9..7e823eaae7 100644
--- a/src/gpu/effects/GrSRGBEffect.cpp
+++ b/src/gpu/effects/GrSRGBEffect.cpp
@@ -77,12 +77,11 @@ private:
///////////////////////////////////////////////////////////////////////////////
GrSRGBEffect::GrSRGBEffect(Mode mode, Alpha alpha)
- : INHERITED(kPreservesOpaqueInput_OptimizationFlag |
+ : INHERITED(kGrSRGBEffect_ClassID, kPreservesOpaqueInput_OptimizationFlag |
kConstantOutputForConstantInput_OptimizationFlag)
, fMode(mode)
, fAlpha(alpha)
{
- this->initClassID<GrSRGBEffect>();
}
std::unique_ptr<GrFragmentProcessor> GrSRGBEffect::clone() const { return Make(fMode, fAlpha); }
diff --git a/src/gpu/effects/GrShadowGeoProc.cpp b/src/gpu/effects/GrShadowGeoProc.cpp
index 3217f46303..682486bc09 100644
--- a/src/gpu/effects/GrShadowGeoProc.cpp
+++ b/src/gpu/effects/GrShadowGeoProc.cpp
@@ -63,8 +63,8 @@ private:
///////////////////////////////////////////////////////////////////////////////
-GrRRectShadowGeoProc::GrRRectShadowGeoProc() {
- this->initClassID<GrRRectShadowGeoProc>();
+GrRRectShadowGeoProc::GrRRectShadowGeoProc()
+: INHERITED(kGrRRectShadowGeoProc_ClassID) {
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
fInShadowParams = &this->addVertexAttrib("inShadowParams", kHalf4_GrVertexAttribType);
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index ad2a5339f0..2c44ce4111 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -70,12 +70,11 @@ bool GrSimpleTextureEffect::onIsEqual(const GrFragmentProcessor& other) const {
return true;
}
GrSimpleTextureEffect::GrSimpleTextureEffect(const GrSimpleTextureEffect& src)
- : INHERITED(src.optimizationFlags())
+ : INHERITED(kGrSimpleTextureEffect_ClassID, src.optimizationFlags())
, fImage(src.fImage)
, fColorXform(src.fColorXform)
, fMatrix(src.fMatrix)
, fImageCoordTransform(src.fImageCoordTransform) {
- this->initClassID<GrSimpleTextureEffect>();
this->addTextureSampler(&fImage);
this->addCoordTransform(&fImageCoordTransform);
}
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
index 6e8fa28efc..7f98b13fd2 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -56,17 +56,17 @@ public:
private:
GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, sk_sp<GrColorSpaceXform> colorXform,
SkMatrix44 matrix, GrSamplerState samplerParams)
- : INHERITED((OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag |
- (GrPixelConfigIsOpaque(image->config())
- ? kPreservesOpaqueInput_OptimizationFlag
- : kNone_OptimizationFlags))
+ : INHERITED(kGrSimpleTextureEffect_ClassID,
+ (OptimizationFlags)kCompatibleWithCoverageAsAlpha_OptimizationFlag |
+ (GrPixelConfigIsOpaque(image->config())
+ ? kPreservesOpaqueInput_OptimizationFlag
+ : kNone_OptimizationFlags))
, fImage(std::move(image), samplerParams)
, fColorXform(colorXform)
, fMatrix(matrix)
, fImageCoordTransform(matrix, fImage.proxy()) {
this->addTextureSampler(&fImage);
this->addCoordTransform(&fImageCoordTransform);
- this->initClassID<GrSimpleTextureEffect>();
}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 671bec6012..9e4abeb5dd 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -228,25 +228,23 @@ GrTextureDomainEffect::GrTextureDomainEffect(sk_sp<GrTextureProxy> proxy,
const SkRect& domain,
GrTextureDomain::Mode mode,
GrSamplerState::Filter filterMode)
- : INHERITED(OptFlags(proxy->config(), mode))
+ : INHERITED(kGrTextureDomainEffect_ClassID, OptFlags(proxy->config(), mode))
, fCoordTransform(matrix, proxy.get())
, fTextureDomain(proxy.get(), domain, mode)
, fTextureSampler(std::move(proxy), filterMode)
, fColorSpaceXform(std::move(colorSpaceXform)) {
SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
filterMode == GrSamplerState::Filter::kNearest);
- this->initClassID<GrTextureDomainEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
GrTextureDomainEffect::GrTextureDomainEffect(const GrTextureDomainEffect& that)
- : INHERITED(that.optimizationFlags())
+ : INHERITED(kGrTextureDomainEffect_ClassID, that.optimizationFlags())
, fCoordTransform(that.fCoordTransform)
, fTextureDomain(that.fTextureDomain)
, fTextureSampler(that.fTextureSampler)
, fColorSpaceXform(that.fColorSpaceXform) {
- this->initClassID<GrTextureDomainEffect>();
this->addCoordTransform(&fCoordTransform);
this->addTextureSampler(&fTextureSampler);
}
@@ -343,23 +341,23 @@ std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor:
GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentProcessor(
sk_sp<GrTextureProxy> proxy, const SkIRect& subset, const SkIPoint& deviceSpaceOffset)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrDeviceSpaceTextureDecalFragmentProcessor_ClassID,
+ kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fTextureSampler(proxy, GrSamplerState::ClampNearest())
, fTextureDomain(proxy.get(), GrTextureDomain::MakeTexelDomain(subset),
GrTextureDomain::kDecal_Mode) {
this->addTextureSampler(&fTextureSampler);
fDeviceSpaceOffset.fX = deviceSpaceOffset.fX - subset.fLeft;
fDeviceSpaceOffset.fY = deviceSpaceOffset.fY - subset.fTop;
- this->initClassID<GrDeviceSpaceTextureDecalFragmentProcessor>();
}
GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentProcessor(
const GrDeviceSpaceTextureDecalFragmentProcessor& that)
- : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
+ : INHERITED(kGrDeviceSpaceTextureDecalFragmentProcessor_ClassID,
+ kCompatibleWithCoverageAsAlpha_OptimizationFlag)
, fTextureSampler(that.fTextureSampler)
, fTextureDomain(that.fTextureDomain)
, fDeviceSpaceOffset(that.fDeviceSpaceOffset) {
- this->initClassID<GrDeviceSpaceTextureDecalFragmentProcessor>();
this->addTextureSampler(&fTextureSampler);
}
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
index 11dee67f29..4a92289c7d 100644
--- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
@@ -58,8 +58,8 @@ private:
ComposeTwoFragmentProcessor(std::unique_ptr<GrFragmentProcessor> src,
std::unique_ptr<GrFragmentProcessor> dst,
SkBlendMode mode)
- : INHERITED(OptFlags(src.get(), dst.get(), mode)), fMode(mode) {
- this->initClassID<ComposeTwoFragmentProcessor>();
+ : INHERITED(kComposeTwoFragmentProcessor_ClassID, OptFlags(src.get(), dst.get(), mode))
+ , fMode(mode) {
SkDEBUGCODE(int shaderAChildIndex = )this->registerChildProcessor(std::move(src));
SkDEBUGCODE(int shaderBChildIndex = )this->registerChildProcessor(std::move(dst));
SkASSERT(0 == shaderAChildIndex);
@@ -421,8 +421,9 @@ private:
private:
ComposeOneFragmentProcessor(std::unique_ptr<GrFragmentProcessor> fp, SkBlendMode mode,
Child child)
- : INHERITED(OptFlags(fp.get(), mode, child)), fMode(mode), fChild(child) {
- this->initClassID<ComposeOneFragmentProcessor>();
+ : INHERITED(kComposeOneFragmentProcessor_ClassID, OptFlags(fp.get(), mode, child))
+ , fMode(mode)
+ , fChild(child) {
SkDEBUGCODE(int dstIndex =) this->registerChildProcessor(std::move(fp));
SkASSERT(0 == dstIndex);
}
diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp
index bf9e94ff76..6e0f766071 100644
--- a/src/gpu/effects/GrYUVEffect.cpp
+++ b/src/gpu/effects/GrYUVEffect.cpp
@@ -138,7 +138,7 @@ private:
YUVtoRGBEffect(sk_sp<GrTextureProxy> yProxy, sk_sp<GrTextureProxy> uProxy,
sk_sp<GrTextureProxy> vProxy, const SkMatrix yuvMatrix[3],
GrSamplerState::Filter uvFilterMode, SkYUVColorSpace colorSpace, bool nv12)
- : INHERITED(kPreservesOpaqueInput_OptimizationFlag)
+ : INHERITED(kYUVtoRGBEffect_ClassID, kPreservesOpaqueInput_OptimizationFlag)
, fYTransform(yuvMatrix[0], yProxy.get())
, fYSampler(std::move(yProxy))
, fUTransform(yuvMatrix[1], uProxy.get())
@@ -146,7 +146,6 @@ private:
, fVSampler(vProxy, uvFilterMode)
, fColorSpace(colorSpace)
, fNV12(nv12) {
- this->initClassID<YUVtoRGBEffect>();
this->addCoordTransform(&fYTransform);
this->addTextureSampler(&fYSampler);
this->addCoordTransform(&fUTransform);
@@ -159,7 +158,7 @@ private:
}
YUVtoRGBEffect(const YUVtoRGBEffect& that)
- : INHERITED(kPreservesOpaqueInput_OptimizationFlag)
+ : INHERITED(kYUVtoRGBEffect_ClassID, kPreservesOpaqueInput_OptimizationFlag)
, fYTransform(that.fYTransform)
, fYSampler(that.fYSampler)
, fUTransform(that.fUTransform)
@@ -168,7 +167,6 @@ private:
, fVSampler(that.fVSampler)
, fColorSpace(that.fColorSpace)
, fNV12(that.fNV12) {
- this->initClassID<YUVtoRGBEffect>();
this->addCoordTransform(&fYTransform);
this->addTextureSampler(&fYSampler);
this->addCoordTransform(&fUTransform);
diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp
index 5890028b6a..5332e2dc7e 100644
--- a/src/gpu/instanced/InstanceProcessor.cpp
+++ b/src/gpu/instanced/InstanceProcessor.cpp
@@ -40,9 +40,9 @@ GrCaps::InstancedSupport InstanceProcessor::CheckSupport(const GrShaderCaps& sha
return GrCaps::InstancedSupport::kMixedSampled;
}
-InstanceProcessor::InstanceProcessor(OpInfo opInfo, GrBuffer* paramsBuffer) : fOpInfo(opInfo) {
- this->initClassID<InstanceProcessor>();
-
+InstanceProcessor::InstanceProcessor(OpInfo opInfo, GrBuffer* paramsBuffer)
+: INHERITED(kInstanceProcessor_ClassID)
+, fOpInfo(opInfo) {
this->addVertexAttrib("shapeCoords", kFloat2_GrVertexAttribType);
this->addVertexAttrib("vertexAttrs", kInt_GrVertexAttribType);
this->addVertexAttrib("instanceInfo", kUint_GrVertexAttribType);
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 292f59420a..47c404595e 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -634,8 +634,9 @@ public:
private:
QuadEdgeEffect(const SkMatrix& localMatrix, bool usesLocalCoords)
- : fLocalMatrix(localMatrix), fUsesLocalCoords(usesLocalCoords) {
- this->initClassID<QuadEdgeEffect>();
+ : INHERITED(kQuadEdgeEffect_ClassID)
+ , fLocalMatrix(localMatrix)
+ , fUsesLocalCoords(usesLocalCoords) {
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
fInQuadEdge = &this->addVertexAttrib("inQuadEdge", kHalf4_GrVertexAttribType);
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 8090f43d00..ee87f20688 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -978,11 +978,11 @@ DashingCircleEffect::DashingCircleEffect(GrColor color,
AAMode aaMode,
const SkMatrix& localMatrix,
bool usesLocalCoords)
- : fColor(color)
+ : INHERITED(kDashingCircleEffect_ClassID)
+ , fColor(color)
, fLocalMatrix(localMatrix)
, fUsesLocalCoords(usesLocalCoords)
, fAAMode(aaMode) {
- this->initClassID<DashingCircleEffect>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInDashParams = &this->addVertexAttrib("inDashParams", kHalf3_GrVertexAttribType);
fInCircleParams = &this->addVertexAttrib("inCircleParams", kHalf2_GrVertexAttribType);
@@ -1200,11 +1200,11 @@ DashingLineEffect::DashingLineEffect(GrColor color,
AAMode aaMode,
const SkMatrix& localMatrix,
bool usesLocalCoords)
- : fColor(color)
+ : INHERITED(kDashingLineEffect_ClassID)
+ , fColor(color)
, fLocalMatrix(localMatrix)
, fUsesLocalCoords(usesLocalCoords)
, fAAMode(aaMode) {
- this->initClassID<DashingLineEffect>();
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInDashParams = &this->addVertexAttrib("inDashParams", kHalf3_GrVertexAttribType);
fInRectParams = &this->addVertexAttrib("inRect", kHalf4_GrVertexAttribType);
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index 5c46563316..9021587294 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -197,8 +197,8 @@ public:
private:
MSAAQuadProcessor(const SkMatrix& viewMatrix)
- : fViewMatrix(viewMatrix) {
- this->initClassID<MSAAQuadProcessor>();
+ : INHERITED(kMSAAQuadProcessor_ClassID)
+ , fViewMatrix(viewMatrix) {
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInUV = &this->addVertexAttrib("inUV", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index b29ecf7ee9..da4668fd4d 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -68,8 +68,8 @@ class CircleGeometryProcessor : public GrGeometryProcessor {
public:
CircleGeometryProcessor(bool stroke, bool clipPlane, bool isectPlane, bool unionPlane,
const SkMatrix& localMatrix)
- : fLocalMatrix(localMatrix) {
- this->initClassID<CircleGeometryProcessor>();
+ : INHERITED(kCircleGeometryProcessor_ClassID)
+ , fLocalMatrix(localMatrix) {
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
fInCircleEdge = &this->addVertexAttrib("inCircleEdge", kFloat4_GrVertexAttribType);
@@ -238,8 +238,9 @@ sk_sp<GrGeometryProcessor> CircleGeometryProcessor::TestCreate(GrProcessorTestDa
class EllipseGeometryProcessor : public GrGeometryProcessor {
public:
- EllipseGeometryProcessor(bool stroke, const SkMatrix& localMatrix) : fLocalMatrix(localMatrix) {
- this->initClassID<EllipseGeometryProcessor>();
+ EllipseGeometryProcessor(bool stroke, const SkMatrix& localMatrix)
+ : INHERITED(kEllipseGeometryProcessor_ClassID)
+ , fLocalMatrix(localMatrix) {
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
fInEllipseOffset = &this->addVertexAttrib("inEllipseOffset", kHalf2_GrVertexAttribType);
@@ -379,8 +380,8 @@ enum class DIEllipseStyle { kStroke = 0, kHairline, kFill };
class DIEllipseGeometryProcessor : public GrGeometryProcessor {
public:
DIEllipseGeometryProcessor(const SkMatrix& viewMatrix, DIEllipseStyle style)
- : fViewMatrix(viewMatrix) {
- this->initClassID<DIEllipseGeometryProcessor>();
+ : INHERITED(kDIEllipseGeometryProcessor_ClassID)
+ , fViewMatrix(viewMatrix) {
fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
fInColor = &this->addVertexAttrib("inColor", kUByte4_norm_GrVertexAttribType);
fInEllipseOffsets0 = &this->addVertexAttrib("inEllipseOffsets0", kHalf2_GrVertexAttribType);
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 7ef7757939..ab82a9cc87 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -174,9 +174,9 @@ private:
TextureGeometryProcessor(sk_sp<GrTextureProxy> proxies[], int proxyCnt, int samplerCnt,
sk_sp<GrColorSpaceXform> csxf, const GrSamplerState::Filter filters[],
const GrShaderCaps& caps)
- : fColorSpaceXform(std::move(csxf)) {
+ : INHERITED(kTextureGeometryProcessor_ClassID)
+ , fColorSpaceXform(std::move(csxf)) {
SkASSERT(proxyCnt > 0 && samplerCnt >= proxyCnt);
- this->initClassID<TextureGeometryProcessor>();
fPositions = this->addVertexAttrib("position", kFloat2_GrVertexAttribType);
fSamplers[0].reset(std::move(proxies[0]), filters[0]);
this->addTextureSampler(&fSamplers[0]);
@@ -208,6 +208,8 @@ private:
Attribute fColors;
sk_sp<GrColorSpaceXform> fColorSpaceXform;
TextureSampler fSamplers[1];
+
+ typedef GrGeometryProcessor INHERITED;
};
/**
diff --git a/src/shaders/SkPerlinNoiseShader.cpp b/src/shaders/SkPerlinNoiseShader.cpp
index 1f70d500d5..b1ef1f0a6b 100644
--- a/src/shaders/SkPerlinNoiseShader.cpp
+++ b/src/shaders/SkPerlinNoiseShader.cpp
@@ -741,14 +741,13 @@ private:
sk_sp<GrTextureProxy> permutationsProxy,
sk_sp<GrTextureProxy> noiseProxy,
const SkMatrix& matrix)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kGrPerlinNoise2Effect_ClassID, kNone_OptimizationFlags)
, fType(type)
, fNumOctaves(numOctaves)
, fStitchTiles(stitchTiles)
, fPermutationsSampler(std::move(permutationsProxy))
, fNoiseSampler(std::move(noiseProxy))
, fPaintingData(std::move(paintingData)) {
- this->initClassID<GrPerlinNoise2Effect>();
this->addTextureSampler(&fPermutationsSampler);
this->addTextureSampler(&fNoiseSampler);
fCoordTransform.reset(matrix);
@@ -756,7 +755,7 @@ private:
}
GrPerlinNoise2Effect(const GrPerlinNoise2Effect& that)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kGrPerlinNoise2Effect_ClassID, kNone_OptimizationFlags)
, fType(that.fType)
, fCoordTransform(that.fCoordTransform)
, fNumOctaves(that.fNumOctaves)
@@ -764,7 +763,6 @@ private:
, fPermutationsSampler(that.fPermutationsSampler)
, fNoiseSampler(that.fNoiseSampler)
, fPaintingData(new SkPerlinNoiseShaderImpl::PaintingData(*that.fPaintingData)) {
- this->initClassID<GrPerlinNoise2Effect>();
this->addTextureSampler(&fPermutationsSampler);
this->addTextureSampler(&fNoiseSampler);
this->addCoordTransform(&fCoordTransform);
@@ -1165,13 +1163,12 @@ private:
sk_sp<GrTextureProxy> permutationsProxy,
sk_sp<GrTextureProxy> gradientProxy,
const SkMatrix& matrix)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kGrImprovedPerlinNoiseEffect_ClassID, kNone_OptimizationFlags)
, fOctaves(octaves)
, fZ(z)
, fPermutationsSampler(std::move(permutationsProxy))
, fGradientSampler(std::move(gradientProxy))
, fPaintingData(std::move(paintingData)) {
- this->initClassID<GrImprovedPerlinNoiseEffect>();
this->addTextureSampler(&fPermutationsSampler);
this->addTextureSampler(&fGradientSampler);
fCoordTransform.reset(matrix);
@@ -1179,14 +1176,13 @@ private:
}
GrImprovedPerlinNoiseEffect(const GrImprovedPerlinNoiseEffect& that)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kGrImprovedPerlinNoiseEffect_ClassID, kNone_OptimizationFlags)
, fCoordTransform(that.fCoordTransform)
, fOctaves(that.fOctaves)
, fZ(that.fZ)
, fPermutationsSampler(that.fPermutationsSampler)
, fGradientSampler(that.fGradientSampler)
, fPaintingData(new SkPerlinNoiseShaderImpl::PaintingData(*that.fPaintingData)) {
- this->initClassID<GrImprovedPerlinNoiseEffect>();
this->addTextureSampler(&fPermutationsSampler);
this->addTextureSampler(&fGradientSampler);
this->addCoordTransform(&fCoordTransform);
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index 88990c7aaa..87f191044a 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -1697,8 +1697,8 @@ inline GrFragmentProcessor::OptimizationFlags GrGradientEffect::OptFlags(bool is
: kCompatibleWithCoverageAsAlpha_OptimizationFlag;
}
-GrGradientEffect::GrGradientEffect(const CreateArgs& args, bool isOpaque)
- : INHERITED(OptFlags(isOpaque)) {
+GrGradientEffect::GrGradientEffect(ClassID classID, const CreateArgs& args, bool isOpaque)
+ : INHERITED(classID, OptFlags(isOpaque)) {
const SkGradientShaderBase& shader(*args.fShader);
fIsOpaque = shader.isOpaque();
@@ -1815,7 +1815,7 @@ GrGradientEffect::GrGradientEffect(const CreateArgs& args, bool isOpaque)
}
GrGradientEffect::GrGradientEffect(const GrGradientEffect& that)
- : INHERITED(OptFlags(that.fIsOpaque))
+ : INHERITED(that.classID(), OptFlags(that.fIsOpaque))
, fColors(that.fColors)
, fColors4f(that.fColors4f)
, fColorSpaceXform(that.fColorSpaceXform)
diff --git a/src/shaders/gradients/SkGradientShaderPriv.h b/src/shaders/gradients/SkGradientShaderPriv.h
index c5a9b179ac..30e9440816 100644
--- a/src/shaders/gradients/SkGradientShaderPriv.h
+++ b/src/shaders/gradients/SkGradientShaderPriv.h
@@ -426,7 +426,7 @@ public:
}
protected:
- GrGradientEffect(const CreateArgs&, bool isOpaque);
+ GrGradientEffect(ClassID classID, const CreateArgs&, bool isOpaque);
explicit GrGradientEffect(const GrGradientEffect&); // facilitates clone() implementations
#if GR_TEST_UTILS
diff --git a/src/shaders/gradients/SkLinearGradient.cpp b/src/shaders/gradients/SkLinearGradient.cpp
index 04e82825ca..8b439cef56 100644
--- a/src/shaders/gradients/SkLinearGradient.cpp
+++ b/src/shaders/gradients/SkLinearGradient.cpp
@@ -112,13 +112,10 @@ public:
private:
explicit GrLinearGradient(const CreateArgs& args)
- : INHERITED(args, args.fShader->colorsAreOpaque()) {
- this->initClassID<GrLinearGradient>();
+ : INHERITED(kGrLinearGradient_ClassID, args, args.fShader->colorsAreOpaque()) {
}
- explicit GrLinearGradient(const GrLinearGradient& that) : INHERITED(that) {
- this->initClassID<GrLinearGradient>();
- }
+ explicit GrLinearGradient(const GrLinearGradient& that) : INHERITED(that) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/shaders/gradients/SkRadialGradient.cpp b/src/shaders/gradients/SkRadialGradient.cpp
index 94d823c90c..5c31688b93 100644
--- a/src/shaders/gradients/SkRadialGradient.cpp
+++ b/src/shaders/gradients/SkRadialGradient.cpp
@@ -81,13 +81,9 @@ public:
private:
explicit GrRadialGradient(const CreateArgs& args)
- : INHERITED(args, args.fShader->colorsAreOpaque()) {
- this->initClassID<GrRadialGradient>();
- }
+ : INHERITED(kGrRadialGradient_ClassID, args, args.fShader->colorsAreOpaque()) {}
- explicit GrRadialGradient(const GrRadialGradient& that) : INHERITED(that) {
- this->initClassID<GrRadialGradient>();
- }
+ explicit GrRadialGradient(const GrRadialGradient& that) : INHERITED(that) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/shaders/gradients/SkSweepGradient.cpp b/src/shaders/gradients/SkSweepGradient.cpp
index 0e2b785a52..792024f1c7 100644
--- a/src/shaders/gradients/SkSweepGradient.cpp
+++ b/src/shaders/gradients/SkSweepGradient.cpp
@@ -88,18 +88,14 @@ public:
private:
explicit GrSweepGradient(const CreateArgs& args, SkScalar tBias, SkScalar tScale)
- : INHERITED(args, args.fShader->colorsAreOpaque())
+ : INHERITED(kGrSweepGradient_ClassID, args, args.fShader->colorsAreOpaque())
, fTBias(tBias)
- , fTScale(tScale){
- this->initClassID<GrSweepGradient>();
- }
+ , fTScale(tScale) {}
explicit GrSweepGradient(const GrSweepGradient& that)
: INHERITED(that)
, fTBias(that.fTBias)
- , fTScale(that.fTScale) {
- this->initClassID<GrSweepGradient>();
- }
+ , fTScale(that.fTScale) {}
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/shaders/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/shaders/gradients/SkTwoPointConicalGradient_gpu.cpp
index 37e0708838..a08addbff9 100644
--- a/src/shaders/gradients/SkTwoPointConicalGradient_gpu.cpp
+++ b/src/shaders/gradients/SkTwoPointConicalGradient_gpu.cpp
@@ -93,13 +93,13 @@ private:
}
explicit Edge2PtConicalEffect(const CreateArgs& args)
- : INHERITED(args, false /* opaque: draws transparent black outside of the cone. */) {
+ : INHERITED(kEdge2PtConicalEffect_ClassID, args,
+ false /* opaque: draws transparent black outside of the cone. */) {
const SkTwoPointConicalGradient& shader =
*static_cast<const SkTwoPointConicalGradient*>(args.fShader);
fCenterX1 = shader.getCenterX1();
fRadius0 = shader.getStartRadius();
fDiffRadius = shader.getDiffRadius();
- this->initClassID<Edge2PtConicalEffect>();
// We should only be calling this shader if we are degenerate case with touching circles
// When deciding if we are in edge case, we scaled by the end radius for cases when the
// start radius was close to zero, otherwise we scaled by the start radius. In addition
@@ -129,7 +129,6 @@ private:
, fCenterX1(that.fCenterX1)
, fRadius0(that.fRadius0)
, fDiffRadius(that.fDiffRadius) {
- this->initClassID<Edge2PtConicalEffect>();
this->addCoordTransform(&fBTransform);
}
@@ -415,15 +414,14 @@ private:
}
FocalOutside2PtConicalEffect(const CreateArgs& args, SkScalar focalX)
- : INHERITED(args, false /* opaque: draws transparent black outside of the cone. */)
+ : INHERITED(kFocalOutside2PtConicalEffect_ClassID, args,
+ false /* opaque: draws transparent black outside of the cone. */)
, fFocalX(focalX)
, fIsFlipped(IsFlipped(args)) {
- this->initClassID<FocalOutside2PtConicalEffect>();
}
explicit FocalOutside2PtConicalEffect(const FocalOutside2PtConicalEffect& that)
: INHERITED(that), fFocalX(that.fFocalX), fIsFlipped(that.fIsFlipped) {
- this->initClassID<FocalOutside2PtConicalEffect>();
}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
@@ -630,14 +628,11 @@ private:
}
FocalInside2PtConicalEffect(const CreateArgs& args, SkScalar focalX)
- : INHERITED(args, args.fShader->colorsAreOpaque()), fFocalX(focalX) {
- this->initClassID<FocalInside2PtConicalEffect>();
- }
+ : INHERITED(kFocalInside2PtConicalEffect_ClassID, args,
+ args.fShader->colorsAreOpaque()), fFocalX(focalX) {}
explicit FocalInside2PtConicalEffect(const FocalInside2PtConicalEffect& that)
- : INHERITED(that), fFocalX(that.fFocalX) {
- this->initClassID<FocalInside2PtConicalEffect>();
- }
+ : INHERITED(that), fFocalX(that.fFocalX) {}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
@@ -880,14 +875,12 @@ private:
}
CircleInside2PtConicalEffect(const CreateArgs& args, const CircleConicalInfo& info)
- : INHERITED(args, args.fShader->colorsAreOpaque()), fInfo(info) {
- this->initClassID<CircleInside2PtConicalEffect>();
+ : INHERITED(kCircleInside2PtConicalEffect_ClassID, args,
+ args.fShader->colorsAreOpaque()), fInfo(info) {
}
explicit CircleInside2PtConicalEffect(const CircleInside2PtConicalEffect& that)
- : INHERITED(that), fInfo(that.fInfo) {
- this->initClassID<CircleInside2PtConicalEffect>();
- }
+ : INHERITED(that), fInfo(that.fInfo) {}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
@@ -1103,9 +1096,9 @@ private:
}
CircleOutside2PtConicalEffect(const CreateArgs& args, const CircleConicalInfo& info)
- : INHERITED(args, false /* opaque: draws transparent black outside of the cone. */)
+ : INHERITED(kCircleOutside2PtConicalEffect_ClassID, args,
+ false /* opaque: draws transparent black outside of the cone. */)
, fInfo(info) {
- this->initClassID<CircleOutside2PtConicalEffect>();
const SkTwoPointConicalGradient& shader =
*static_cast<const SkTwoPointConicalGradient*>(args.fShader);
if (shader.getStartRadius() != shader.getEndRadius()) {
@@ -1121,9 +1114,7 @@ private:
: INHERITED(that)
, fInfo(that.fInfo)
, fTLimit(that.fTLimit)
- , fIsFlipped(that.fIsFlipped) {
- this->initClassID<CircleOutside2PtConicalEffect>();
- }
+ , fIsFlipped(that.fIsFlipped) {}
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
diff --git a/src/sksl/SkSLCPPCodeGenerator.cpp b/src/sksl/SkSLCPPCodeGenerator.cpp
index b2227c2112..30661301dc 100644
--- a/src/sksl/SkSLCPPCodeGenerator.cpp
+++ b/src/sksl/SkSLCPPCodeGenerator.cpp
@@ -523,8 +523,8 @@ void CPPCodeGenerator::writeClone() {
"@clone");
}
this->writef("%s::%s(const %s& src)\n"
- ": INHERITED(src.optimizationFlags())", fFullName.c_str(), fFullName.c_str(),
- fFullName.c_str());
+ ": INHERITED(k%s_ClassID, src.optimizationFlags())", fFullName.c_str(),
+ fFullName.c_str(), fFullName.c_str(), fFullName.c_str());
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
String fieldName = HCodeGenerator::FieldName(String(param->fName).c_str());
this->writef("\n, %s(%s)",
@@ -536,9 +536,7 @@ void CPPCodeGenerator::writeClone() {
this->writef("\n, %sCoordTransform(src.%sCoordTransform)", fieldName.c_str(),
fieldName.c_str());
}
- this->writef(" {\n"
- " this->initClassID<%s>();\n",
- fFullName.c_str());
+ this->writef(" {\n");
for (const auto& param : fSectionAndParameterHelper.getParameters()) {
if (param->fType.kind() == Type::kSampler_Kind) {
this->writef(" this->addTextureSampler(&%s);\n",
diff --git a/src/sksl/SkSLHCodeGenerator.cpp b/src/sksl/SkSLHCodeGenerator.cpp
index b06cd0bc06..eb8263187f 100644
--- a/src/sksl/SkSLHCodeGenerator.cpp
+++ b/src/sksl/SkSLHCodeGenerator.cpp
@@ -172,9 +172,9 @@ void HCodeGenerator::writeConstructor() {
}
this->writeSection(CONSTRUCTOR_PARAMS_SECTION, separator);
this->writef(")\n"
- " : INHERITED(");
- if (!this->writeSection(OPTIMIZATION_FLAGS_SECTION, "(OptimizationFlags) ")) {
- this->writef("kNone_OptimizationFlags");
+ " : INHERITED(k%s_ClassID", fFullName.c_str());
+ if (!this->writeSection(OPTIMIZATION_FLAGS_SECTION, ", (OptimizationFlags) ")) {
+ this->writef(", kNone_OptimizationFlags");
}
this->writef(")");
this->writeSection(INITIALIZERS_SECTION, "\n , ");
@@ -211,9 +211,7 @@ void HCodeGenerator::writeConstructor() {
String field = FieldName(s->fArgument.c_str());
this->writef(" this->addCoordTransform(&%sCoordTransform);\n", field.c_str());
}
- this->writef(" this->initClassID<%s>();\n"
- " }\n",
- fFullName.c_str());
+ this->writef(" }\n");
}
void HCodeGenerator::writeFields() {
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 522bb71db7..55ffca911f 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -78,7 +78,7 @@ public:
std::unique_ptr<GrFragmentProcessor> clone() const override { return Make(); }
private:
- BigKeyProcessor() : INHERITED(kNone_OptimizationFlags) { this->initClassID<BigKeyProcessor>(); }
+ BigKeyProcessor() : INHERITED(kBigKeyProcessor_ClassID, kNone_OptimizationFlags) { }
virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const override {
GLBigKeyProcessor::GenKey(*this, caps, b);
@@ -126,8 +126,7 @@ private:
};
BlockInputFragmentProcessor(std::unique_ptr<GrFragmentProcessor> child)
- : INHERITED(kNone_OptimizationFlags) {
- this->initClassID<BlockInputFragmentProcessor>();
+ : INHERITED(kBlockInputFragmentProcessor_ClassID, kNone_OptimizationFlags) {
this->registerChildProcessor(std::move(child));
}
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 1ae3926699..c2b1f2d3a1 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -281,7 +281,8 @@ private:
class GrMeshTestProcessor : public GrGeometryProcessor {
public:
GrMeshTestProcessor(bool instanced, bool hasVertexBuffer)
- : fInstanceLocation(nullptr)
+ : INHERITED(kGrMeshTestProcessor_ClassID)
+ , fInstanceLocation(nullptr)
, fVertex(nullptr)
, fColor(nullptr) {
if (instanced) {
@@ -294,7 +295,6 @@ public:
fVertex = &this->addVertexAttrib("vertex", kHalf2_GrVertexAttribType);
fColor = &this->addVertexAttrib("color", kUByte4_norm_GrVertexAttribType);
}
- this->initClassID<GrMeshTestProcessor>();
}
const char* name() const override { return "GrMeshTest Processor"; }
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index 4b8621db04..6b518abdb2 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -59,10 +59,9 @@ struct Vertex {
class GrPipelineDynamicStateTestProcessor : public GrGeometryProcessor {
public:
GrPipelineDynamicStateTestProcessor()
- : fVertex(this->addVertexAttrib("vertex", kHalf2_GrVertexAttribType))
- , fColor(this->addVertexAttrib("color", kUByte4_norm_GrVertexAttribType)) {
- this->initClassID<GrPipelineDynamicStateTestProcessor>();
- }
+ : INHERITED(kGrPipelineDynamicStateTestProcessor_ClassID)
+ , fVertex(this->addVertexAttrib("vertex", kHalf2_GrVertexAttribType))
+ , fColor(this->addVertexAttrib("color", kUByte4_norm_GrVertexAttribType)) {}
const char* name() const override { return "GrPipelineDynamicStateTest Processor"; }
diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp
index 445a72fcb9..a8704c6264 100644
--- a/tests/ImageStorageTest.cpp
+++ b/tests/ImageStorageTest.cpp
@@ -33,16 +33,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
private:
TestFP(sk_sp<GrTextureProxy> proxy, GrSLMemoryModel mm, GrSLRestrict restrict)
- : INHERITED(kNone_OptimizationFlags)
+ : INHERITED(kTestFP_ClassID, kNone_OptimizationFlags)
, fImageStorageAccess(std::move(proxy), kRead_GrIOType, mm, restrict) {
- this->initClassID<TestFP>();
this->addImageStorageAccess(&fImageStorageAccess);
}
explicit TestFP(const TestFP& that)
- : INHERITED(that.optimizationFlags())
+ : INHERITED(kTestFP_ClassID, that.optimizationFlags())
, fImageStorageAccess(that.fImageStorageAccess) {
- this->initClassID<TestFP>();
this->addImageStorageAccess(&fImageStorageAccess);
}
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 8898e35266..004ec88cc2 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -53,8 +53,8 @@ private:
void onPrepareDraws(Target* target) override {
class GP : public GrGeometryProcessor {
public:
- GP(int numAttribs) {
- this->initClassID<GP>();
+ GP(int numAttribs)
+ : INHERITED(kGP_ClassID) {
SkASSERT(numAttribs > 1);
for (auto i = 0; i < numAttribs; ++i) {
fAttribNames.push_back().printf("attr%d", i);
@@ -89,6 +89,8 @@ private:
private:
SkTArray<SkString> fAttribNames;
+
+ typedef GrGeometryProcessor INHERITED;
};
sk_sp<GrGeometryProcessor> gp(new GP(fNumAttribs));
QuadHelper helper;
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 056302ea66..ba90dc2ca6 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -97,8 +97,8 @@ private:
TestFP(const SkTArray<sk_sp<GrTextureProxy>>& proxies,
const SkTArray<sk_sp<GrBuffer>>& buffers,
const SkTArray<Image>& images)
- : INHERITED(kNone_OptimizationFlags), fSamplers(4), fBuffers(4), fImages(4) {
- this->initClassID<TestFP>();
+ : INHERITED(kTestFP_ClassID, kNone_OptimizationFlags), fSamplers(4), fBuffers(4),
+ fImages(4) {
for (const auto& proxy : proxies) {
this->addTextureSampler(&fSamplers.emplace_back(proxy));
}
@@ -113,14 +113,14 @@ private:
}
TestFP(std::unique_ptr<GrFragmentProcessor> child)
- : INHERITED(kNone_OptimizationFlags), fSamplers(4), fBuffers(4), fImages(4) {
- this->initClassID<TestFP>();
+ : INHERITED(kTestFP_ClassID, kNone_OptimizationFlags), fSamplers(4), fBuffers(4),
+ fImages(4) {
this->registerChildProcessor(std::move(child));
}
explicit TestFP(const TestFP& that)
- : INHERITED(that.optimizationFlags()), fSamplers(4), fBuffers(4), fImages(4) {
- this->initClassID<TestFP>();
+ : INHERITED(kTestFP_ClassID, that.optimizationFlags()), fSamplers(4), fBuffers(4),
+ fImages(4) {
for (int i = 0; i < that.fSamplers.count(); ++i) {
fSamplers.emplace_back(that.fSamplers[i]);
this->addTextureSampler(&fSamplers.back());
diff --git a/tests/SkSLFPTest.cpp b/tests/SkSLFPTest.cpp
index dc9279573d..3e95d9975f 100644
--- a/tests/SkSLFPTest.cpp
+++ b/tests/SkSLFPTest.cpp
@@ -93,8 +93,7 @@ DEF_TEST(SkSLFPHelloWorld, r) {
" const char* name() const override { return \"Test\"; }\n"
"private:\n"
" GrTest()\n"
- " : INHERITED(kNone_OptimizationFlags) {\n"
- " this->initClassID<GrTest>();\n"
+ " : INHERITED(kGrTest_ClassID, kNone_OptimizationFlags) {\n"
" }\n"
" GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;\n"
" void onGetGLSLProcessorKey(const GrShaderCaps&,GrProcessorKeyBuilder*) "
@@ -151,8 +150,7 @@ DEF_TEST(SkSLFPHelloWorld, r) {
" return true;\n"
"}\n"
"GrTest::GrTest(const GrTest& src)\n"
- ": INHERITED(src.optimizationFlags()) {\n"
- " this->initClassID<GrTest>();\n"
+ ": INHERITED(kGrTest_ClassID, src.optimizationFlags()) {\n"
"}\n"
"std::unique_ptr<GrFragmentProcessor> GrTest::clone() const {\n"
" return std::unique_ptr<GrFragmentProcessor>(new GrTest(*this));\n"
@@ -279,7 +277,7 @@ DEF_TEST(SkSLFPSections, r) {
"}",
*SkSL::ShaderCapsFactory::Default(),
{
- ": INHERITED(kNone_OptimizationFlags)\n , initializers section"
+ ": INHERITED(kGrTest_ClassID, kNone_OptimizationFlags)\n , initializers section"
},
{});
test(r,