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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 if (stage.getFragmentProcessor()->willReadFragmentPosition()) { | 238 if (stage.getFragmentProcessor()->willReadFragmentPosition()) { |
239 *readsFragPosition = true; | 239 *readsFragPosition = true; |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 void GrOptDrawState::getStageStats() { | 243 void GrOptDrawState::getStageStats() { |
244 // We will need a local coord attrib if there is one currently set on the op
tState and we are | 244 // We will need a local coord attrib if there is one currently set on the op
tState and we are |
245 // actually generating some effect code | 245 // actually generating some effect code |
246 fRequiresLocalCoordAttrib = this->hasLocalCoordAttribute() && this->numTotal
Stages() > 0; | 246 fRequiresLocalCoordAttrib = this->hasLocalCoordAttribute() && this->numTotal
Stages() > 0; |
247 | 247 |
248 // if 1 == fVACount then that VA must be position, otherwise it contains som
e attribute which | |
249 // will require a vertexShader | |
250 fRequiresVertexShader = fVACount > 1; | |
251 | |
252 fReadsDst = false; | 248 fReadsDst = false; |
253 fReadsFragPosition = false; | 249 fReadsFragPosition = false; |
254 | 250 |
255 for (int s = 0; s < this->numColorStages(); ++s) { | 251 for (int s = 0; s < this->numColorStages(); ++s) { |
256 const GrFragmentStage& stage = this->getColorStage(s); | 252 const GrFragmentStage& stage = this->getColorStage(s); |
257 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); | 253 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); |
258 } | 254 } |
259 for (int s = 0; s < this->numCoverageStages(); ++s) { | 255 for (int s = 0; s < this->numCoverageStages(); ++s) { |
260 const GrFragmentStage& stage = this->getCoverageStage(s); | 256 const GrFragmentStage& stage = this->getCoverageStage(s); |
261 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); | 257 get_stage_stats(stage, &fReadsDst, &fReadsFragPosition); |
262 } | 258 } |
263 if (this->hasGeometryProcessor()) { | 259 if (this->hasGeometryProcessor()) { |
264 const GrGeometryStage& stage = *this->getGeometryProcessor(); | 260 const GrGeometryStage& stage = *this->getGeometryProcessor(); |
265 fReadsFragPosition = fReadsFragPosition || stage.getProcessor()->willRea
dFragmentPosition(); | 261 fReadsFragPosition = fReadsFragPosition || stage.getProcessor()->willRea
dFragmentPosition(); |
266 SkASSERT(fRequiresVertexShader); | |
267 } | 262 } |
268 } | 263 } |
269 | 264 |
270 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { | 265 bool GrOptDrawState::operator== (const GrOptDrawState& that) const { |
271 return this->isEqual(that); | 266 return this->isEqual(that); |
272 } | 267 } |
273 | 268 |
OLD | NEW |