OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrOptDrawState.h" | 8 #include "GrOptDrawState.h" |
9 | 9 |
10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 141 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
142 GrPendingFragmentStage, | 142 GrPendingFragmentStage, |
143 (drawState.fCoverageStages[i], hasLocalCoords)); | 143 (drawState.fCoverageStages[i], hasLocalCoords)); |
144 } | 144 } |
145 | 145 |
146 // let the GP init the batch tracker | 146 // let the GP init the batch tracker |
147 if (gp) { | 147 if (gp) { |
148 GrGeometryProcessor::InitBT init; | 148 GrGeometryProcessor::InitBT init; |
149 init.fOutputColor = fDescInfo.fInputColorIsUsed; | 149 init.fOutputColor = fDescInfo.fInputColorIsUsed; |
150 init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed; | 150 init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed; |
| 151 init.fRemoveColorAttr = !fDescInfo.fHasVertexColor; |
| 152 init.fRemoveCoverageAttr = !fDescInfo.fHasVertexCoverage; |
151 init.fColor = this->getColor(); | 153 init.fColor = this->getColor(); |
152 init.fCoverage = this->getCoverage(); | 154 init.fCoverage = this->getCoverageColor(); |
153 fGeometryProcessor->initBatchTracker(&fBatchTracker, init); | 155 fGeometryProcessor->initBatchTracker(&fBatchTracker, init); |
154 } | 156 } |
155 } | 157 } |
156 | 158 |
157 void GrOptDrawState::adjustProgramFromOptimizations(const GrDrawState& ds, | 159 void GrOptDrawState::adjustProgramFromOptimizations(const GrDrawState& ds, |
158 GrXferProcessor::OptFlags fl
ags, | 160 GrXferProcessor::OptFlags fl
ags, |
159 const GrProcOptInfo& colorPO
I, | 161 const GrProcOptInfo& colorPO
I, |
160 const GrProcOptInfo& coverag
ePOI, | 162 const GrProcOptInfo& coverag
ePOI, |
161 int* firstColorStageIdx, | 163 int* firstColorStageIdx, |
162 int* firstCoverageStageIdx)
{ | 164 int* firstCoverageStageIdx)
{ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 222 |
221 if (!fDescInfo.fHasVertexCoverage && this->fCoverage != that.fCoverage) { | 223 if (!fDescInfo.fHasVertexCoverage && this->fCoverage != that.fCoverage) { |
222 return false; | 224 return false; |
223 } | 225 } |
224 | 226 |
225 if (this->hasGeometryProcessor()) { | 227 if (this->hasGeometryProcessor()) { |
226 if (!that.hasGeometryProcessor()) { | 228 if (!that.hasGeometryProcessor()) { |
227 return false; | 229 return false; |
228 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { | 230 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce
ssor())) { |
229 return false; | 231 return false; |
| 232 } else if (this->getGeometryProcessor()->fNewStyle) { |
| 233 if (!this->getGeometryProcessor()->canBatch(this->getBatchTracker(), |
| 234 that.getBatchTracker()))
{ |
| 235 return false; |
| 236 } |
230 } | 237 } |
231 } else if (that.hasGeometryProcessor()) { | 238 } else if (that.hasGeometryProcessor()) { |
232 return false; | 239 return false; |
233 } | 240 } |
234 | 241 |
235 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) { | 242 if (!this->getXferProcessor()->isEqual(*that.getXferProcessor())) { |
236 return false; | 243 return false; |
237 } | 244 } |
238 | 245 |
239 // The program desc comparison should have already assured that the stage co
unts match. | 246 // The program desc comparison should have already assured that the stage co
unts match. |
240 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 247 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
241 for (int i = 0; i < this->numFragmentStages(); i++) { | 248 for (int i = 0; i < this->numFragmentStages(); i++) { |
242 | 249 |
243 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 250 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
244 return false; | 251 return false; |
245 } | 252 } |
246 } | 253 } |
| 254 |
247 return true; | 255 return true; |
248 } | 256 } |
249 | 257 |
OLD | NEW |