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

Side by Side Diff: src/gpu/GrAtlas.h

Issue 411703003: Add plot-based purging to GrLayerCache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Respond to code review comments Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/GrLayerCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef GrAtlas_DEFINED 9 #ifndef GrAtlas_DEFINED
10 #define GrAtlas_DEFINED 10 #define GrAtlas_DEFINED
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 typedef SkTInternalLList<GrPlot> GrPlotList; 74 typedef SkTInternalLList<GrPlot> GrPlotList;
75 75
76 class GrAtlas { 76 class GrAtlas {
77 public: 77 public:
78 // This class allows each client to independently track the GrPlots in 78 // This class allows each client to independently track the GrPlots in
79 // which its data is stored. 79 // which its data is stored.
80 class ClientPlotUsage { 80 class ClientPlotUsage {
81 public: 81 public:
82 bool isEmpty() const { return 0 == fPlots.count(); } 82 bool isEmpty() const { return 0 == fPlots.count(); }
83 83
84 #ifdef SK_DEBUG
85 bool contains(const GrPlot* plot) const {
86 return fPlots.contains(const_cast<GrPlot*>(plot));
87 }
88 #endif
89
84 private: 90 private:
85 SkTDArray<GrPlot*> fPlots; 91 SkTDArray<GrPlot*> fPlots;
86 92
87 friend class GrAtlas; 93 friend class GrAtlas;
88 }; 94 };
89 95
90 GrAtlas(GrGpu*, GrPixelConfig, GrTextureFlags flags, 96 GrAtlas(GrGpu*, GrPixelConfig, GrTextureFlags flags,
91 const SkISize& backingTextureSize, 97 const SkISize& backingTextureSize,
92 int numPlotsX, int numPlotsY, bool batchUploads); 98 int numPlotsX, int numPlotsY, bool batchUploads);
93 ~GrAtlas(); 99 ~GrAtlas();
(...skipping 11 matching lines...) Expand all
105 // get a plot that's not being used by the current draw 111 // get a plot that's not being used by the current draw
106 // this allows us to overwrite this plot without flushing 112 // this allows us to overwrite this plot without flushing
107 GrPlot* getUnusedPlot(); 113 GrPlot* getUnusedPlot();
108 114
109 GrTexture* getTexture() const { 115 GrTexture* getTexture() const {
110 return fTexture; 116 return fTexture;
111 } 117 }
112 118
113 void uploadPlotsToTexture(); 119 void uploadPlotsToTexture();
114 120
121 enum IterOrder {
122 kLRUFirst_IterOrder,
123 kMRUFirst_IterOrder
124 };
125
126 typedef GrPlotList::Iter PlotIter;
127 GrPlot* iterInit(PlotIter* iter, IterOrder order) {
128 return iter->init(fPlotList, kLRUFirst_IterOrder == order
129 ? GrPlotList::Iter::kTail _IterStart
130 : GrPlotList::Iter::kHead _IterStart);
131 }
132
115 private: 133 private:
116 void makeMRU(GrPlot* plot); 134 void makeMRU(GrPlot* plot);
117 135
118 GrGpu* fGpu; 136 GrGpu* fGpu;
119 GrPixelConfig fPixelConfig; 137 GrPixelConfig fPixelConfig;
120 GrTextureFlags fFlags; 138 GrTextureFlags fFlags;
121 GrTexture* fTexture; 139 GrTexture* fTexture;
122 SkISize fBackingTextureSize; 140 SkISize fBackingTextureSize;
123 int fNumPlotsX; 141 int fNumPlotsX;
124 int fNumPlotsY; 142 int fNumPlotsY;
125 bool fBatchUploads; 143 bool fBatchUploads;
126 144
127 // allocated array of GrPlots 145 // allocated array of GrPlots
128 GrPlot* fPlotArray; 146 GrPlot* fPlotArray;
129 // LRU list of GrPlots (MRU at head - LRU at tail) 147 // LRU list of GrPlots (MRU at head - LRU at tail)
130 GrPlotList fPlotList; 148 GrPlotList fPlotList;
131 }; 149 };
132 150
133 #endif 151 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrLayerCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698