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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 (drawState.fColorStages[i], hasLocalCoords)); | 110 (drawState.fColorStages[i], hasLocalCoords)); |
111 } | 111 } |
112 fNumColorStages = fFragmentStages.count(); | 112 fNumColorStages = fFragmentStages.count(); |
113 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ | 113 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ |
114 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 114 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
115 GrPendingFragmentStage, | 115 GrPendingFragmentStage, |
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 |
| 122 if (drawState.hasGeometryProcessor()) { |
| 123 GrGeometryProcessor::InitBT init; |
| 124 init.fOutputColor = fDescInfo.fInputColorIsUsed; |
| 125 init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed; |
| 126 init.fColor = this->getColor(); |
| 127 init.fCoverage = this->getCoverage(); |
| 128 fGeometryProcessor->initBatchTracker(&fBatchTracker, init); |
| 129 } |
| 130 } |
121 | 131 |
122 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, | 132 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, |
123 GrDrawState::BlendOpt blendOpt, | 133 GrDrawState::BlendOpt blendOpt, |
124 const GrDrawTargetCaps& caps) { | 134 const GrDrawTargetCaps& caps) { |
125 // Set this default and then possibly change our mind if there is coverage. | 135 // Set this default and then possibly change our mind if there is coverage. |
126 fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; | 136 fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; |
127 fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; | 137 fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; |
128 | 138 |
129 // Determine whether we should use dual source blending or shader code to ke
ep coverage | 139 // Determine whether we should use dual source blending or shader code to ke
ep coverage |
130 // separate from color. | 140 // separate from color. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 274 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
265 for (int i = 0; i < this->numFragmentStages(); i++) { | 275 for (int i = 0; i < this->numFragmentStages(); i++) { |
266 | 276 |
267 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 277 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
268 return false; | 278 return false; |
269 } | 279 } |
270 } | 280 } |
271 return true; | 281 return true; |
272 } | 282 } |
273 | 283 |
OLD | NEW |