egdaniel | b6cbc38 | 2014-11-13 11:00:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "GrProcOptInfo.h" |
egdaniel | 9513143 | 2014-12-09 11:15:43 -0800 | [diff] [blame] | 9 | #include "GrGeometryProcessor.h" |
Brian Salomon | 8952743 | 2016-12-16 09:52:16 -0500 | [diff] [blame] | 10 | #include "ops/GrDrawOp.h" |
joshualitt | 7441782 | 2015-08-07 11:42:16 -0700 | [diff] [blame] | 11 | |
Brian Salomon | 0831f1b | 2017-01-18 11:08:41 -0500 | [diff] [blame] | 12 | void GrProcOptInfo::analyzeProcessors(const GrFragmentProcessor* const* processors, int cnt) { |
bsalomon | ac856c9 | 2015-08-27 06:30:17 -0700 | [diff] [blame] | 13 | for (int i = 0; i < cnt; ++i) { |
| 14 | const GrFragmentProcessor* processor = processors[i]; |
egdaniel | b6cbc38 | 2014-11-13 11:00:34 -0800 | [diff] [blame] | 15 | processor->computeInvariantOutput(&fInOut); |
egdaniel | b6cbc38 | 2014-11-13 11:00:34 -0800 | [diff] [blame] | 16 | if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { |
bsalomon | ac856c9 | 2015-08-27 06:30:17 -0700 | [diff] [blame] | 17 | fFirstEffectiveProcessorIndex = i + 1; |
egdaniel | b6cbc38 | 2014-11-13 11:00:34 -0800 | [diff] [blame] | 18 | fInputColor = fInOut.color(); |
egdaniel | b6cbc38 | 2014-11-13 11:00:34 -0800 | [diff] [blame] | 19 | // Since we are clearing all previous color stages we are in a state where we have found |
| 20 | // zero stages that don't multiply the inputColor. |
| 21 | fInOut.resetNonMulStageFound(); |
egdaniel | b6cbc38 | 2014-11-13 11:00:34 -0800 | [diff] [blame] | 22 | } |
| 23 | } |
| 24 | } |