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 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ | 110 for (int i = firstCoverageStageIdx; i < drawState.numCoverageStages(); ++i)
{ |
111 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, | 111 SkNEW_APPEND_TO_TARRAY(&fFragmentStages, |
112 GrPendingFragmentStage, | 112 GrPendingFragmentStage, |
113 (drawState.fCoverageStages[i], hasLocalCoords)); | 113 (drawState.fCoverageStages[i], hasLocalCoords)); |
114 } | 114 } |
115 | 115 |
116 this->setOutputStateInfo(drawState, blendOpt, *gpu->caps(), &descInfo); | 116 this->setOutputStateInfo(drawState, blendOpt, *gpu->caps(), &descInfo); |
117 | 117 |
118 // now create a key | 118 // now create a key |
119 gpu->buildProgramDesc(*this, descInfo, drawType, &fDesc); | 119 gpu->buildProgramDesc(*this, descInfo, drawType, &fDesc); |
| 120 |
| 121 // let the GP init the batch tracker |
| 122 if (drawState.hasGeometryProcessor()) { |
| 123 GrGeometryProcessor::InitBT init; |
| 124 init.fOutputColor = descInfo.fInputColorIsUsed; |
| 125 init.fOutputCoverage = descInfo.fInputCoverageIsUsed; |
| 126 init.fColor = this->getColor(); |
| 127 init.fCoverage = this->getCoverage(); |
| 128 fGeometryProcessor->initBatchTracker(&fBatchTracker, init); |
| 129 } |
120 }; | 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 GrProgramDesc::DescInfo* descInfo) { | 135 GrProgramDesc::DescInfo* descInfo) { |
126 // Set this default and then possibly change our mind if there is coverage. | 136 // Set this default and then possibly change our mind if there is coverage. |
127 descInfo->fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; | 137 descInfo->fPrimaryOutputType = GrProgramDesc::kModulate_PrimaryOutputType; |
128 descInfo->fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; | 138 descInfo->fSecondaryOutputType = GrProgramDesc::kNone_SecondaryOutputType; |
129 | 139 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); | 271 SkASSERT(this->numFragmentStages() == that.numFragmentStages()); |
262 for (int i = 0; i < this->numFragmentStages(); i++) { | 272 for (int i = 0; i < this->numFragmentStages(); i++) { |
263 | 273 |
264 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { | 274 if (this->getFragmentStage(i) != that.getFragmentStage(i)) { |
265 return false; | 275 return false; |
266 } | 276 } |
267 } | 277 } |
268 return true; | 278 return true; |
269 } | 279 } |
270 | 280 |
OLD | NEW |