8#ifndef skgpu_graphite_DrawAtlas_DEFINED
9#define skgpu_graphite_DrawAtlas_DEFINED
74 int plotWidth,
int plotHeight,
78 std::string_view label);
119 unsigned int numPlots()
const {
return fNumPlots; }
129 uint64_t plotGeneration = fPages[page].fPlotArray[
plot]->genID();
130 uint64_t locatorGeneration = plotLocator.
genID();
131 return plot < fNumPlots && page < fNumActivePages && plotGeneration == locatorGeneration;
136 Plot*
plot = this->findPlot(atlasLocator);
137 this->internalSetLastUseToken(
plot, atlasLocator.
pageIndex(), token);
143 for (
int i = 0; i <
count; i++) {
174 inline void makeMRU(
Plot*
plot,
int pageIdx) {
175 if (fPages[pageIdx].fPlotList.head() ==
plot) {
179 fPages[pageIdx].fPlotList.remove(
plot);
180 fPages[pageIdx].fPlotList.addToHead(
plot);
188 uint32_t pageIdx = atlasLocator.
pageIndex();
189 uint32_t plotIdx = atlasLocator.
plotIndex();
190 return fPages[pageIdx].fPlotArray[plotIdx].get();
194 this->makeMRU(
plot, pageIdx);
195 plot->setLastUseToken(token);
198 bool createPages(AtlasGenerationCounter*);
200 void deactivateLastPage();
203 inline void processEvictionAndResetRects(
Plot*
plot) {
204 this->processEviction(
plot->plotLocator());
209 size_t fBytesPerPixel;
214 unsigned int fNumPlots;
215 const std::string fLabel;
223 AtlasGenerationCounter*
const fGenerationCounter;
224 uint64_t fAtlasGeneration;
232 int fFlushesSinceLastUse;
234 std::vector<PlotEvictionCallback*> fEvictionCallbacks;
238 std::unique_ptr<sk_sp<Plot>[]> fPlotArray;
247 uint32_t fNumActivePages;
271 inline static constexpr int kMaxAtlasDim = 2048;
uint32_t plotIndex() const
PlotLocator plotLocator() const
uint32_t pageIndex() const
const PlotData & plotData(int index) const
static constexpr auto kMaxMultitexturePages
uint32_t plotIndex() const
uint32_t pageIndex() const
SkISize plotDimensions(MaskFormat type) const
SkISize atlasDimensions(MaskFormat type) const
uint32_t numActivePages() const
ErrorCode addRect(Recorder *, int width, int height, AtlasLocator *)
void setLastUseToken(const AtlasLocator &atlasLocator, AtlasToken token)
ErrorCode addToAtlas(Recorder *, int width, int height, const void *image, AtlasLocator *)
void setMaxPages_TestingOnly(uint32_t maxPages)
bool hasID(const PlotLocator &plotLocator)
uint32_t maxPages() const
uint64_t atlasGeneration() const
unsigned int numPlots() const
void setLastUseTokenBulk(const BulkUsePlotUpdater &updater, AtlasToken token)
int numAllocated_TestingOnly() const
const sk_sp< TextureProxy > * getProxies() const
static std::unique_ptr< DrawAtlas > Make(SkColorType ct, size_t bpp, int width, int height, int plotWidth, int plotHeight, AtlasGenerationCounter *generationCounter, AllowMultitexturing allowMultitexturing, PlotEvictionCallback *evictor, std::string_view label)
void compact(AtlasToken startTokenForNextFlush)
bool recordUploads(DrawContext *, Recorder *)
SkIPoint prepForRender(const AtlasLocator &, SkAutoPixmapStorage *)
static void plot(SkCanvas *canvas, const char *fn, float xMin, float xMax, float yMin, float yMax, const char *label=nullptr, bool requireES3=false)