From 2ee084e73056b0ad76b721017f576168b7306da3 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Fri, 16 Dec 2016 18:59:19 -0500 Subject: [PATCH] Rename GrBatchAtlas -> GrDrawOpAtlas. Change-Id: I776f37e42dcab8b16535c48df9c405b1f211f6c9 Reviewed-on: https://skia-review.googlesource.com/6165 Commit-Queue: Brian Salomon Reviewed-by: Brian Osman --- gn/gpu.gni | 4 +- include/gpu/GrContext.h | 4 +- src/gpu/GrDrawOpAtlas.cpp | 93 ++++++------- src/gpu/GrDrawOpAtlas.h | 192 +++++++++++++++----------- src/gpu/GrGlyph.h | 6 +- src/gpu/GrOpFlushState.h | 2 +- src/gpu/GrResourceProvider.cpp | 13 +- src/gpu/GrResourceProvider.h | 42 +++--- src/gpu/ops/GrAADistanceFieldPathRenderer.cpp | 21 ++- src/gpu/ops/GrAADistanceFieldPathRenderer.h | 12 +- src/gpu/text/GrAtlasGlyphCache.cpp | 10 +- src/gpu/text/GrAtlasGlyphCache.h | 31 ++--- src/gpu/text/GrAtlasTextBlob.h | 24 ++-- src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp | 4 +- tools/gpu/GrTest.cpp | 10 +- 15 files changed, 245 insertions(+), 223 deletions(-) diff --git a/gn/gpu.gni b/gn/gpu.gni index 2e40dd3..73fb4d6 100644 --- a/gn/gpu.gni +++ b/gn/gpu.gni @@ -73,8 +73,6 @@ skia_gpu_sources = [ "$_src/gpu/GrAuditTrail.cpp", "$_src/gpu/GrAutoLocaleSetter.h", "$_src/gpu/GrAllocator.h", - "$_src/gpu/GrDrawOpAtlas.cpp", - "$_src/gpu/GrDrawOpAtlas.h", "$_src/gpu/GrBatchTest.cpp", "$_src/gpu/GrBatchTest.h", "$_src/gpu/GrBitmapTextureMaker.cpp", @@ -96,6 +94,8 @@ skia_gpu_sources = [ "$_src/gpu/GrDefaultGeoProcFactory.h", "$_src/gpu/GrDrawingManager.cpp", "$_src/gpu/GrDrawingManager.h", + "$_src/gpu/GrDrawOpAtlas.cpp", + "$_src/gpu/GrDrawOpAtlas.h", "$_src/gpu/GrFixedClip.cpp", "$_src/gpu/GrFixedClip.h", "$_src/gpu/GrFragmentProcessor.cpp", diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 779529a..9fa134d 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -21,11 +21,11 @@ #include "../private/GrSingleOwner.h" class GrAtlasGlyphCache; -struct GrBatchAtlasConfig; struct GrContextOptions; class GrContextPriv; class GrContextThreadSafeProxy; class GrDrawingManager; +struct GrDrawOpAtlasConfig; class GrRenderTargetContext; class GrFragmentProcessor; class GrGpu; @@ -359,7 +359,7 @@ public: /** Specify the sizes of the GrAtlasTextContext atlases. The configs pointer below should be to an array of 3 entries */ - void setTextContextAtlasSizes_ForTesting(const GrBatchAtlasConfig* configs); + void setTextContextAtlasSizes_ForTesting(const GrDrawOpAtlasConfig* configs); /** Enumerates all cached GPU resources and dumps their memory to traceMemoryDump. */ void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const; diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp index 1a4ba45..feb6691 100644 --- a/src/gpu/GrDrawOpAtlas.cpp +++ b/src/gpu/GrDrawOpAtlas.cpp @@ -12,36 +12,35 @@ //////////////////////////////////////////////////////////////////////////////// -GrBatchAtlas::BatchPlot::BatchPlot(int index, uint64_t genID, int offX, int offY, int width, - int height, GrPixelConfig config) - : fLastUpload(GrDrawOpUploadToken::AlreadyFlushedToken()) - , fLastUse(GrDrawOpUploadToken::AlreadyFlushedToken()) - , fIndex(index) - , fGenID(genID) - , fID(CreateId(fIndex, fGenID)) - , fData(nullptr) - , fWidth(width) - , fHeight(height) - , fX(offX) - , fY(offY) - , fRects(nullptr) - , fOffset(SkIPoint16::Make(fX * fWidth, fY * fHeight)) - , fConfig(config) - , fBytesPerPixel(GrBytesPerPixel(config)) +GrDrawOpAtlas::Plot::Plot(int index, uint64_t genID, int offX, int offY, int width, int height, + GrPixelConfig config) + : fLastUpload(GrDrawOpUploadToken::AlreadyFlushedToken()) + , fLastUse(GrDrawOpUploadToken::AlreadyFlushedToken()) + , fIndex(index) + , fGenID(genID) + , fID(CreateId(fIndex, fGenID)) + , fData(nullptr) + , fWidth(width) + , fHeight(height) + , fX(offX) + , fY(offY) + , fRects(nullptr) + , fOffset(SkIPoint16::Make(fX * fWidth, fY * fHeight)) + , fConfig(config) + , fBytesPerPixel(GrBytesPerPixel(config)) #ifdef SK_DEBUG - , fDirty(false) + , fDirty(false) #endif { fDirtyRect.setEmpty(); } -GrBatchAtlas::BatchPlot::~BatchPlot() { +GrDrawOpAtlas::Plot::~Plot() { sk_free(fData); delete fRects; } -bool GrBatchAtlas::BatchPlot::addSubImage(int width, int height, const void* image, - SkIPoint16* loc) { +bool GrDrawOpAtlas::Plot::addSubImage(int width, int height, const void* image, SkIPoint16* loc) { SkASSERT(width <= fWidth && height <= fHeight); if (!fRects) { @@ -86,11 +85,11 @@ bool GrBatchAtlas::BatchPlot::addSubImage(int width, int height, const void* ima return true; } -void GrBatchAtlas::BatchPlot::uploadToTexture(GrDrawOp::WritePixelsFn& writePixels, - GrTexture* texture) { +void GrDrawOpAtlas::Plot::uploadToTexture(GrDrawOp::WritePixelsFn& writePixels, + GrTexture* texture) { // We should only be issuing uploads if we are in fact dirty SkASSERT(fDirty && fData && texture); - TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrBatchPlot::uploadToTexture"); + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("skia.gpu"), "GrDrawOpAtlas::Plot::uploadToTexture"); size_t rowBytes = fBytesPerPixel * fWidth; const unsigned char* dataPtr = fData; dataPtr += rowBytes * fDirtyRect.fTop; @@ -101,7 +100,7 @@ void GrBatchAtlas::BatchPlot::uploadToTexture(GrDrawOp::WritePixelsFn& writePixe SkDEBUGCODE(fDirty = false;) } -void GrBatchAtlas::BatchPlot::resetRects() { +void GrDrawOpAtlas::Plot::resetRects() { if (fRects) { fRects->reset(); } @@ -120,10 +119,8 @@ void GrBatchAtlas::BatchPlot::resetRects() { /////////////////////////////////////////////////////////////////////////////// -GrBatchAtlas::GrBatchAtlas(sk_sp texture, int numPlotsX, int numPlotsY) - : fTexture(std::move(texture)) - , fAtlasGeneration(kInvalidAtlasGeneration + 1) { - +GrDrawOpAtlas::GrDrawOpAtlas(sk_sp texture, int numPlotsX, int numPlotsY) + : fTexture(std::move(texture)), fAtlasGeneration(kInvalidAtlasGeneration + 1) { fPlotWidth = fTexture->width() / numPlotsX; fPlotHeight = fTexture->height() / numPlotsY; SkASSERT(numPlotsX * numPlotsY <= BulkUseTokenUpdater::kMaxPlots); @@ -136,14 +133,14 @@ GrBatchAtlas::GrBatchAtlas(sk_sp texture, int numPlotsX, int numPlots SkASSERT(!GrPixelConfigIsCompressed(fTexture->desc().fConfig)); // set up allocated plots - fPlotArray.reset(new sk_sp[numPlotsX * numPlotsY]); + fPlotArray.reset(new sk_sp[ numPlotsX * numPlotsY ]); - sk_sp* currPlot = fPlotArray.get(); + sk_sp* currPlot = fPlotArray.get(); for (int y = numPlotsY - 1, r = 0; y >= 0; --y, ++r) { for (int x = numPlotsX - 1, c = 0; x >= 0; --x, ++c) { uint32_t index = r * numPlotsX + c; - currPlot->reset(new BatchPlot(index, 1, x, y, fPlotWidth, fPlotHeight, - fTexture->desc().fConfig)); + currPlot->reset( + new Plot(index, 1, x, y, fPlotWidth, fPlotHeight, fTexture->desc().fConfig)); // build LRU list fPlotList.addToHead(currPlot->get()); @@ -152,13 +149,13 @@ GrBatchAtlas::GrBatchAtlas(sk_sp texture, int numPlotsX, int numPlots } } -void GrBatchAtlas::processEviction(AtlasID id) { +void GrDrawOpAtlas::processEviction(AtlasID id) { for (int i = 0; i < fEvictionCallbacks.count(); i++) { (*fEvictionCallbacks[i].fFunc)(id, fEvictionCallbacks[i].fData); } } -inline void GrBatchAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, BatchPlot* plot) { +inline void GrDrawOpAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, Plot* plot) { this->makeMRU(plot); // If our most recent upload has already occurred then we have to insert a new @@ -166,7 +163,7 @@ inline void GrBatchAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, Batc // This new update will piggy back on that previously scheduled update. if (target->hasDrawBeenFlushed(plot->lastUploadToken())) { // With c+14 we could move sk_sp into lamba to only ref once. - sk_sp plotsp(SkRef(plot)); + sk_sp plotsp(SkRef(plot)); GrTexture* texture = fTexture.get(); GrDrawOpUploadToken lastUploadToken = target->addAsapUpload( [plotsp, texture] (GrDrawOp::WritePixelsFn& writePixels) { @@ -178,8 +175,8 @@ inline void GrBatchAtlas::updatePlot(GrDrawOp::Target* target, AtlasID* id, Batc *id = plot->id(); } -bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, - int width, int height, const void* image, SkIPoint16* loc) { +bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width, int height, + const void* image, SkIPoint16* loc) { // We should already have a texture, TODO clean this up SkASSERT(fTexture); if (width > fPlotWidth || height > fPlotHeight) { @@ -187,9 +184,9 @@ bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, } // now look through all allocated plots for one we can share, in Most Recently Refed order - GrBatchPlotList::Iter plotIter; - plotIter.init(fPlotList, GrBatchPlotList::Iter::kHead_IterStart); - BatchPlot* plot; + PlotList::Iter plotIter; + plotIter.init(fPlotList, PlotList::Iter::kHead_IterStart); + Plot* plot; while ((plot = plotIter.get())) { SkASSERT(GrBytesPerPixel(fTexture->desc().fConfig) == plot->bpp()); if (plot->addSubImage(width, height, image, loc)) { @@ -214,18 +211,18 @@ bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, return true; } - // If this plot has been used in a draw that is currently being prepared by a batch, then we - // have to fail. This gives the batch a chance to enqueue the draw, and call back into this - // function. When that draw is enqueued, the draw token advances, and the subsequent call will - // continue past this branch and prepare an inline upload that will occur after the enqueued - // draw which references the plot's pre-upload content. + // If this plot has been used in a draw that is currently being prepared by an op, then we have + // to fail. This gives the op a chance to enqueue the draw, and call back into this function. + // When that draw is enqueued, the draw token advances, and the subsequent call will continue + // past this branch and prepare an inline upload that will occur after the enqueued draw which + // references the plot's pre-upload content. if (plot->lastUseToken() == target->nextDrawToken()) { return false; } this->processEviction(plot->id()); fPlotList.remove(plot); - sk_sp& newPlot = fPlotArray[plot->index()]; + sk_sp& newPlot = fPlotArray[plot->index()]; newPlot.reset(plot->clone()); fPlotList.addToHead(newPlot.get()); @@ -235,8 +232,8 @@ bool GrBatchAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, // Note that this plot will be uploaded inline with the draws whereas the // one it displaced most likely was uploaded asap. - // With c+14 we could move sk_sp into lamba to only ref once. - sk_sp plotsp(SkRef(newPlot.get())); + // With c+14 we could move sk_sp into lambda to only ref once. + sk_sp plotsp(SkRef(newPlot.get())); GrTexture* texture = fTexture.get(); GrDrawOpUploadToken lastUploadToken = target->addInlineUpload( [plotsp, texture] (GrDrawOp::WritePixelsFn& writePixels) { diff --git a/src/gpu/GrDrawOpAtlas.h b/src/gpu/GrDrawOpAtlas.h index 11270f3..7a7da6c 100644 --- a/src/gpu/GrDrawOpAtlas.h +++ b/src/gpu/GrDrawOpAtlas.h @@ -5,8 +5,8 @@ * found in the LICENSE file. */ -#ifndef GrBatchAtlas_DEFINED -#define GrBatchAtlas_DEFINED +#ifndef GrDrawOpAtlas_DEFINED +#define GrDrawOpAtlas_DEFINED #include "GrTexture.h" #include "SkPoint.h" @@ -17,7 +17,7 @@ class GrRectanizer; -struct GrBatchAtlasConfig { +struct GrDrawOpAtlasConfig { int numPlotsX() const { return fWidth / fPlotWidth; } int numPlotsY() const { return fHeight / fPlotWidth; } int fWidth; @@ -28,28 +28,47 @@ struct GrBatchAtlasConfig { int fPlotHeight; }; -class GrBatchAtlas { +/** + * This class manages an atlas texture on behalf of GrDrawOps. The draw ops that use the atlas + * perform texture uploads when preparing their draws during flush. The class provides facilities + * for using GrDrawOpUploadToken to detect data hazards. Op's uploads are performed in "asap" mode + * until it is impossible to add data without overwriting texels read by draws that have not yet + * executed on the gpu. At that point the uploads are performed "inline" between draws. If a single + * draw would use enough subimage space to overflow the atlas texture then the atlas will fail to + * add a subimage. This gives the op the chance to end the draw and begin a new one. Additional + * uploads will then succeed in inline mode. + */ +class GrDrawOpAtlas { public: - // An AtlasID is an opaque handle which callers can use to determine if the atlas contains - // a specific piece of data + /** + * An AtlasID is an opaque handle which callers can use to determine if the atlas contains + * a specific piece of data. + */ typedef uint64_t AtlasID; static const uint32_t kInvalidAtlasID = 0; static const uint64_t kInvalidAtlasGeneration = 0; - // A function pointer for use as a callback during eviction. Whenever GrBatchAtlas evicts a - // specific AtlasID, it will call all of the registered listeners so they can optionally process - // the eviction - typedef void (*EvictionFunc)(GrBatchAtlas::AtlasID, void*); - - GrBatchAtlas(sk_sp, int numPlotsX, int numPlotsY); - - // Adds a width x height subimage to the atlas. Upon success it returns - // the containing GrPlot and absolute location in the backing texture. - // nullptr is returned if the subimage cannot fit in the atlas. - // If provided, the image data will be written to the CPU-side backing bitmap. - // NOTE: If the client intends to refer to the atlas, they should immediately call 'setUseToken' - // with the currentToken from the batch target, otherwise the next call to addToAtlas might - // cause an eviction + /** + * A function pointer for use as a callback during eviction. Whenever GrDrawOpAtlas evicts a + * specific AtlasID, it will call all of the registered listeners so they can process the + * eviction. + */ + typedef void (*EvictionFunc)(GrDrawOpAtlas::AtlasID, void*); + + GrDrawOpAtlas(sk_sp, int numPlotsX, int numPlotsY); + + /** + * Adds a width x height subimage to the atlas. Upon success it returns an ID and the subimage's + * coordinates in the backing texture. False is returned if the subimage cannot fit in the + * atlas without overwriting texels that will be read in the current draw. This indicates that + * the op should end its current draw and begin another before adding more data. Upon success, + * an upload of the provided image data will have been added to the GrDrawOp::Target, in "asap" + * mode if possible, otherwise in "inline" mode. Successive uploads in either mode may be + * consolidated. + * NOTE: When the GrDrawOp prepares a draw that reads from the atlas, it must immediately call + * 'setUseToken' with the currentToken from the GrDrawOp::Target, otherwise the next call to + * addToAtlas might cause the previous data to be overwritten before it has been read. + */ bool addToAtlas(AtlasID*, GrDrawOp::Target*, int width, int height, const void* image, SkIPoint16* loc); @@ -63,13 +82,13 @@ public: return fPlotArray[index]->genID() == GetGenerationFromID(id); } - // To ensure the atlas does not evict a given entry, the client must set the last use token - inline void setLastUseToken(AtlasID id, GrDrawOpUploadToken batchToken) { + /** To ensure the atlas does not evict a given entry, the client must set the last use token. */ + inline void setLastUseToken(AtlasID id, GrDrawOpUploadToken token) { SkASSERT(this->hasID(id)); uint32_t index = GetIndexFromID(id); SkASSERT(index < fNumPlots); this->makeMRU(fPlotArray[index].get()); - fPlotArray[index]->setLastUseToken(batchToken); + fPlotArray[index]->setLastUseToken(token); } inline void registerEvictionCallback(EvictionFunc func, void* userData) { @@ -78,10 +97,10 @@ public: data->fData = userData; } - /* - * A class which can be handed back to GrBatchAtlas for updating in bulk last use tokens. The - * current max number of plots the GrBatchAtlas can handle is 32, if in the future this is - * insufficient then we can move to a 64 bit int + /** + * A class which can be handed back to GrDrawOpAtlas for updating last use tokens in bulk. The + * current max number of plots the GrDrawOpAtlas can handle is 32. If in the future this is + * insufficient then we can move to a 64 bit int. */ class BulkUseTokenUpdater { public: @@ -92,7 +111,7 @@ public: } void add(AtlasID id) { - int index = GrBatchAtlas::GetIndexFromID(id); + int index = GrDrawOpAtlas::GetIndexFromID(id); if (!this->find(index)) { this->set(index); } @@ -120,15 +139,15 @@ public: SkSTArray fPlotsToUpdate; uint32_t fPlotAlreadyUpdated; - friend class GrBatchAtlas; + friend class GrDrawOpAtlas; }; - void setLastUseTokenBulk(const BulkUseTokenUpdater& updater, GrDrawOpUploadToken batchToken) { + void setLastUseTokenBulk(const BulkUseTokenUpdater& updater, GrDrawOpUploadToken token) { int count = updater.fPlotsToUpdate.count(); for (int i = 0; i < count; i++) { - BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]].get(); + Plot* plot = fPlotArray[updater.fPlotsToUpdate[i]].get(); this->makeMRU(plot); - plot->setLastUseToken(batchToken); + plot->setLastUseToken(token); } } @@ -138,55 +157,62 @@ public: } private: - // The backing GrTexture for a GrBatchAtlas is broken into a spatial grid of BatchPlots. - // The BatchPlots keep track of subimage placement via their GrRectanizer. A BatchPlot - // manages the lifetime of its data using two tokens, a last use token and a last upload token. - // Once a BatchPlot is "full" (i.e. there is no room for the new subimage according to the - // GrRectanizer), it can no longer be used unless the last use of the GrPlot has already been - // flushed through to the gpu. - class BatchPlot : public SkRefCnt { - SK_DECLARE_INTERNAL_LLIST_INTERFACE(BatchPlot); + /** + * The backing GrTexture for a GrDrawOpAtlas is broken into a spatial grid of Plots. The Plots + * keep track of subimage placement via their GrRectanizer. A Plot manages the lifetime of its + * data using two tokens, a last use token and a last upload token. Once a Plot is "full" (i.e. + * there is no room for the new subimage according to the GrRectanizer), it can no longer be + * used unless the last use of the Plot has already been flushed through to the gpu. + */ + class Plot : public SkRefCnt { + SK_DECLARE_INTERNAL_LLIST_INTERFACE(Plot); public: - // index() is a unique id for the plot relative to the owning GrAtlas. genID() is a - // monotonically incremented number which is bumped every time this plot is - // evicted from the cache (i.e., there is continuity in genID() across atlas spills). + /** index() is a unique id for the plot relative to the owning GrAtlas. */ uint32_t index() const { return fIndex; } + /** + * genID() is incremented when the plot is evicted due to a atlas spill. It is used to know + * if a particular subimage is still present in the atlas. + */ uint64_t genID() const { return fGenID; } - GrBatchAtlas::AtlasID id() const { - SkASSERT(GrBatchAtlas::kInvalidAtlasID != fID); + GrDrawOpAtlas::AtlasID id() const { + SkASSERT(GrDrawOpAtlas::kInvalidAtlasID != fID); return fID; } SkDEBUGCODE(size_t bpp() const { return fBytesPerPixel; }) bool addSubImage(int width, int height, const void* image, SkIPoint16* loc); - // To manage the lifetime of a plot, we use two tokens. We use the last upload token to - // know when we can 'piggy back' uploads, ie if the last upload hasn't been flushed to gpu, - // we don't need to issue a new upload even if we update the cpu backing store. We use - // lastUse to determine when we can evict a plot from the cache, ie if the last use has - // already flushed through the gpu then we can reuse the plot. + /** + * To manage the lifetime of a plot, we use two tokens. We use the last upload token to + * know when we can 'piggy back' uploads, i.e. if the last upload hasn't been flushed to + * the gpu, we don't need to issue a new upload even if we update the cpu backing store. We + * use lastUse to determine when we can evict a plot from the cache, i.e. if the last use + * has already flushed through the gpu then we can reuse the plot. + */ GrDrawOpUploadToken lastUploadToken() const { return fLastUpload; } GrDrawOpUploadToken lastUseToken() const { return fLastUse; } - void setLastUploadToken(GrDrawOpUploadToken batchToken) { fLastUpload = batchToken; } - void setLastUseToken(GrDrawOpUploadToken batchToken) { fLastUse = batchToken; } + void setLastUploadToken(GrDrawOpUploadToken token) { fLastUpload = token; } + void setLastUseToken(GrDrawOpUploadToken token) { fLastUse = token; } void uploadToTexture(GrDrawOp::WritePixelsFn&, GrTexture* texture); void resetRects(); private: - BatchPlot(int index, uint64_t genID, int offX, int offY, int width, int height, - GrPixelConfig config); + Plot(int index, uint64_t genID, int offX, int offY, int width, int height, + GrPixelConfig config); - ~BatchPlot() override; + ~Plot() override; - // Create a clone of this plot. The cloned plot will take the place of the - // current plot in the atlas. - BatchPlot* clone() const { - return new BatchPlot(fIndex, fGenID+1, fX, fY, fWidth, fHeight, fConfig); + /** + * Create a clone of this plot. The cloned plot will take the place of the current plot in + * the atlas + */ + Plot* clone() const { + return new Plot(fIndex, fGenID + 1, fX, fY, fWidth, fHeight, fConfig); } - static GrBatchAtlas::AtlasID CreateId(uint32_t index, uint64_t generation) { + static GrDrawOpAtlas::AtlasID CreateId(uint32_t index, uint64_t generation) { SkASSERT(index < (1 << 16)); SkASSERT(generation < ((uint64_t)1 << 48)); return generation << 16 | index; @@ -195,27 +221,27 @@ private: GrDrawOpUploadToken fLastUpload; GrDrawOpUploadToken fLastUse; - const uint32_t fIndex; - uint64_t fGenID; - GrBatchAtlas::AtlasID fID; - unsigned char* fData; - const int fWidth; - const int fHeight; - const int fX; - const int fY; - GrRectanizer* fRects; - const SkIPoint16 fOffset; // the offset of the plot in the backing texture - const GrPixelConfig fConfig; - const size_t fBytesPerPixel; - SkIRect fDirtyRect; - SkDEBUGCODE(bool fDirty;) - - friend class GrBatchAtlas; + const uint32_t fIndex; + uint64_t fGenID; + GrDrawOpAtlas::AtlasID fID; + unsigned char* fData; + const int fWidth; + const int fHeight; + const int fX; + const int fY; + GrRectanizer* fRects; + const SkIPoint16 fOffset; // the offset of the plot in the backing texture + const GrPixelConfig fConfig; + const size_t fBytesPerPixel; + SkIRect fDirtyRect; + SkDEBUGCODE(bool fDirty); + + friend class GrDrawOpAtlas; typedef SkRefCnt INHERITED; }; - typedef SkTInternalLList GrBatchPlotList; + typedef SkTInternalLList PlotList; static uint32_t GetIndexFromID(AtlasID id) { return id & 0xffff; @@ -226,9 +252,9 @@ private: return (id >> 16) & 0xffffffffffff; } - inline void updatePlot(GrDrawOp::Target*, AtlasID*, BatchPlot*); + inline void updatePlot(GrDrawOp::Target*, AtlasID*, Plot*); - inline void makeMRU(BatchPlot* plot) { + inline void makeMRU(Plot* plot) { if (fPlotList.head() == plot) { return; } @@ -252,10 +278,10 @@ private: }; SkTDArray fEvictionCallbacks; - // allocated array of GrBatchPlots - std::unique_ptr[]> fPlotArray; - // LRU list of GrPlots (MRU at head - LRU at tail) - GrBatchPlotList fPlotList; + // allocated array of Plots + std::unique_ptr[]> fPlotArray; + // LRU list of Plots (MRU at head - LRU at tail) + PlotList fPlotList; }; #endif diff --git a/src/gpu/GrGlyph.h b/src/gpu/GrGlyph.h index 24bc7ca..5005b74 100644 --- a/src/gpu/GrGlyph.h +++ b/src/gpu/GrGlyph.h @@ -32,7 +32,7 @@ struct GrGlyph { typedef uint32_t PackedID; - GrBatchAtlas::AtlasID fID; + GrDrawOpAtlas::AtlasID fID; SkPath* fPath; PackedID fPackedID; GrMaskFormat fMaskFormat; @@ -41,13 +41,13 @@ struct GrGlyph { bool fTooLargeForAtlas; void init(GrGlyph::PackedID packed, const SkIRect& bounds, GrMaskFormat format) { - fID = GrBatchAtlas::kInvalidAtlasID; + fID = GrDrawOpAtlas::kInvalidAtlasID; fPath = nullptr; fPackedID = packed; fBounds.set(bounds); fMaskFormat = format; fAtlasLocation.set(0, 0); - fTooLargeForAtlas = GrBatchAtlas::GlyphTooLargeForAtlas(bounds.width(), bounds.height()); + fTooLargeForAtlas = GrDrawOpAtlas::GlyphTooLargeForAtlas(bounds.width(), bounds.height()); } void reset() { diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h index 01d84c8..16d3968 100644 --- a/src/gpu/GrOpFlushState.h +++ b/src/gpu/GrOpFlushState.h @@ -121,7 +121,7 @@ private: * that case the ASAP upload would happen prior to the previous draw causing the draw to read the * new (wrong) texture data. In that case they should schedule an inline upload. * - * Ops, in conjunction with helpers such as GrBatchAtlas, can use the token system to know + * Ops, in conjunction with helpers such as GrDrawOpAtlas, can use the token system to know * what the most recent draw was that referenced a resource (or portion of a resource). Each draw * is assigned a token. A resource (or portion) can be tagged with the most recent draw's * token. The target provides a facility for testing whether the draw corresponding to the token diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index fbffa27..e18718e 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -135,11 +135,11 @@ GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedTyp return buffer; } -std::unique_ptr GrResourceProvider::makeAtlas(GrPixelConfig config, - int width, int height, - int numPlotsX, int numPlotsY, - GrBatchAtlas::EvictionFunc func, - void* data) { +std::unique_ptr GrResourceProvider::makeAtlas(GrPixelConfig config, int width, + int height, int numPlotsX, + int numPlotsY, + GrDrawOpAtlas::EvictionFunc func, + void* data) { GrSurfaceDesc desc; desc.fFlags = kNone_GrSurfaceFlags; desc.fWidth = width; @@ -154,7 +154,8 @@ std::unique_ptr GrResourceProvider::makeAtlas(GrPixelConfig config if (!texture) { return nullptr; } - std::unique_ptr atlas(new GrBatchAtlas(std::move(texture), numPlotsX, numPlotsY)); + std::unique_ptr atlas( + new GrDrawOpAtlas(std::move(texture), numPlotsX, numPlotsY)); atlas->registerEvictionCallback(func, data); return atlas; } diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h index 45aa3af..58bd1f8 100644 --- a/src/gpu/GrResourceProvider.h +++ b/src/gpu/GrResourceProvider.h @@ -8,13 +8,13 @@ #ifndef GrResourceProvider_DEFINED #define GrResourceProvider_DEFINED -#include "GrDrawOpAtlas.h" #include "GrBuffer.h" +#include "GrDrawOpAtlas.h" #include "GrGpu.h" -#include "GrTextureProvider.h" #include "GrPathRange.h" +#include "GrTextureProvider.h" -class GrBatchAtlas; +class GrDrawOpAtlas; class GrPath; class GrRenderTarget; class GrSingleOwner; @@ -129,25 +129,25 @@ public: return this->internalCreateApproxTexture(desc, flags); } - /** Returns a GrBatchAtlas. This function can be called anywhere, but the returned atlas should - * only be used inside of GrOp::generateGeometry - * @param GrPixelConfig The pixel config which this atlas will store - * @param width width in pixels of the atlas - * @param height height in pixels of the atlas - * @param numPlotsX The number of plots the atlas should be broken up into in the X - * direction - * @param numPlotsY The number of plots the atlas should be broken up into in the Y - * direction - * @param func An eviction function which will be called whenever the atlas has to - * evict data - * @param data User supplied data which will be passed into func whenver an - * eviction occurs - * - * @return An initialized GrBatchAtlas, or nullptr if creation fails + /** + * Returns a GrDrawOpAtlas. This function can be called anywhere, but the returned atlas + * should only be used inside of GrMeshDrawOp::onPrepareDraws. + * @param GrPixelConfig The pixel config which this atlas will store + * @param width width in pixels of the atlas + * @param height height in pixels of the atlas + * @param numPlotsX The number of plots the atlas should be broken up into in the X + * direction + * @param numPlotsY The number of plots the atlas should be broken up into in the Y + * direction + * @param func An eviction function which will be called whenever the atlas has to + * evict data + * @param data User supplied data which will be passed into func whenver an + * eviction occurs + * @return An initialized GrDrawOpAtlas, or nullptr if creation fails */ - std::unique_ptr makeAtlas(GrPixelConfig, int width, int height, - int numPlotsX, int numPlotsY, - GrBatchAtlas::EvictionFunc func, void* data); + std::unique_ptr makeAtlas(GrPixelConfig, int width, int height, int numPlotsX, + int numPlotsY, GrDrawOpAtlas::EvictionFunc func, + void* data); /** * If passed in render target already has a stencil buffer, return it. Otherwise attempt to diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp index 4daa48f..d72a239 100644 --- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp +++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp @@ -40,7 +40,7 @@ static const int kMediumMIP = 73; static const int kLargeMIP = 162; // Callback to clear out internal path cache when eviction occurs -void GrAADistanceFieldPathRenderer::HandleEviction(GrBatchAtlas::AtlasID id, void* pr) { +void GrAADistanceFieldPathRenderer::HandleEviction(GrDrawOpAtlas::AtlasID id, void* pr) { GrAADistanceFieldPathRenderer* dfpr = (GrAADistanceFieldPathRenderer*)pr; // remove any paths that use this plot ShapeDataList::Iter iter; @@ -127,7 +127,7 @@ public: using ShapeDataList = GrAADistanceFieldPathRenderer::ShapeDataList; static sk_sp Make(GrColor color, const GrShape& shape, const SkMatrix& viewMatrix, - GrBatchAtlas* atlas, ShapeCache* shapeCache, + GrDrawOpAtlas* atlas, ShapeCache* shapeCache, ShapeDataList* shapeList, bool gammaCorrect) { return sk_sp(new AADistanceFieldPathOp(color, shape, viewMatrix, atlas, shapeCache, shapeList, gammaCorrect)); @@ -154,7 +154,7 @@ public: private: AADistanceFieldPathOp(GrColor color, const GrShape& shape, const SkMatrix& viewMatrix, - GrBatchAtlas* atlas, ShapeCache* shapeCache, ShapeDataList* shapeList, + GrDrawOpAtlas* atlas, ShapeCache* shapeCache, ShapeDataList* shapeList, bool gammaCorrect) : INHERITED(ClassID()) { SkASSERT(shape.hasUnstyledKey()); @@ -210,7 +210,7 @@ private: FlushInfo flushInfo; // Setup GrGeometryProcessor - GrBatchAtlas* atlas = fAtlas; + GrDrawOpAtlas* atlas = fAtlas; flushInfo.fGeometryProcessor = GrDistanceFieldPathGeoProc::Make(this->color(), this->viewMatrix(), atlas->getTexture(), @@ -303,7 +303,7 @@ private: this->flush(target, &flushInfo); } - bool addPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo, GrBatchAtlas* atlas, + bool addPathToAtlas(GrMeshDrawOp::Target* target, FlushInfo* flushInfo, GrDrawOpAtlas* atlas, ShapeData* shapeData, const GrShape& shape, uint32_t dimension, SkScalar scale) const { const SkRect& bounds = shape.bounds(); @@ -377,7 +377,7 @@ private: // add to atlas SkIPoint16 atlasLocation; - GrBatchAtlas::AtlasID id; + GrDrawOpAtlas::AtlasID id; if (!atlas->addToAtlas(&id, target, width, height, dfStorage.get(), &atlasLocation)) { this->flush(target, flushInfo); if (!atlas->addToAtlas(&id, target, width, height, dfStorage.get(), &atlasLocation)) { @@ -425,13 +425,12 @@ private: } void writePathVertices(GrDrawOp::Target* target, - GrBatchAtlas* atlas, + GrDrawOpAtlas* atlas, intptr_t offset, GrColor color, size_t vertexStride, SkScalar maxScale, const ShapeData* shapeData) const { - SkPoint* positions = reinterpret_cast(offset); // vertex positions @@ -499,7 +498,7 @@ private: }; SkSTArray<1, Entry> fShapes; - GrBatchAtlas* fAtlas; + GrDrawOpAtlas* fAtlas; ShapeCache* fShapeCache; ShapeDataList* fShapeList; bool fGammaCorrect; @@ -560,7 +559,7 @@ struct PathTestStruct { fShapeCache.reset(); } - static void HandleEviction(GrBatchAtlas::AtlasID id, void* pr) { + static void HandleEviction(GrDrawOpAtlas::AtlasID id, void* pr) { PathTestStruct* dfpr = (PathTestStruct*)pr; // remove any paths that use this plot ShapeDataList::Iter iter; @@ -577,7 +576,7 @@ struct PathTestStruct { } uint32_t fContextID; - std::unique_ptr fAtlas; + std::unique_ptr fAtlas; ShapeCache fShapeCache; ShapeDataList fShapeList; }; diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.h b/src/gpu/ops/GrAADistanceFieldPathRenderer.h index 29db2e0..5d34807 100644 --- a/src/gpu/ops/GrAADistanceFieldPathRenderer.h +++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.h @@ -69,10 +69,10 @@ private: // 64x64 max, 128x128 max) and the GrShape's key. SkAutoSTArray<24, uint32_t> fKey; }; - Key fKey; - GrBatchAtlas::AtlasID fID; - SkRect fBounds; - SkRect fTexCoords; + Key fKey; + GrDrawOpAtlas::AtlasID fID; + SkRect fBounds; + SkRect fTexCoords; SK_DECLARE_INTERNAL_LLIST_INTERFACE(ShapeData); static inline const Key& GetKey(const ShapeData& data) { @@ -84,12 +84,12 @@ private: } }; - static void HandleEviction(GrBatchAtlas::AtlasID, void*); + static void HandleEviction(GrDrawOpAtlas::AtlasID, void*); typedef SkTDynamicHash ShapeCache; typedef SkTInternalLList ShapeDataList; - std::unique_ptr fAtlas; + std::unique_ptr fAtlas; ShapeCache fShapeCache; ShapeDataList fShapeList; diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp index 6884c91..803dbb4 100644 --- a/src/gpu/text/GrAtlasGlyphCache.cpp +++ b/src/gpu/text/GrAtlasGlyphCache.cpp @@ -83,7 +83,7 @@ void GrAtlasGlyphCache::freeAll() { } } -void GrAtlasGlyphCache::HandleEviction(GrBatchAtlas::AtlasID id, void* ptr) { +void GrAtlasGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) { GrAtlasGlyphCache* fontCache = reinterpret_cast(ptr); StrikeHash::Iter iter(&fontCache->fCache); @@ -183,7 +183,7 @@ void GrAtlasGlyphCache::dump() const { } #endif -void GrAtlasGlyphCache::setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]) { +void GrAtlasGlyphCache::setAtlasSizes_ForTesting(const GrDrawOpAtlasConfig configs[3]) { // Delete any old atlases. // This should be safe to do as long as we are not in the middle of a flush. for (int i = 0; i < kMaskFormatCount; i++) { @@ -391,11 +391,11 @@ GrGlyph* GrAtlasTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::Packe return glyph; } -void GrAtlasTextStrike::removeID(GrBatchAtlas::AtlasID id) { +void GrAtlasTextStrike::removeID(GrDrawOpAtlas::AtlasID id) { SkTDynamicHash::Iter iter(&fCache); while (!iter.done()) { if (id == (*iter).fID) { - (*iter).fID = GrBatchAtlas::kInvalidAtlasID; + (*iter).fID = GrDrawOpAtlas::kInvalidAtlasID; fAtlasedGlyphs--; SkASSERT(fAtlasedGlyphs >= 0); } @@ -434,7 +434,7 @@ bool GrAtlasTextStrike::addGlyphToAtlas(GrDrawOp::Target* target, glyph->width(), glyph->height(), storage.get(), &glyph->fAtlasLocation); if (success) { - SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); + SkASSERT(GrDrawOpAtlas::kInvalidAtlasID != glyph->fID); fAtlasedGlyphs++; } return success; diff --git a/src/gpu/text/GrAtlasGlyphCache.h b/src/gpu/text/GrAtlasGlyphCache.h index ce86e71..57b65ba 100644 --- a/src/gpu/text/GrAtlasGlyphCache.h +++ b/src/gpu/text/GrAtlasGlyphCache.h @@ -8,8 +8,8 @@ #ifndef GrAtlasGlyphCache_DEFINED #define GrAtlasGlyphCache_DEFINED -#include "GrDrawOpAtlas.h" #include "GrCaps.h" +#include "GrDrawOpAtlas.h" #include "GrGlyph.h" #include "SkGlyphCache.h" #include "SkTDynamicHash.h" @@ -71,7 +71,7 @@ public: int countGlyphs() const { return fCache.count(); } // remove any references to this plot - void removeID(GrBatchAtlas::AtlasID); + void removeID(GrDrawOpAtlas::AtlasID); // If a TextStrike is abandoned by the cache, then the caller must get a new strike bool isAbandoned() const { return fIsAbandoned; } @@ -102,9 +102,9 @@ private: friend class GrAtlasGlyphCache; }; -/* +/** * GrAtlasGlyphCache manages strikes which are indexed by a SkGlyphCache. These strikes can then be - * used to generate individual Glyph Masks. The GrAtlasGlyphCache also manages GrBatchAtlases, + * used to generate individual Glyph Masks. The GrAtlasGlyphCache also manages GrDrawOpAtlases, * though this is more or less transparent to the client(aside from atlasGeneration, described * below). */ @@ -141,27 +141,26 @@ public: return this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID); } - // To ensure the GrBatchAtlas does not evict the Glyph Mask from its texture backing store, + // To ensure the GrDrawOpAtlas does not evict the Glyph Mask from its texture backing store, // the client must pass in the current op token along with the GrGlyph. // A BulkUseTokenUpdater is used to manage bulk last use token updating in the Atlas. // For convenience, this function will also set the use token for the current glyph if required // NOTE: the bulk uploader is only valid if the subrun has a valid atlasGeneration - void addGlyphToBulkAndSetUseToken(GrBatchAtlas::BulkUseTokenUpdater* updater, - GrGlyph* glyph, GrDrawOpUploadToken token) { + void addGlyphToBulkAndSetUseToken(GrDrawOpAtlas::BulkUseTokenUpdater* updater, GrGlyph* glyph, + GrDrawOpUploadToken token) { SkASSERT(glyph); updater->add(glyph->fID); this->getAtlas(glyph->fMaskFormat)->setLastUseToken(glyph->fID, token); } - void setUseTokenBulk(const GrBatchAtlas::BulkUseTokenUpdater& updater, + void setUseTokenBulk(const GrDrawOpAtlas::BulkUseTokenUpdater& updater, GrDrawOpUploadToken token, GrMaskFormat format) { this->getAtlas(format)->setLastUseTokenBulk(updater, token); } // add to texture atlas that matches this format - bool addToAtlas(GrAtlasTextStrike* strike, GrBatchAtlas::AtlasID* id, - GrDrawOp::Target* target, + bool addToAtlas(GrAtlasTextStrike* strike, GrDrawOpAtlas::AtlasID* id, GrDrawOp::Target* target, GrMaskFormat format, int width, int height, const void* image, SkIPoint16* loc) { fPreserveStrike = strike; @@ -169,7 +168,7 @@ public: } // Some clients may wish to verify the integrity of the texture backing store of the - // GrBatchAtlas. The atlasGeneration returned below is a monotonically increasing number which + // GrDrawOpAtlas. The atlasGeneration returned below is a monotonically increasing number which // changes every time something is removed from the texture backing store. uint64_t atlasGeneration(GrMaskFormat format) const { return this->getAtlas(format)->atlasGeneration(); @@ -184,7 +183,7 @@ public: void dump() const; #endif - void setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]); + void setAtlasSizes_ForTesting(const GrDrawOpAtlasConfig configs[3]); private: static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format, const GrCaps& caps) { @@ -222,20 +221,20 @@ private: return strike; } - GrBatchAtlas* getAtlas(GrMaskFormat format) const { + GrDrawOpAtlas* getAtlas(GrMaskFormat format) const { int atlasIndex = MaskFormatToAtlasIndex(format); SkASSERT(fAtlases[atlasIndex]); return fAtlases[atlasIndex].get(); } - static void HandleEviction(GrBatchAtlas::AtlasID, void*); + static void HandleEviction(GrDrawOpAtlas::AtlasID, void*); using StrikeHash = SkTDynamicHash; GrContext* fContext; StrikeHash fCache; - std::unique_ptr fAtlases[kMaskFormatCount]; + std::unique_ptr fAtlases[kMaskFormatCount]; GrAtlasTextStrike* fPreserveStrike; - GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; + GrDrawOpAtlasConfig fAtlasConfigs[kMaskFormatCount]; }; #endif diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h index e0b4a05..0028cc1 100644 --- a/src/gpu/text/GrAtlasTextBlob.h +++ b/src/gpu/text/GrAtlasTextBlob.h @@ -9,8 +9,8 @@ #define GrAtlasTextBlob_DEFINED #include "GrAtlasGlyphCache.h" -#include "GrDrawOpAtlas.h" #include "GrColor.h" +#include "GrDrawOpAtlas.h" #include "GrMemoryPool.h" #include "SkDescriptor.h" #include "SkMaskFilter.h" @@ -364,15 +364,15 @@ private: } struct SubRunInfo { SubRunInfo() - : fAtlasGeneration(GrBatchAtlas::kInvalidAtlasGeneration) - , fVertexStartIndex(0) - , fVertexEndIndex(0) - , fGlyphStartIndex(0) - , fGlyphEndIndex(0) - , fColor(GrColor_ILLEGAL) - , fMaskFormat(kA8_GrMaskFormat) - , fDrawAsDistanceFields(false) - , fUseLCDText(false) { + : fAtlasGeneration(GrDrawOpAtlas::kInvalidAtlasGeneration) + , fVertexStartIndex(0) + , fVertexEndIndex(0) + , fGlyphStartIndex(0) + , fGlyphEndIndex(0) + , fColor(GrColor_ILLEGAL) + , fMaskFormat(kA8_GrMaskFormat) + , fDrawAsDistanceFields(false) + , fUseLCDText(false) { fVertexBounds.setLargestInverted(); } SubRunInfo(const SubRunInfo& that) @@ -395,7 +395,7 @@ private: // TODO when this object is more internal, drop the privacy void resetBulkUseToken() { fBulkUseToken.reset(); } - GrBatchAtlas::BulkUseTokenUpdater* bulkUseToken() { return &fBulkUseToken; } + GrDrawOpAtlas::BulkUseTokenUpdater* bulkUseToken() { return &fBulkUseToken; } void setStrike(GrAtlasTextStrike* strike) { fStrike.reset(SkRef(strike)); } GrAtlasTextStrike* strike() const { return fStrike.get(); } @@ -451,7 +451,7 @@ private: bool drawAsDistanceFields() const { return fDrawAsDistanceFields; } private: - GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; + GrDrawOpAtlas::BulkUseTokenUpdater fBulkUseToken; sk_sp fStrike; SkMatrix fCurrentViewMatrix; SkRect fVertexBounds; diff --git a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp index 7f22d92..9a37e42 100644 --- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp +++ b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp @@ -216,8 +216,8 @@ void GrAtlasTextBlob::regenInOp(GrDrawOp::Target* target, GrAtlasGlyphCache* fon if (regenGlyphs) { info->setStrike(strike); } - info->setAtlasGeneration(brokenRun ? GrBatchAtlas::kInvalidAtlasGeneration : - fontCache->atlasGeneration(info->maskFormat())); + info->setAtlasGeneration(brokenRun ? GrDrawOpAtlas::kInvalidAtlasGeneration + : fontCache->atlasGeneration(info->maskFormat())); } } diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 8dad39a..6fc2f82 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -7,12 +7,12 @@ #include "GrTest.h" -#include "GrDrawOpAtlas.h" #include "GrContextOptions.h" -#include "GrRenderTargetContextPriv.h" +#include "GrDrawOpAtlas.h" #include "GrDrawingManager.h" #include "GrGpuResourceCacheAccess.h" #include "GrPipelineBuilder.h" +#include "GrRenderTargetContextPriv.h" #include "GrRenderTargetProxy.h" #include "GrResourceCache.h" @@ -28,8 +28,8 @@ namespace GrTest { void SetupAlwaysEvictAtlas(GrContext* context) { // These sizes were selected because they allow each atlas to hold a single plot and will thus // stress the atlas - int dim = GrBatchAtlas::kGlyphMaxDim; - GrBatchAtlasConfig configs[3]; + int dim = GrDrawOpAtlas::kGlyphMaxDim; + GrDrawOpAtlasConfig configs[3]; configs[kA8_GrMaskFormat].fWidth = dim; configs[kA8_GrMaskFormat].fHeight = dim; configs[kA8_GrMaskFormat].fLog2Width = SkNextLog2(dim); @@ -84,7 +84,7 @@ void GrContext::setTextBlobCacheLimit_ForTesting(size_t bytes) { fTextBlobCache->setBudget(bytes); } -void GrContext::setTextContextAtlasSizes_ForTesting(const GrBatchAtlasConfig* configs) { +void GrContext::setTextContextAtlasSizes_ForTesting(const GrDrawOpAtlasConfig* configs) { fAtlasGlyphCache->setAtlasSizes_ForTesting(configs); } -- 2.7.4