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 21 matching lines...) Expand all Loading... |
32 * Batches are created when GrContext processes a draw call. Batches of the same
subclass may be | 32 * Batches are created when GrContext processes a draw call. Batches of the same
subclass may be |
33 * merged using combineIfPossible. When two batches merge, one takes on the unio
n of the data | 33 * merged using combineIfPossible. When two batches merge, one takes on the unio
n of the data |
34 * and the other is left empty. The merged batch becomes responsible for drawing
the data from both | 34 * and the other is left empty. The merged batch becomes responsible for drawing
the data from both |
35 * the original batches. | 35 * the original batches. |
36 * | 36 * |
37 * If there are any possible optimizations which might require knowing more abou
t the full state of | 37 * If there are any possible optimizations which might require knowing more abou
t the full state of |
38 * the draw, ie whether or not the GrBatch is allowed to tweak alpha for coverag
e, then this | 38 * the draw, ie whether or not the GrBatch is allowed to tweak alpha for coverag
e, then this |
39 * information will be communicated to the GrBatch prior to geometry generation. | 39 * information will be communicated to the GrBatch prior to geometry generation. |
40 */ | 40 */ |
41 | 41 |
42 struct GrBatchOpt { | |
43 bool fCanTweakAlphaForCoverage; | |
44 }; | |
45 | |
46 class GrBatch : public SkRefCnt { | 42 class GrBatch : public SkRefCnt { |
47 public: | 43 public: |
48 SK_DECLARE_INST_COUNT(GrBatch) | 44 SK_DECLARE_INST_COUNT(GrBatch) |
49 GrBatch() : fNumberOfDraws(0) { SkDEBUGCODE(fUsed = false;) } | 45 GrBatch() : fNumberOfDraws(0) { SkDEBUGCODE(fUsed = false;) } |
50 virtual ~GrBatch() {} | 46 virtual ~GrBatch() {} |
51 | 47 |
52 virtual const char* name() const = 0; | 48 virtual const char* name() const = 0; |
53 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; | 49 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; |
54 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; | 50 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; |
55 | 51 |
56 /* | 52 /* |
57 * initBatchOpt is used to communicate possible optimizations to the GrBatch
. initBatchTracker | 53 * initBatchTracker is a hook for the some additional overrides / optimizati
on possibilities |
58 * is a hook for the some additional overrides from the GrXferProcessor. Th
is is a bit | 54 * from the GrXferProcessor. |
59 * confusing but has to be like this until GrBatch is everywhere. | |
60 * | |
61 * TODO combine to a single init call when GrBatch is everywhere. | |
62 */ | 55 */ |
63 virtual void initBatchOpt(const GrBatchOpt&) = 0; | |
64 virtual void initBatchTracker(const GrPipelineInfo& init) = 0; | 56 virtual void initBatchTracker(const GrPipelineInfo& init) = 0; |
65 | 57 |
66 bool combineIfPossible(GrBatch* that) { | 58 bool combineIfPossible(GrBatch* that) { |
67 if (this->classID() != that->classID()) { | 59 if (this->classID() != that->classID()) { |
68 return false; | 60 return false; |
69 } | 61 } |
70 | 62 |
71 return onCombineIfPossible(that); | 63 return onCombineIfPossible(that); |
72 } | 64 } |
73 | 65 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 static int32_t gCurrBatchClassID; | 121 static int32_t gCurrBatchClassID; |
130 | 122 |
131 SkDEBUGCODE(bool fUsed;) | 123 SkDEBUGCODE(bool fUsed;) |
132 | 124 |
133 int fNumberOfDraws; | 125 int fNumberOfDraws; |
134 | 126 |
135 typedef SkRefCnt INHERITED; | 127 typedef SkRefCnt INHERITED; |
136 }; | 128 }; |
137 | 129 |
138 #endif | 130 #endif |
OLD | NEW |