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 #ifndef GrBatch_DEFINED | 8 #ifndef GrBatch_DEFINED |
9 #define GrBatch_DEFINED | 9 #define GrBatch_DEFINED |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 /** | 22 /** |
23 * GrBatch is the base class for all Ganesh deferred geometry generators. To fa
cilitate | 23 * GrBatch is the base class for all Ganesh deferred geometry generators. To fa
cilitate |
24 * reorderable batching, Ganesh does not generate geometry inline with draw call
s. Instead, it | 24 * reorderable batching, Ganesh does not generate geometry inline with draw call
s. Instead, it |
25 * captures the arguments to the draw and then generates the geometry on demand.
This gives GrBatch | 25 * captures the arguments to the draw and then generates the geometry on demand.
This gives GrBatch |
26 * subclasses complete freedom to decide how / what they can batch. | 26 * subclasses complete freedom to decide how / what they can batch. |
27 * | 27 * |
28 * Batches are created when GrContext processes a draw call. Batches of the same
subclass may be | 28 * Batches are created when GrContext processes a draw call. Batches of the same
subclass may be |
29 * merged using combineIfPossible. When two batches merge, one takes on the unio
n of the data | 29 * merged using combineIfPossible. When two batches merge, one takes on the unio
n of the data |
30 * and the other is left empty. The merged batch becomes responsible for drawing
the data from both | 30 * and the other is left empty. The merged batch becomes responsible for drawing
the data from both |
31 * the original batches. The merged patch may ref the other batch, if this is mo
re efficient than | 31 * the original batches. |
32 * moving the data from the other batch to the merged batch. | |
33 * | 32 * |
34 * If there are any possible optimizations which might require knowing more abou
t the full state of | 33 * If there are any possible optimizations which might require knowing more abou
t the full state of |
35 * the draw, ie whether or not the GrBatch is allowed to tweak alpha for coverag
e, then this | 34 * the draw, ie whether or not the GrBatch is allowed to tweak alpha for coverag
e, then this |
36 * information will be communicated to the GrBatch prior to geometry generation. | 35 * information will be communicated to the GrBatch prior to geometry generation. |
37 * | 36 * |
38 * The bounds of the batch must contain all the vertices in device space *irresp
ective* of the clip. | 37 * The bounds of the batch must contain all the vertices in device space *irresp
ective* of the clip. |
39 * The bounds are used in determining which clip elements must be applied and th
us the bounds cannot | 38 * The bounds are used in determining which clip elements must be applied and th
us the bounds cannot |
40 * in turn depend upon the clip. | 39 * in turn depend upon the clip. |
41 */ | 40 */ |
42 #define GR_BATCH_SPEW 0 | 41 #define GR_BATCH_SPEW 0 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 158 |
160 SkDEBUGCODE(bool fUsed;) | 159 SkDEBUGCODE(bool fUsed;) |
161 const uint32_t fClassID; | 160 const uint32_t fClassID; |
162 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } | 161 static uint32_t GenBatchID() { return GenID(&gCurrBatchUniqueID); } |
163 mutable uint32_t fUniqueID; | 162 mutable uint32_t fUniqueID; |
164 static int32_t gCurrBatchUniqueID; | 163 static int32_t gCurrBatchUniqueID; |
165 static int32_t gCurrBatchClassID; | 164 static int32_t gCurrBatchClassID; |
166 }; | 165 }; |
167 | 166 |
168 #endif | 167 #endif |
OLD | NEW |