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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 inout.fColor = 0xFF << GrColor_SHIFT_A; | 215 inout.fColor = 0xFF << GrColor_SHIFT_A; |
216 inout.fValidFlags = kA_GrColorComponentFlag; | 216 inout.fValidFlags = kA_GrColorComponentFlag; |
217 } else { | 217 } else { |
218 inout.fValidFlags = 0; | 218 inout.fValidFlags = 0; |
219 // not strictly necessary but we get false alarms from tools about u
ninit. | 219 // not strictly necessary but we get false alarms from tools about u
ninit. |
220 inout.fColor = 0; | 220 inout.fColor = 0; |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 for (int i = 0; i < ds.numColorStages(); ++i) { | 224 for (int i = 0; i < ds.numColorStages(); ++i) { |
225 const GrFragmentProcessor* fp = ds.getColorStage(i).getProcessor(); | 225 const GrFragmentProcessor* fp = ds.getColorStage(i).getFragmentProcessor
(); |
226 if (!fp->willUseInputColor()) { | 226 if (!fp->willUseInputColor()) { |
227 firstColorStage = i; | 227 firstColorStage = i; |
228 fInputColorIsUsed = false; | 228 fInputColorIsUsed = false; |
229 } | 229 } |
230 fp->computeInvariantOutput(&inout); | 230 fp->computeInvariantOutput(&inout); |
231 if (kRGBA_GrColorComponentFlags == inout.fValidFlags) { | 231 if (kRGBA_GrColorComponentFlags == inout.fValidFlags) { |
232 firstColorStage = i + 1; | 232 firstColorStage = i + 1; |
233 fColor = inout.fColor; | 233 fColor = inout.fColor; |
234 fInputColorIsUsed = true; | 234 fInputColorIsUsed = true; |
235 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribB
inding); | 235 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribB
inding); |
(...skipping 27 matching lines...) Expand all Loading... |
263 #endif | 263 #endif |
264 if (ds.numCoverageStages() > 0) { | 264 if (ds.numCoverageStages() > 0) { |
265 fCoverageStages.reset(&ds.getCoverageStage(firstCoverageStage), | 265 fCoverageStages.reset(&ds.getCoverageStage(firstCoverageStage), |
266 ds.numCoverageStages() - firstCoverageStage); | 266 ds.numCoverageStages() - firstCoverageStage); |
267 } else { | 267 } else { |
268 fCoverageStages.reset(); | 268 fCoverageStages.reset(); |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 static void get_stage_stats(const GrFragmentStage& stage, bool* readsDst, bool*
readsFragPosition) { | 272 static void get_stage_stats(const GrFragmentStage& stage, bool* readsDst, bool*
readsFragPosition) { |
273 if (stage.getProcessor()->willReadDstColor()) { | 273 if (stage.getFragmentProcessor()->willReadDstColor()) { |
274 *readsDst = true; | 274 *readsDst = true; |
275 } | 275 } |
276 if (stage.getProcessor()->willReadFragmentPosition()) { | 276 if (stage.getFragmentProcessor()->willReadFragmentPosition()) { |
277 *readsFragPosition = true; | 277 *readsFragPosition = true; |
278 } | 278 } |
279 } | 279 } |
280 | 280 |
281 void GrOptDrawState::getStageStats() { | 281 void GrOptDrawState::getStageStats() { |
282 // We will need a local coord attrib if there is one currently set on the op
tState and we are | 282 // We will need a local coord attrib if there is one currently set on the op
tState and we are |
283 // actually generating some effect code | 283 // actually generating some effect code |
284 fRequiresLocalCoordAttrib = this->hasLocalCoordAttribute() && this->numTotal
Stages() > 0; | 284 fRequiresLocalCoordAttrib = this->hasLocalCoordAttribute() && this->numTotal
Stages() > 0; |
285 | 285 |
286 fReadsDst = false; | 286 fReadsDst = false; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 369 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
370 that.fFixedFunctionVertexAttribIndices, | 370 that.fFixedFunctionVertexAttribIndices, |
371 sizeof(this->fFixedFunctionVertexAttribIndices))); | 371 sizeof(this->fFixedFunctionVertexAttribIndices))); |
372 | 372 |
373 return true; | 373 return true; |
374 } | 374 } |
375 | 375 |
OLD | NEW |