| 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 30 matching lines...) Expand all Loading... |
| 41 fInOut.reset(out); | 41 fInOut.reset(out); |
| 42 this->internalCalc(stages, stageCount, false); | 42 this->internalCalc(stages, stageCount, false); |
| 43 } | 43 } |
| 44 | 44 |
| 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; | |
| 52 fReadsFragPosition = initWillReadFragmentPosition; | 51 fReadsFragPosition = initWillReadFragmentPosition; |
| 53 | 52 |
| 54 for (int i = 0; i < stageCount; ++i) { | 53 for (int i = 0; i < stageCount; ++i) { |
| 55 const GrFragmentProcessor* processor = stages[i].processor(); | 54 const GrFragmentProcessor* processor = stages[i].processor(); |
| 56 fInOut.resetWillUseInputColor(); | 55 fInOut.resetWillUseInputColor(); |
| 57 processor->computeInvariantOutput(&fInOut); | 56 processor->computeInvariantOutput(&fInOut); |
| 58 SkDEBUGCODE(fInOut.validate()); | 57 SkDEBUGCODE(fInOut.validate()); |
| 59 if (!fInOut.willUseInputColor()) { | 58 if (!fInOut.willUseInputColor()) { |
| 60 fFirstEffectStageIndex = i; | 59 fFirstEffectStageIndex = i; |
| 61 fInputColorIsUsed = false; | 60 fInputColorIsUsed = false; |
| 62 // Reset these since we don't care if previous stages read these val
ues | 61 // Reset these since we don't care if previous stages read these val
ues |
| 63 fReadsDst = false; | |
| 64 fReadsFragPosition = initWillReadFragmentPosition; | 62 fReadsFragPosition = initWillReadFragmentPosition; |
| 65 } | 63 } |
| 66 if (processor->willReadDstColor()) { | |
| 67 fReadsDst = true; | |
| 68 } | |
| 69 if (processor->willReadFragmentPosition()) { | 64 if (processor->willReadFragmentPosition()) { |
| 70 fReadsFragPosition = true; | 65 fReadsFragPosition = true; |
| 71 } | 66 } |
| 72 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { | 67 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { |
| 73 fFirstEffectStageIndex = i + 1; | 68 fFirstEffectStageIndex = i + 1; |
| 74 fInputColor = fInOut.color(); | 69 fInputColor = fInOut.color(); |
| 75 fInputColorIsUsed = true; | 70 fInputColorIsUsed = true; |
| 76 // Since we are clearing all previous color stages we are in a state
where we have found | 71 // 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. | 72 // zero stages that don't multiply the inputColor. |
| 78 fInOut.resetNonMulStageFound(); | 73 fInOut.resetNonMulStageFound(); |
| 79 // Reset these since we don't care if previous stages read these val
ues | 74 // Reset these since we don't care if previous stages read these val
ues |
| 80 fReadsDst = false; | |
| 81 fReadsFragPosition = initWillReadFragmentPosition; | 75 fReadsFragPosition = initWillReadFragmentPosition; |
| 82 } | 76 } |
| 83 } | 77 } |
| 84 } | 78 } |
| OLD | NEW |