OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrBatchAtlas.h" | 8 #include "GrBatchAtlas.h" |
9 #include "GrBatchTarget.h" | 9 #include "GrBatchTarget.h" |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // The backing GrTexture for a GrBatchAtlas is broken into a spatial grid of GrB
atchPlots. | 26 // The backing GrTexture for a GrBatchAtlas is broken into a spatial grid of GrB
atchPlots. |
27 // The GrBatchPlots keep track of subimage placement via their GrRectanizer. In
turn, a GrBatchPlot | 27 // The GrBatchPlots keep track of subimage placement via their GrRectanizer. In
turn, a GrBatchPlot |
28 // manages the lifetime of its data using two tokens, a last ref toke and a last
upload token. | 28 // manages the lifetime of its data using two tokens, a last ref toke and a last
upload token. |
29 // Once a GrBatchPlot is "full" (i.e. there is no room for the new subimage acco
rding to the | 29 // Once a GrBatchPlot is "full" (i.e. there is no room for the new subimage acco
rding to the |
30 // GrRectanizer), it can no longer be used unless the last ref on the GrPlot has
already been | 30 // GrRectanizer), it can no longer be used unless the last ref on the GrPlot has
already been |
31 // flushed through to the gpu. | 31 // flushed through to the gpu. |
32 | 32 |
33 class BatchPlot : public SkRefCnt { | 33 class BatchPlot : public SkRefCnt { |
34 public: | 34 public: |
35 typedef GrBatchAtlas::BatchToken BatchToken; | 35 typedef GrBatchAtlas::BatchToken BatchToken; |
36 SK_DECLARE_INST_COUNT(BatchPlot); | 36 |
37 SK_DECLARE_INTERNAL_LLIST_INTERFACE(BatchPlot); | 37 SK_DECLARE_INTERNAL_LLIST_INTERFACE(BatchPlot); |
38 | 38 |
39 // index() refers to the index of the plot in the owning GrAtlas's plot arra
y. genID() is a | 39 // index() refers to the index of the plot in the owning GrAtlas's plot arra
y. genID() is a |
40 // monotonically incrementing number which is bumped every time the cpu back
ing store is | 40 // monotonically incrementing number which is bumped every time the cpu back
ing store is |
41 // wiped, or when the plot itself is evicted from the atlas(ie, there is con
tinuity in genID() | 41 // wiped, or when the plot itself is evicted from the atlas(ie, there is con
tinuity in genID() |
42 // across atlas spills) | 42 // across atlas spills) |
43 int index() const { return fIndex; } | 43 int index() const { return fIndex; } |
44 int genID() const { return fGenID; } | 44 int genID() const { return fGenID; } |
45 GrBatchAtlas::AtlasID id() { return fID; } | 45 GrBatchAtlas::AtlasID id() { return fID; } |
46 | 46 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 | 367 |
368 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, Batch
Token batchToken) { | 368 void GrBatchAtlas::setLastUseTokenBulk(const BulkUseTokenUpdater& updater, Batch
Token batchToken) { |
369 int count = updater.fPlotsToUpdate.count(); | 369 int count = updater.fPlotsToUpdate.count(); |
370 for (int i = 0; i < count; i++) { | 370 for (int i = 0; i < count; i++) { |
371 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; | 371 BatchPlot* plot = fPlotArray[updater.fPlotsToUpdate[i]]; |
372 this->makeMRU(plot); | 372 this->makeMRU(plot); |
373 plot->setLastUseToken(batchToken); | 373 plot->setLastUseToken(batchToken); |
374 } | 374 } |
375 } | 375 } |
OLD | NEW |