8#ifndef skgpu_graphite_DrawAtlas_DEFINED
9#define skgpu_graphite_DrawAtlas_DEFINED
79 int plotWidth,
int plotHeight,
84 std::string_view label);
125 unsigned int numPlots()
const {
return fNumPlots; }
135 uint64_t plotGeneration = fPages[
page].fPlotArray[
plot]->genID();
136 uint64_t locatorGeneration = plotLocator.
genID();
137 return plot < fNumPlots &&
page < fNumActivePages && plotGeneration == locatorGeneration;
142 Plot*
plot = this->findPlot(atlasLocator);
143 this->internalSetLastUseToken(
plot, atlasLocator.
pageIndex(), token);
177 int width,
int height,
int plotWidth,
int plotHeight,
181 std::string_view label);
187 inline void makeMRU(
Plot*
plot,
int pageIdx) {
188 if (fPages[pageIdx].fPlotList.head() ==
plot) {
192 fPages[pageIdx].fPlotList.remove(
plot);
193 fPages[pageIdx].fPlotList.addToHead(
plot);
201 uint32_t pageIdx = atlasLocator.
pageIndex();
202 uint32_t plotIdx = atlasLocator.
plotIndex();
203 return fPages[pageIdx].fPlotArray[plotIdx].get();
207 this->makeMRU(
plot, pageIdx);
208 plot->setLastUseToken(token);
211 bool createPages(AtlasGenerationCounter*);
213 void deactivateLastPage();
216 inline void processEvictionAndResetRects(
Plot*
plot) {
217 this->processEviction(
plot->plotLocator());
222 size_t fBytesPerPixel;
227 unsigned int fNumPlots;
229 const std::string fLabel;
237 AtlasGenerationCounter*
const fGenerationCounter;
238 uint64_t fAtlasGeneration;
246 int fFlushesSinceLastUse;
248 std::vector<PlotEvictionCallback*> fEvictionCallbacks;
252 std::unique_ptr<sk_sp<Plot>[]> fPlotArray;
261 uint32_t fNumActivePages;
285 inline static constexpr int kMaxAtlasDim = 2048;
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
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
DrawAtlasConfig(int maxTextureSize, size_t maxBytes)
uint32_t numActivePages() const
void markUsedPlotsAsFull()
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
void compact(AtlasToken startTokenForNextFlush)
bool recordUploads(DrawContext *, Recorder *)
SkIPoint prepForRender(const AtlasLocator &, SkAutoPixmapStorage *)
static std::unique_ptr< DrawAtlas > Make(SkColorType ct, size_t bpp, int width, int height, int plotWidth, int plotHeight, AtlasGenerationCounter *generationCounter, AllowMultitexturing allowMultitexturing, UseStorageTextures useStorageTextures, PlotEvictionCallback *evictor, std::string_view label)
sk_sp< const SkImage > image
static void plot(SkCanvas *canvas, const char *fn, float xMin, float xMax, float yMin, float yMax, const char *label=nullptr, bool requireES3=false)