diff options
author | 2017-10-09 10:54:08 -0400 | |
---|---|---|
committer | 2017-10-09 15:20:33 +0000 | |
commit | abff956455637b12eab374fd44b99e1338799113 (patch) | |
tree | 77f932f38b3f00f904faeae1c847f1218f61d0c4 /src/gpu/effects/GrConvexPolyEffect.cpp | |
parent | 4e7cdd5a0052aa76bed6f80ec325be19e09e6ab1 (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>
Diffstat (limited to 'src/gpu/effects/GrConvexPolyEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrConvexPolyEffect.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
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)); } |