aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrBatchAtlas.h
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@google.com>2015-04-07 10:21:27 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-07 10:21:27 -0700
commit3cf9863bb658d637416c4edbf278b0311dba7478 (patch)
tree32326eb6636e2326baf8ce910bd454798426fce1 /src/gpu/GrBatchAtlas.h
parent7281c61e7bc689d484dcbda49be3cef4ce4f11c2 (diff)
Revert of Adding bulk plot reffer to cached textblobs (patchset #7 id:110001 of https://codereview.chromium.org/1050113004/)
Reason for revert: Breaks linux builder Original issue's description: > Adding bulk plot reffer to cached textblobs > > This change will prevent the atlas from evicting glyphs the TextBlob > needs. > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/7281c61e7bc689d484dcbda49be3cef4ce4f11c2 TBR=bsalomon@google.com,jvanverth@google.com,robertphillips@google.com,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1061713003
Diffstat (limited to 'src/gpu/GrBatchAtlas.h')
-rw-r--r--src/gpu/GrBatchAtlas.h51
1 files changed, 3 insertions, 48 deletions
diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h
index ddafcaeea7..cd8123f140 100644
--- a/src/gpu/GrBatchAtlas.h
+++ b/src/gpu/GrBatchAtlas.h
@@ -40,9 +40,6 @@ public:
// 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 @@ public:
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;
}