joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 8 | #ifndef GrDrawOpAtlas_DEFINED |
| 9 | #define GrDrawOpAtlas_DEFINED |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 10 | |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 11 | #include "SkPoint.h" |
| 12 | #include "SkTDArray.h" |
| 13 | #include "SkTInternalLList.h" |
| 14 | |
Brian Salomon | 8952743 | 2016-12-16 09:52:16 -0500 | [diff] [blame] | 15 | #include "ops/GrDrawOp.h" |
joshualitt | ddd22d8 | 2016-02-16 06:47:52 -0800 | [diff] [blame] | 16 | |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 17 | class GrRectanizer; |
| 18 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 19 | struct GrDrawOpAtlasConfig { |
joshualitt | da04e0e | 2015-08-19 08:16:43 -0700 | [diff] [blame] | 20 | int numPlotsX() const { return fWidth / fPlotWidth; } |
| 21 | int numPlotsY() const { return fHeight / fPlotWidth; } |
| 22 | int fWidth; |
| 23 | int fHeight; |
jvanverth | 7023a00 | 2016-02-22 11:25:32 -0800 | [diff] [blame] | 24 | int fLog2Width; |
| 25 | int fLog2Height; |
joshualitt | da04e0e | 2015-08-19 08:16:43 -0700 | [diff] [blame] | 26 | int fPlotWidth; |
| 27 | int fPlotHeight; |
| 28 | }; |
| 29 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 30 | /** |
| 31 | * This class manages an atlas texture on behalf of GrDrawOps. The draw ops that use the atlas |
| 32 | * perform texture uploads when preparing their draws during flush. The class provides facilities |
| 33 | * for using GrDrawOpUploadToken to detect data hazards. Op's uploads are performed in "asap" mode |
| 34 | * until it is impossible to add data without overwriting texels read by draws that have not yet |
| 35 | * executed on the gpu. At that point the uploads are performed "inline" between draws. If a single |
| 36 | * draw would use enough subimage space to overflow the atlas texture then the atlas will fail to |
| 37 | * add a subimage. This gives the op the chance to end the draw and begin a new one. Additional |
| 38 | * uploads will then succeed in inline mode. |
| 39 | */ |
| 40 | class GrDrawOpAtlas { |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 41 | public: |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 42 | /** |
| 43 | * An AtlasID is an opaque handle which callers can use to determine if the atlas contains |
| 44 | * a specific piece of data. |
| 45 | */ |
joshualitt | 8db6fdc | 2015-07-31 08:25:07 -0700 | [diff] [blame] | 46 | typedef uint64_t AtlasID; |
joshualitt | 7c3a2f8 | 2015-03-31 13:32:05 -0700 | [diff] [blame] | 47 | static const uint32_t kInvalidAtlasID = 0; |
| 48 | static const uint64_t kInvalidAtlasGeneration = 0; |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 49 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 50 | /** |
| 51 | * A function pointer for use as a callback during eviction. Whenever GrDrawOpAtlas evicts a |
| 52 | * specific AtlasID, it will call all of the registered listeners so they can process the |
| 53 | * eviction. |
| 54 | */ |
| 55 | typedef void (*EvictionFunc)(GrDrawOpAtlas::AtlasID, void*); |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 56 | |
Robert Phillips | 256c37b | 2017-03-01 14:32:46 -0500 | [diff] [blame] | 57 | /** |
| 58 | * Returns a GrDrawOpAtlas. This function can be called anywhere, but the returned atlas |
| 59 | * should only be used inside of GrMeshDrawOp::onPrepareDraws. |
| 60 | * @param GrPixelConfig The pixel config which this atlas will store |
| 61 | * @param width width in pixels of the atlas |
| 62 | * @param height height in pixels of the atlas |
| 63 | * @param numPlotsX The number of plots the atlas should be broken up into in the X |
| 64 | * direction |
| 65 | * @param numPlotsY The number of plots the atlas should be broken up into in the Y |
| 66 | * direction |
| 67 | * @param func An eviction function which will be called whenever the atlas has to |
| 68 | * evict data |
| 69 | * @param data User supplied data which will be passed into func whenver an |
| 70 | * eviction occurs |
| 71 | * @return An initialized GrDrawOpAtlas, or nullptr if creation fails |
| 72 | */ |
| 73 | static std::unique_ptr<GrDrawOpAtlas> Make(GrContext*, GrPixelConfig, |
| 74 | int width, int height, |
| 75 | int numPlotsX, int numPlotsY, |
| 76 | GrDrawOpAtlas::EvictionFunc func, void* data); |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 77 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 78 | /** |
| 79 | * Adds a width x height subimage to the atlas. Upon success it returns an ID and the subimage's |
| 80 | * coordinates in the backing texture. False is returned if the subimage cannot fit in the |
| 81 | * atlas without overwriting texels that will be read in the current draw. This indicates that |
| 82 | * the op should end its current draw and begin another before adding more data. Upon success, |
| 83 | * an upload of the provided image data will have been added to the GrDrawOp::Target, in "asap" |
| 84 | * mode if possible, otherwise in "inline" mode. Successive uploads in either mode may be |
| 85 | * consolidated. |
| 86 | * NOTE: When the GrDrawOp prepares a draw that reads from the atlas, it must immediately call |
| 87 | * 'setUseToken' with the currentToken from the GrDrawOp::Target, otherwise the next call to |
| 88 | * addToAtlas might cause the previous data to be overwritten before it has been read. |
| 89 | */ |
Brian Salomon | 9afd371 | 2016-12-01 10:59:09 -0500 | [diff] [blame] | 90 | bool addToAtlas(AtlasID*, GrDrawOp::Target*, int width, int height, const void* image, |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 91 | SkIPoint16* loc); |
| 92 | |
Robert Phillips | 32f2818 | 2017-02-28 16:20:03 -0500 | [diff] [blame] | 93 | GrContext* context() const { return fContext; } |
| 94 | sk_sp<GrTextureProxy> getProxy() const { return fProxy; } |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 95 | |
joshualitt | 7c3a2f8 | 2015-03-31 13:32:05 -0700 | [diff] [blame] | 96 | uint64_t atlasGeneration() const { return fAtlasGeneration; } |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 97 | |
| 98 | inline bool hasID(AtlasID id) { |
| 99 | uint32_t index = GetIndexFromID(id); |
| 100 | SkASSERT(index < fNumPlots); |
| 101 | return fPlotArray[index]->genID() == GetGenerationFromID(id); |
| 102 | } |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 103 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 104 | /** To ensure the atlas does not evict a given entry, the client must set the last use token. */ |
| 105 | inline void setLastUseToken(AtlasID id, GrDrawOpUploadToken token) { |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 106 | SkASSERT(this->hasID(id)); |
| 107 | uint32_t index = GetIndexFromID(id); |
| 108 | SkASSERT(index < fNumPlots); |
Hal Canary | 144caf5 | 2016-11-07 17:57:18 -0500 | [diff] [blame] | 109 | this->makeMRU(fPlotArray[index].get()); |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 110 | fPlotArray[index]->setLastUseToken(token); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | inline void registerEvictionCallback(EvictionFunc func, void* userData) { |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 114 | EvictionData* data = fEvictionCallbacks.append(); |
| 115 | data->fFunc = func; |
| 116 | data->fData = userData; |
| 117 | } |
| 118 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 119 | /** |
| 120 | * A class which can be handed back to GrDrawOpAtlas for updating last use tokens in bulk. The |
| 121 | * current max number of plots the GrDrawOpAtlas can handle is 32. If in the future this is |
| 122 | * insufficient then we can move to a 64 bit int. |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 123 | */ |
| 124 | class BulkUseTokenUpdater { |
| 125 | public: |
joshualitt | 4314e08 | 2015-04-23 08:03:35 -0700 | [diff] [blame] | 126 | BulkUseTokenUpdater() : fPlotAlreadyUpdated(0) {} |
joshualitt | 7e97b0b | 2015-07-31 15:18:08 -0700 | [diff] [blame] | 127 | BulkUseTokenUpdater(const BulkUseTokenUpdater& that) |
| 128 | : fPlotsToUpdate(that.fPlotsToUpdate) |
| 129 | , fPlotAlreadyUpdated(that.fPlotAlreadyUpdated) { |
| 130 | } |
| 131 | |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 132 | void add(AtlasID id) { |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 133 | int index = GrDrawOpAtlas::GetIndexFromID(id); |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 134 | if (!this->find(index)) { |
| 135 | this->set(index); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | void reset() { |
joshualitt | 4314e08 | 2015-04-23 08:03:35 -0700 | [diff] [blame] | 140 | fPlotsToUpdate.reset(); |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 141 | fPlotAlreadyUpdated = 0; |
| 142 | } |
| 143 | |
| 144 | private: |
| 145 | bool find(int index) const { |
| 146 | SkASSERT(index < kMaxPlots); |
| 147 | return (fPlotAlreadyUpdated >> index) & 1; |
| 148 | } |
| 149 | |
| 150 | void set(int index) { |
| 151 | SkASSERT(!this->find(index)); |
| 152 | fPlotAlreadyUpdated = fPlotAlreadyUpdated | (1 << index); |
joshualitt | 97202d2 | 2015-04-22 13:47:02 -0700 | [diff] [blame] | 153 | fPlotsToUpdate.push_back(index); |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | static const int kMinItems = 4; |
| 157 | static const int kMaxPlots = 32; |
joshualitt | 97202d2 | 2015-04-22 13:47:02 -0700 | [diff] [blame] | 158 | SkSTArray<kMinItems, int, true> fPlotsToUpdate; |
joshualitt | 8672f4d | 2015-04-21 08:03:04 -0700 | [diff] [blame] | 159 | uint32_t fPlotAlreadyUpdated; |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 160 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 161 | friend class GrDrawOpAtlas; |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 162 | }; |
| 163 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 164 | void setLastUseTokenBulk(const BulkUseTokenUpdater& updater, GrDrawOpUploadToken token) { |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 165 | int count = updater.fPlotsToUpdate.count(); |
| 166 | for (int i = 0; i < count; i++) { |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 167 | Plot* plot = fPlotArray[updater.fPlotsToUpdate[i]].get(); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 168 | this->makeMRU(plot); |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 169 | plot->setLastUseToken(token); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 170 | } |
| 171 | } |
joshualitt | b4c507e | 2015-04-08 08:07:59 -0700 | [diff] [blame] | 172 | |
joshualitt | 010db53 | 2015-04-21 10:07:26 -0700 | [diff] [blame] | 173 | static const int kGlyphMaxDim = 256; |
| 174 | static bool GlyphTooLargeForAtlas(int width, int height) { |
| 175 | return width > kGlyphMaxDim || height > kGlyphMaxDim; |
| 176 | } |
| 177 | |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 178 | private: |
Jim Van Verth | d74f3f2 | 2017-08-31 16:44:08 -0400 | [diff] [blame^] | 179 | GrDrawOpAtlas(GrContext*, GrPixelConfig config, int width, int height, |
| 180 | int numPlotsX, int numPlotsY); |
Robert Phillips | 256c37b | 2017-03-01 14:32:46 -0500 | [diff] [blame] | 181 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 182 | /** |
| 183 | * The backing GrTexture for a GrDrawOpAtlas is broken into a spatial grid of Plots. The Plots |
| 184 | * keep track of subimage placement via their GrRectanizer. A Plot manages the lifetime of its |
| 185 | * data using two tokens, a last use token and a last upload token. Once a Plot is "full" (i.e. |
| 186 | * there is no room for the new subimage according to the GrRectanizer), it can no longer be |
| 187 | * used unless the last use of the Plot has already been flushed through to the gpu. |
| 188 | */ |
| 189 | class Plot : public SkRefCnt { |
| 190 | SK_DECLARE_INTERNAL_LLIST_INTERFACE(Plot); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 191 | |
| 192 | public: |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 193 | /** index() is a unique id for the plot relative to the owning GrAtlas. */ |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 194 | uint32_t index() const { return fIndex; } |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 195 | /** |
| 196 | * genID() is incremented when the plot is evicted due to a atlas spill. It is used to know |
| 197 | * if a particular subimage is still present in the atlas. |
| 198 | */ |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 199 | uint64_t genID() const { return fGenID; } |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 200 | GrDrawOpAtlas::AtlasID id() const { |
| 201 | SkASSERT(GrDrawOpAtlas::kInvalidAtlasID != fID); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 202 | return fID; |
| 203 | } |
| 204 | SkDEBUGCODE(size_t bpp() const { return fBytesPerPixel; }) |
| 205 | |
| 206 | bool addSubImage(int width, int height, const void* image, SkIPoint16* loc); |
| 207 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 208 | /** |
| 209 | * To manage the lifetime of a plot, we use two tokens. We use the last upload token to |
| 210 | * know when we can 'piggy back' uploads, i.e. if the last upload hasn't been flushed to |
| 211 | * the gpu, we don't need to issue a new upload even if we update the cpu backing store. We |
| 212 | * use lastUse to determine when we can evict a plot from the cache, i.e. if the last use |
| 213 | * has already flushed through the gpu then we can reuse the plot. |
| 214 | */ |
Brian Salomon | 9afd371 | 2016-12-01 10:59:09 -0500 | [diff] [blame] | 215 | GrDrawOpUploadToken lastUploadToken() const { return fLastUpload; } |
| 216 | GrDrawOpUploadToken lastUseToken() const { return fLastUse; } |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 217 | void setLastUploadToken(GrDrawOpUploadToken token) { fLastUpload = token; } |
| 218 | void setLastUseToken(GrDrawOpUploadToken token) { fLastUse = token; } |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 219 | |
Robert Phillips | acaa607 | 2017-07-28 10:54:53 -0400 | [diff] [blame] | 220 | void uploadToTexture(GrDrawOp::WritePixelsFn&, GrTextureProxy*); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 221 | void resetRects(); |
| 222 | |
| 223 | private: |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 224 | Plot(int index, uint64_t genID, int offX, int offY, int width, int height, |
| 225 | GrPixelConfig config); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 226 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 227 | ~Plot() override; |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 228 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 229 | /** |
| 230 | * Create a clone of this plot. The cloned plot will take the place of the current plot in |
| 231 | * the atlas |
| 232 | */ |
| 233 | Plot* clone() const { |
| 234 | return new Plot(fIndex, fGenID + 1, fX, fY, fWidth, fHeight, fConfig); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 235 | } |
| 236 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 237 | static GrDrawOpAtlas::AtlasID CreateId(uint32_t index, uint64_t generation) { |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 238 | SkASSERT(index < (1 << 16)); |
| 239 | SkASSERT(generation < ((uint64_t)1 << 48)); |
| 240 | return generation << 16 | index; |
| 241 | } |
| 242 | |
Brian Salomon | 9afd371 | 2016-12-01 10:59:09 -0500 | [diff] [blame] | 243 | GrDrawOpUploadToken fLastUpload; |
| 244 | GrDrawOpUploadToken fLastUse; |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 245 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 246 | const uint32_t fIndex; |
| 247 | uint64_t fGenID; |
| 248 | GrDrawOpAtlas::AtlasID fID; |
| 249 | unsigned char* fData; |
| 250 | const int fWidth; |
| 251 | const int fHeight; |
| 252 | const int fX; |
| 253 | const int fY; |
| 254 | GrRectanizer* fRects; |
| 255 | const SkIPoint16 fOffset; // the offset of the plot in the backing texture |
| 256 | const GrPixelConfig fConfig; |
| 257 | const size_t fBytesPerPixel; |
| 258 | SkIRect fDirtyRect; |
| 259 | SkDEBUGCODE(bool fDirty); |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 260 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 261 | friend class GrDrawOpAtlas; |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 262 | |
| 263 | typedef SkRefCnt INHERITED; |
| 264 | }; |
| 265 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 266 | typedef SkTInternalLList<Plot> PlotList; |
robertphillips | 2b0536f | 2015-11-06 14:10:42 -0800 | [diff] [blame] | 267 | |
joshualitt | 8db6fdc | 2015-07-31 08:25:07 -0700 | [diff] [blame] | 268 | static uint32_t GetIndexFromID(AtlasID id) { |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 269 | return id & 0xffff; |
| 270 | } |
| 271 | |
joshualitt | 8db6fdc | 2015-07-31 08:25:07 -0700 | [diff] [blame] | 272 | // top 48 bits are reserved for the generation ID |
| 273 | static uint64_t GetGenerationFromID(AtlasID id) { |
| 274 | return (id >> 16) & 0xffffffffffff; |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 275 | } |
| 276 | |
Robert Phillips | 256c37b | 2017-03-01 14:32:46 -0500 | [diff] [blame] | 277 | inline bool updatePlot(GrDrawOp::Target*, AtlasID*, Plot*); |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 278 | |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 279 | inline void makeMRU(Plot* plot) { |
joshualitt | 5df175e | 2015-11-18 13:37:54 -0800 | [diff] [blame] | 280 | if (fPlotList.head() == plot) { |
| 281 | return; |
| 282 | } |
| 283 | |
| 284 | fPlotList.remove(plot); |
| 285 | fPlotList.addToHead(plot); |
| 286 | } |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 287 | |
| 288 | inline void processEviction(AtlasID); |
| 289 | |
Robert Phillips | 32f2818 | 2017-02-28 16:20:03 -0500 | [diff] [blame] | 290 | GrContext* fContext; |
| 291 | sk_sp<GrTextureProxy> fProxy; |
Jim Van Verth | d74f3f2 | 2017-08-31 16:44:08 -0400 | [diff] [blame^] | 292 | GrPixelConfig fPixelConfig; |
| 293 | int fTextureWidth; |
| 294 | int fTextureHeight; |
Robert Phillips | 32f2818 | 2017-02-28 16:20:03 -0500 | [diff] [blame] | 295 | int fPlotWidth; |
| 296 | int fPlotHeight; |
| 297 | SkDEBUGCODE(uint32_t fNumPlots;) |
robertphillips | 2b0536f | 2015-11-06 14:10:42 -0800 | [diff] [blame] | 298 | |
Robert Phillips | 32f2818 | 2017-02-28 16:20:03 -0500 | [diff] [blame] | 299 | uint64_t fAtlasGeneration; |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 300 | |
| 301 | struct EvictionData { |
| 302 | EvictionFunc fFunc; |
| 303 | void* fData; |
| 304 | }; |
| 305 | |
| 306 | SkTDArray<EvictionData> fEvictionCallbacks; |
Brian Salomon | 2ee084e | 2016-12-16 18:59:19 -0500 | [diff] [blame] | 307 | // allocated array of Plots |
| 308 | std::unique_ptr<sk_sp<Plot>[]> fPlotArray; |
| 309 | // LRU list of Plots (MRU at head - LRU at tail) |
| 310 | PlotList fPlotList; |
joshualitt | 5bf99f1 | 2015-03-13 11:47:42 -0700 | [diff] [blame] | 311 | }; |
| 312 | |
| 313 | #endif |