diff options
author | Robert Phillips <robertphillips@google.com> | 2018-03-01 11:36:45 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-01 19:09:14 +0000 |
commit | c4039ea466d39ede0ea44fc7a18f1174f893f11d (patch) | |
tree | 76666cf5550f484c879b375135c00e72dd9c4336 /src/atlastext | |
parent | 2d0e1248d6eef36ecc510785e9bf8a28530c56fe (diff) |
Fission GrAtlasGlyphCache in two (take 2)
Reland all the things
This CL splits the old GrAtlasGlyphCache into a GrAtlasGlyphCache and an GrAtlasManager.
The GrAtlasManager itself is split into a rather limited base class (GrRestrictedAtlasManager)
and the all powerful GrAtlasManager. The GrRestrictedAtlasManager is available at op creation
time and provides access to the proxies backing the atlases. The full GrAtlasManager is
only available at flush time and allows instantiation of the proxies and uploading to them.
In the DDL world all of the DDL Contexts will receive a GrRestrictedAtlasManager-version of the
GrAtlasManager in the main thread. This future atlas manager will have had all of its
GrDrawOpAtlases created (but not instantiated) so there should be no race conditions.
TBR=jvanverth@google.com
Change-Id: I05c6cd8d301bf2decca39765e5cae62993d9da04
Reviewed-on: https://skia-review.googlesource.com/111362
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/atlastext')
-rw-r--r-- | src/atlastext/SkAtlasTextTarget.cpp | 11 | ||||
-rw-r--r-- | src/atlastext/SkInternalAtlasTextContext.cpp | 16 | ||||
-rw-r--r-- | src/atlastext/SkInternalAtlasTextContext.h | 4 |
3 files changed, 14 insertions, 17 deletions
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp index f553ffad96..9da5fd1e3d 100644 --- a/src/atlastext/SkAtlasTextTarget.cpp +++ b/src/atlastext/SkAtlasTextTarget.cpp @@ -181,20 +181,17 @@ void GrAtlasTextOp::finalizeForTextTarget(uint32_t color, const GrCaps& caps) { void GrAtlasTextOp::executeForTextTarget(SkAtlasTextTarget* target) { FlushInfo flushInfo; - SkAutoGlyphCache glyphCache; + SkAutoGlyphCache autoGlyphCache; auto& context = target->context()->internal(); - auto atlasGlyphCache = context.grContext()->contextPriv().getAtlasGlyphCache(); + auto glyphCache = context.grContext()->contextPriv().getGlyphCache(); + auto fullAtlasManager = context.grContext()->contextPriv().getFullAtlasManager(); auto resourceProvider = context.grContext()->contextPriv().resourceProvider(); - auto drawingManager = context.grContext()->contextPriv().drawingManager(); - - GrOnFlushResourceProvider onFlushResourceProvider(drawingManager); - atlasGlyphCache->preFlush(&onFlushResourceProvider, nullptr, 0, nullptr); for (int i = 0; i < fGeoCount; ++i) { GrAtlasTextBlob::VertexRegenerator regenerator( resourceProvider, fGeoData[i].fBlob, fGeoData[i].fRun, fGeoData[i].fSubRun, fGeoData[i].fViewMatrix, fGeoData[i].fX, fGeoData[i].fY, fGeoData[i].fColor, - &context, atlasGlyphCache, &glyphCache); + &context, glyphCache, fullAtlasManager, &autoGlyphCache); GrAtlasTextBlob::VertexRegenerator::Result result; do { result = regenerator.regenerate(); diff --git a/src/atlastext/SkInternalAtlasTextContext.cpp b/src/atlastext/SkInternalAtlasTextContext.cpp index fcb4130665..1e9cbf3079 100644 --- a/src/atlastext/SkInternalAtlasTextContext.cpp +++ b/src/atlastext/SkInternalAtlasTextContext.cpp @@ -10,7 +10,7 @@ #include "GrContextPriv.h" #include "SkAtlasTextContext.h" #include "SkAtlasTextRenderer.h" -#include "text/GrAtlasGlyphCache.h" +#include "text/GrGlyphCache.h" SkAtlasTextRenderer* SkGetAtlasTextRendererFromInternalContext( class SkInternalAtlasTextContext& internal) { @@ -38,17 +38,17 @@ SkInternalAtlasTextContext::SkInternalAtlasTextContext(sk_sp<SkAtlasTextRenderer SkInternalAtlasTextContext::~SkInternalAtlasTextContext() { if (fDistanceFieldAtlas.fProxy) { #ifdef SK_DEBUG - auto atlasGlyphCache = fGrContext->contextPriv().getAtlasGlyphCache(); + auto restrictedAtlasManager = fGrContext->contextPriv().getRestrictedAtlasManager(); unsigned int numProxies; - atlasGlyphCache->getProxies(kA8_GrMaskFormat, &numProxies); + restrictedAtlasManager->getProxies(kA8_GrMaskFormat, &numProxies); SkASSERT(1 == numProxies); #endif fRenderer->deleteTexture(fDistanceFieldAtlas.fTextureHandle); } } -GrAtlasGlyphCache* SkInternalAtlasTextContext::atlasGlyphCache() { - return fGrContext->contextPriv().getAtlasGlyphCache(); +GrGlyphCache* SkInternalAtlasTextContext::glyphCache() { + return fGrContext->contextPriv().getGlyphCache(); } GrTextBlobCache* SkInternalAtlasTextContext::textBlobCache() { @@ -86,11 +86,11 @@ void SkInternalAtlasTextContext::recordDraw(const void* srcVertexData, int glyph } void SkInternalAtlasTextContext::flush() { - auto* atlasGlyphCache = fGrContext->contextPriv().getAtlasGlyphCache(); + auto* restrictedAtlasManager = fGrContext->contextPriv().getRestrictedAtlasManager(); if (!fDistanceFieldAtlas.fProxy) { unsigned int numProxies; - fDistanceFieldAtlas.fProxy = atlasGlyphCache->getProxies(kA8_GrMaskFormat, - &numProxies)->get(); + fDistanceFieldAtlas.fProxy = restrictedAtlasManager->getProxies(kA8_GrMaskFormat, + &numProxies)->get(); SkASSERT(1 == numProxies); fDistanceFieldAtlas.fTextureHandle = fRenderer->createTexture(SkAtlasTextRenderer::AtlasFormat::kA8, diff --git a/src/atlastext/SkInternalAtlasTextContext.h b/src/atlastext/SkInternalAtlasTextContext.h index cdba3ad8b0..22cda5ca51 100644 --- a/src/atlastext/SkInternalAtlasTextContext.h +++ b/src/atlastext/SkInternalAtlasTextContext.h @@ -13,8 +13,8 @@ #include "SkArenaAllocList.h" #include "SkRefCnt.h" -class GrAtlasGlyphCache; class GrContext; +class GrGlyphCache; class GrTextBlobCache; class SkAtlasTextRenderer; @@ -33,7 +33,7 @@ public: SkAtlasTextRenderer* renderer() const { return fRenderer.get(); } GrContext* grContext() const { return fGrContext.get(); } - GrAtlasGlyphCache* atlasGlyphCache(); + GrGlyphCache* glyphCache(); GrTextBlobCache* textBlobCache(); const GrTokenTracker* tokenTracker() final { return &fTokenTracker; } |