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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 (drawState.fCoverageStages[i], hasLocalCoords)); | 116 (drawState.fCoverageStages[i], hasLocalCoords)); |
117 } | 117 } |
118 | 118 |
119 this->setOutputStateInfo(drawState, blendOpt, caps); | 119 this->setOutputStateInfo(drawState, blendOpt, caps); |
120 | 120 |
121 // let the GP init the batch tracker | 121 // let the GP init the batch tracker |
122 if (drawState.hasGeometryProcessor()) { | 122 if (drawState.hasGeometryProcessor()) { |
123 GrGeometryProcessor::InitBT init; | 123 GrGeometryProcessor::InitBT init; |
124 init.fOutputColor = fDescInfo.fInputColorIsUsed; | 124 init.fOutputColor = fDescInfo.fInputColorIsUsed; |
125 init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed; | 125 init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed; |
126 init.fRemoveColorAttr = !fDescInfo.fHasVertexColor; | |
127 init.fRemoveCoverageAttr = !fDescInfo.fHasVertexCoverage; | |
126 init.fColor = this->getColor(); | 128 init.fColor = this->getColor(); |
127 init.fCoverage = this->getCoverage(); | 129 init.fCoverage = this->getCoverageColor(); |
128 fGeometryProcessor->initBatchTracker(&fBatchTracker, init); | 130 fGeometryProcessor->initBatchTracker(&fBatchTracker, init); |
129 } | 131 } |
130 } | 132 } |
131 | 133 |
132 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, | 134 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, |
133 GrDrawState::BlendOpt blendOpt, | 135 GrDrawState::BlendOpt blendOpt, |
134 const GrDrawTargetCaps& caps) { | 136 const GrDrawTargetCaps& caps) { |
135 // Set this default and then possibly change our mind if there is coverage. | 137 // Set this default and then possibly change our mind if there is coverage. |
136 fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; | 138 fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; |
137 fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; | 139 fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 return false; | 258 return false; |
257 } | 259 } |
258 | 260 |
259 if (!fDescInfo.fHasVertexCoverage && this->fCoverage != that.fCoverage) { | 261 if (!fDescInfo.fHasVertexCoverage && this->fCoverage != that.fCoverage) { |
260 return false; | 262 return false; |
261 } | 263 } |
262 | 264 |
263 if (this->hasGeometryProcessor()) { | 265 if (this->hasGeometryProcessor()) { |
264 if (!that.hasGeometryProcessor()) { | 266 if (!that.hasGeometryProcessor()) { |
265 return false; | 267 return false; |
266 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce ssor())) { | 268 } else if (!this->getGeometryProcessor()->isEqual(*that.getGeometryProce ssor())) { |
bsalomon
2014/12/05 14:43:03
Should we get rid of isEqual() in favor of canBatc
| |
267 return false; | 269 return false; |
270 } else if (this->getGeometryProcessor()->fNewStyle) { | |
271 if (!this->getGeometryProcessor()->canBatch(this->getBatchTracker(), | |
272 that.getBatchTracker())) { | |
273 return false; | |
274 } | |
268 } | 275 } |
269 } else if (that.hasGeometryProcessor()) { | 276 } else if (that.hasGeometryProcessor()) { |
270 return false; | 277 return false; |
271 } | 278 } |
272 | 279 |
273 // The program desc comparison should have already assured that the stage co unts match. | 280 // The program desc comparison should have already assured that the stage co unts match. |
274 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 281 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
275 for (int i = 0; i < this->numFragmentStages(); i++) { | 282 for (int i = 0; i < this->numFragmentStages(); i++) { |
276 | 283 |
277 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 284 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
278 return false; | 285 return false; |
279 } | 286 } |
280 } | 287 } |
288 | |
281 return true; | 289 return true; |
282 } | 290 } |
283 | 291 |
OLD | NEW |