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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 class GrBatch : public GrNonAtomicRef { | 48 class GrBatch : public GrNonAtomicRef { |
49 public: | 49 public: |
50 GrBatch(); | 50 GrBatch(); |
51 ~GrBatch() override; | 51 ~GrBatch() override; |
52 | 52 |
53 virtual const char* name() const = 0; | 53 virtual const char* name() const = 0; |
54 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; | 54 virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0; |
55 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; | 55 virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const =
0; |
56 | 56 |
57 bool combineIfPossible(GrBatch* that) { | 57 bool combineIfPossible(GrBatch* that, const GrCaps& caps) { |
58 if (this->classID() != that->classID()) { | 58 if (this->classID() != that->classID()) { |
59 return false; | 59 return false; |
60 } | 60 } |
61 | 61 |
62 return this->onCombineIfPossible(that); | 62 return this->onCombineIfPossible(that, caps); |
63 } | 63 } |
64 | 64 |
65 virtual bool onCombineIfPossible(GrBatch*) = 0; | |
66 | |
67 virtual void generateGeometry(GrBatchTarget*) = 0; | 65 virtual void generateGeometry(GrBatchTarget*) = 0; |
68 | 66 |
69 const SkRect& bounds() const { return fBounds; } | 67 const SkRect& bounds() const { return fBounds; } |
70 | 68 |
71 // TODO this goes away when batches are everywhere | 69 // TODO this goes away when batches are everywhere |
72 void setNumberOfDraws(int numberOfDraws) { fNumberOfDraws = numberOfDraws; } | 70 void setNumberOfDraws(int numberOfDraws) { fNumberOfDraws = numberOfDraws; } |
73 int numberOfDraws() const { return fNumberOfDraws; } | 71 int numberOfDraws() const { return fNumberOfDraws; } |
74 | 72 |
75 void* operator new(size_t size); | 73 void* operator new(size_t size); |
76 void operator delete(void* target); | 74 void operator delete(void* target); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 using InstancedHelper::issueDraw; | 153 using InstancedHelper::issueDraw; |
156 | 154 |
157 private: | 155 private: |
158 typedef InstancedHelper INHERITED; | 156 typedef InstancedHelper INHERITED; |
159 }; | 157 }; |
160 | 158 |
161 uint32_t fClassID; | 159 uint32_t fClassID; |
162 SkRect fBounds; | 160 SkRect fBounds; |
163 | 161 |
164 private: | 162 private: |
| 163 virtual bool onCombineIfPossible(GrBatch*, const GrCaps& caps) = 0; |
| 164 |
165 /* | 165 /* |
166 * initBatchTracker is a hook for the some additional overrides / optimizati
on possibilities | 166 * initBatchTracker is a hook for the some additional overrides / optimizati
on possibilities |
167 * from the GrXferProcessor. | 167 * from the GrXferProcessor. |
168 */ | 168 */ |
169 virtual void initBatchTracker(const GrPipelineOptimizations&) = 0; | 169 virtual void initBatchTracker(const GrPipelineOptimizations&) = 0; |
170 | 170 |
171 | 171 |
172 static uint32_t GenID(int32_t* idCounter) { | 172 static uint32_t GenID(int32_t* idCounter) { |
173 // fCurrProcessorClassID has been initialized to kIllegalProcessorClassI
D. The | 173 // fCurrProcessorClassID has been initialized to kIllegalProcessorClassI
D. The |
174 // atomic inc returns the old value not the incremented value. So we add | 174 // atomic inc returns the old value not the incremented value. So we add |
(...skipping 15 matching lines...) Expand all Loading... |
190 bool fPipelineInstalled; | 190 bool fPipelineInstalled; |
191 #if GR_BATCH_SPEW | 191 #if GR_BATCH_SPEW |
192 uint32_t fUniqueID; | 192 uint32_t fUniqueID; |
193 static int32_t gCurrBatchUniqueID; | 193 static int32_t gCurrBatchUniqueID; |
194 #endif | 194 #endif |
195 static int32_t gCurrBatchClassID; | 195 static int32_t gCurrBatchClassID; |
196 typedef SkRefCnt INHERITED; | 196 typedef SkRefCnt INHERITED; |
197 }; | 197 }; |
198 | 198 |
199 #endif | 199 #endif |
OLD | NEW |