| 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 "GrProcOptInfo.h" | 8 #include "GrProcOptInfo.h" |
| 9 | 9 |
| 10 #include "GrFragmentProcessor.h" | 10 #include "GrFragmentProcessor.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void GrProcOptInfo::internalCalc(const GrFragmentStage* stages, | 45 void GrProcOptInfo::internalCalc(const GrFragmentStage* stages, |
| 46 int stageCount, | 46 int stageCount, |
| 47 bool initWillReadFragmentPosition) { | 47 bool initWillReadFragmentPosition) { |
| 48 fFirstEffectStageIndex = 0; | 48 fFirstEffectStageIndex = 0; |
| 49 fInputColorIsUsed = true; | 49 fInputColorIsUsed = true; |
| 50 fInputColor = fInOut.color(); | 50 fInputColor = fInOut.color(); |
| 51 fReadsDst = false; | 51 fReadsDst = false; |
| 52 fReadsFragPosition = initWillReadFragmentPosition; | 52 fReadsFragPosition = initWillReadFragmentPosition; |
| 53 | 53 |
| 54 for (int i = 0; i < stageCount; ++i) { | 54 for (int i = 0; i < stageCount; ++i) { |
| 55 const GrFragmentProcessor* processor = stages[i].getProcessor(); | 55 const GrFragmentProcessor* processor = stages[i].processor(); |
| 56 fInOut.resetWillUseInputColor(); | 56 fInOut.resetWillUseInputColor(); |
| 57 processor->computeInvariantOutput(&fInOut); | 57 processor->computeInvariantOutput(&fInOut); |
| 58 SkDEBUGCODE(fInOut.validate()); | 58 SkDEBUGCODE(fInOut.validate()); |
| 59 if (!fInOut.willUseInputColor()) { | 59 if (!fInOut.willUseInputColor()) { |
| 60 fFirstEffectStageIndex = i; | 60 fFirstEffectStageIndex = i; |
| 61 fInputColorIsUsed = false; | 61 fInputColorIsUsed = false; |
| 62 // Reset these since we don't care if previous stages read these val
ues | 62 // Reset these since we don't care if previous stages read these val
ues |
| 63 fReadsDst = false; | 63 fReadsDst = false; |
| 64 fReadsFragPosition = initWillReadFragmentPosition; | 64 fReadsFragPosition = initWillReadFragmentPosition; |
| 65 } | 65 } |
| 66 if (processor->willReadDstColor()) { | 66 if (processor->willReadDstColor()) { |
| 67 fReadsDst = true; | 67 fReadsDst = true; |
| 68 } | 68 } |
| 69 if (processor->willReadFragmentPosition()) { | 69 if (processor->willReadFragmentPosition()) { |
| 70 fReadsFragPosition = true; | 70 fReadsFragPosition = true; |
| 71 } | 71 } |
| 72 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { | 72 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { |
| 73 fFirstEffectStageIndex = i + 1; | 73 fFirstEffectStageIndex = i + 1; |
| 74 fInputColor = fInOut.color(); | 74 fInputColor = fInOut.color(); |
| 75 fInputColorIsUsed = true; | 75 fInputColorIsUsed = true; |
| 76 // Since we are clearing all previous color stages we are in a state
where we have found | 76 // Since we are clearing all previous color stages we are in a state
where we have found |
| 77 // zero stages that don't multiply the inputColor. | 77 // zero stages that don't multiply the inputColor. |
| 78 fInOut.resetNonMulStageFound(); | 78 fInOut.resetNonMulStageFound(); |
| 79 // Reset these since we don't care if previous stages read these val
ues | 79 // Reset these since we don't care if previous stages read these val
ues |
| 80 fReadsDst = false; | 80 fReadsDst = false; |
| 81 fReadsFragPosition = initWillReadFragmentPosition; | 81 fReadsFragPosition = initWillReadFragmentPosition; |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 } | 84 } |
| OLD | NEW |