Remove the CACHE_SANITY_CHECK system.
This was never test and turned on. I tried this a month ago
before the large changes, and it was failing then. I don't think
this tells us anything interesting, and fails if the blob is reused.
Change-Id: I8aadc2be7e6a17d255d681ed9fab04dcbc538991
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258809
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/core/SkGlyphRunPainter.cpp b/src/core/SkGlyphRunPainter.cpp
index b5c2c00..54539a7 100644
--- a/src/core/SkGlyphRunPainter.cpp
+++ b/src/core/SkGlyphRunPainter.cpp
@@ -343,17 +343,6 @@
glyphRunList, target->glyphPainter());
} else {
textBlobCache->makeMRU(cacheBlob.get());
-
- if (CACHE_SANITY_CHECK) {
- sk_sp<GrTextBlob> sanityBlob(textBlobCache->makeBlob(
- glyphRunList, grStrikeCache, viewMatrix, color, forceW));
- sanityBlob->setupKey(key, blurRec, listPaint);
- cacheBlob->generateFromGlyphRunList(
- *context->priv().caps()->shaderCaps(), fOptions,
- listPaint, viewMatrix, props, glyphRunList,
- target->glyphPainter());
- GrTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
- }
}
} else {
if (canCache) {
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 793c848..722ddf6 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -243,10 +243,6 @@
void* allocation = ::operator new (size);
- if (CACHE_SANITY_CHECK) {
- sk_bzero(allocation, size);
- }
-
sk_sp<GrTextBlob> blob{new (allocation) GrTextBlob{
size, strikeCache, viewMatrix, origin, color, forceWForDistanceFields}};
@@ -530,57 +526,6 @@
}
}
-void GrTextBlob::AssertEqual(const GrTextBlob& l, const GrTextBlob& r) {
- SkASSERT_RELEASE(l.fSize == r.fSize);
-
- SkASSERT_RELEASE(l.fBlurRec.fSigma == r.fBlurRec.fSigma);
- SkASSERT_RELEASE(l.fBlurRec.fStyle == r.fBlurRec.fStyle);
-
- SkASSERT_RELEASE(l.fStrokeInfo.fFrameWidth == r.fStrokeInfo.fFrameWidth);
- SkASSERT_RELEASE(l.fStrokeInfo.fMiterLimit == r.fStrokeInfo.fMiterLimit);
- SkASSERT_RELEASE(l.fStrokeInfo.fJoin == r.fStrokeInfo.fJoin);
-
- SkASSERT_RELEASE(l.fKey == r.fKey);
- //SkASSERT_RELEASE(l.fPaintColor == r.fPaintColor); // Colors might not actually be identical
- SkASSERT_RELEASE(l.fMaxMinScale == r.fMaxMinScale);
- SkASSERT_RELEASE(l.fMinMaxScale == r.fMinMaxScale);
- SkASSERT_RELEASE(l.fTextType == r.fTextType);
-
- for(auto t : SkMakeZip(l.fSubRuns, r.fSubRuns)) {
- const SubRun& lSubRun = std::get<0>(t);
- const SubRun& rSubRun = std::get<1>(t);
- SkASSERT(lSubRun.drawAsPaths() == rSubRun.drawAsPaths());
- if (!lSubRun.drawAsPaths()) {
-
- // TODO we can do this check, but we have to apply the VM to the old vertex bounds
- //SkASSERT_RELEASE(lSubRun.vertexBounds() == rSubRun.vertexBounds());
-
- if (lSubRun.strike()) {
- SkASSERT_RELEASE(rSubRun.strike());
- SkASSERT_RELEASE(GrTextStrike::GetKey(*lSubRun.strike()) ==
- GrTextStrike::GetKey(*rSubRun.strike()));
-
- } else {
- SkASSERT_RELEASE(!rSubRun.strike());
- }
-
- SkASSERT_RELEASE(lSubRun.vertexStartIndex() == rSubRun.vertexStartIndex());
- SkASSERT_RELEASE(lSubRun.glyphStartIndex() == rSubRun.glyphStartIndex());
- SkASSERT_RELEASE(lSubRun.maskFormat() == rSubRun.maskFormat());
- SkASSERT_RELEASE(lSubRun.drawAsDistanceFields() == rSubRun.drawAsDistanceFields());
- SkASSERT_RELEASE(lSubRun.hasUseLCDText() == rSubRun.hasUseLCDText());
- } else {
- SkASSERT_RELEASE(lSubRun.fPaths.size() == rSubRun.fPaths.size());
- for(auto p : SkMakeZip(lSubRun.fPaths, rSubRun.fPaths)) {
- const PathGlyph& lPath = std::get<0>(p);
- const PathGlyph& rPath = std::get<1>(p);
- SkASSERT_RELEASE(lPath.fPath == rPath.fPath);
- // We can't assert that these have the same translations
- }
- }
- }
-}
-
void GrTextBlob::initReusableBlob(SkColor luminanceColor) {
fLuminanceColor = luminanceColor;
}
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index 3015fed..f87d8e1 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -32,12 +32,6 @@
class SkTextBlob;
class SkTextBlobRunIterator;
-// With this flag enabled, the GrTextContext will, as a sanity check, regenerate every blob
-// that comes in to verify the integrity of its cache
-// This is of dubious value, and maybe should be removed. I checked it on 11/21/2019, and many
-// tests failed.
-#define CACHE_SANITY_CHECK 0
-
/*
* A GrTextBlob contains a fully processed SkTextBlob, suitable for nearly immediate drawing
* on the GPU. These are initially created with valid positions and colors, but invalid
@@ -48,7 +42,6 @@
* The only thing(aside from a memcopy) required to flush a GrTextBlob is to ensure that
* the GrAtlas will not evict anything the Blob needs.
*
- * *WARNING* If you add new fields to this struct, then you may need to to update AssertEqual
*/
class GrTextBlob final : public SkNVRefCnt<GrTextBlob>, public SkGlyphRunPainterInterface {
public:
@@ -248,8 +241,6 @@
static const int kVerticesPerGlyph = 4;
- static void AssertEqual(const GrTextBlob&, const GrTextBlob&);
-
// This function will only be called when we are generating a blob from scratch.
// The color here is the GrPaint color, and it is used to determine whether we
// have to regenerate LCD text blobs.