Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: src/gpu/GrBatchAtlas.h

Issue 1061713003: Revert of Adding bulk plot reffer to cached textblobs (Closed) Base URL: https://skia.googlesource.com/skia.git@atlastext
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAtlasTextContext.cpp ('k') | src/gpu/GrBatchAtlas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrBatchAtlas.h
diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h
index ddafcaeea776ae0d7aadf1e5d4999e1c00d103fb..cd8123f140980fdb581ceb9789948098c85d7452 100644
--- a/src/gpu/GrBatchAtlas.h
+++ b/src/gpu/GrBatchAtlas.h
@@ -40,9 +40,6 @@
// the containing GrPlot and absolute location in the backing texture.
// NULL 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
bool addToAtlas(AtlasID*, GrBatchTarget*, int width, int height, const void* image,
SkIPoint16* loc);
@@ -50,61 +47,19 @@
uint64_t atlasGeneration() const { return fAtlasGeneration; }
bool hasID(AtlasID id);
-
- // To ensure the atlas does not evict a given entry, the client must set the last use token
- void setLastUseToken(AtlasID id, BatchToken batchToken);
+ void setLastRefToken(AtlasID id, BatchToken batchToken);
void registerEvictionCallback(EvictionFunc func, void* userData) {
EvictionData* data = fEvictionCallbacks.append();
data->fFunc = func;
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
- */
- class BulkUseTokenUpdater {
- public:
- BulkUseTokenUpdater() : fPlotAlreadyUpdated(0) {}
- void add(AtlasID id) {
- int index = GrBatchAtlas::GetIndexFromID(id);
- if (!this->find(index)) {
- this->set(index);
- }
- }
-
- void reset() {
- fPlotsToUpdate.reset();
- fPlotAlreadyUpdated = 0;
- }
-
- private:
- bool find(int index) const {
- SkASSERT(index < kMaxPlots);
- return (fPlotAlreadyUpdated >> index) & 1;
- }
- void set(int index) {
- SkASSERT(!this->find(index));
- fPlotAlreadyUpdated = fPlotAlreadyUpdated | (1 << index);
- fPlotsToUpdate.push_back(index);
- }
-
- static const int kMaxPlots = 32;
- uint32_t fPlotAlreadyUpdated;
- SkSTArray<4, int, true> fPlotsToUpdate;
-
- friend class GrBatchAtlas;
- };
-
- void setLastUseTokenBulk(const BulkUseTokenUpdater& reffer, BatchToken);
-
private:
- static int GetIndexFromID(AtlasID id) {
+ int getIndexFromID(AtlasID id) {
return id & 0xffff;
}
- static int GetGenerationFromID(AtlasID id) {
+ int getGenerationFromID(AtlasID id) {
return (id >> 16) & 0xffff;
}
« no previous file with comments | « src/gpu/GrAtlasTextContext.cpp ('k') | src/gpu/GrBatchAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698