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 } | |
131 | 121 |
132 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, | 122 void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, |
133 GrDrawState::BlendOpt blendOpt, | 123 GrDrawState::BlendOpt blendOpt, |
134 const GrDrawTargetCaps& caps) { | 124 const GrDrawTargetCaps& caps) { |
135 // Set this default and then possibly change our mind if there is coverage. | 125 // Set this default and then possibly change our mind if there is coverage. |
136 fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; | 126 fDescInfo.fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; |
137 fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; | 127 fDescInfo.fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; |
138 | 128 |
139 // Determine whether we should use dual source blending or shader code to ke
ep coverage | 129 // Determine whether we should use dual source blending or shader code to ke
ep coverage |
140 // separate from color. | 130 // separate from color. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 268 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
279 for (int i = 0; i < this->numFragmentStages(); i++) { | 269 for (int i = 0; i < this->numFragmentStages(); i++) { |
280 | 270 |
281 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 271 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
282 return false; | 272 return false; |
283 } | 273 } |
284 } | 274 } |
285 return true; | 275 return true; |
286 } | 276 } |
287 | 277 |
OLD | NEW |