blob: f18482338cea0a7d0a00e728fe9c44a66d48576c [file] [log] [blame]
egdanielb6cbc382014-11-13 11:00:34 -08001/*
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"
egdaniel95131432014-12-09 11:15:43 -08009#include "GrGeometryProcessor.h"
Brian Salomon89527432016-12-16 09:52:16 -050010#include "ops/GrDrawOp.h"
joshualitt74417822015-08-07 11:42:16 -070011
Brian Salomon0831f1b2017-01-18 11:08:41 -050012void GrProcOptInfo::analyzeProcessors(const GrFragmentProcessor* const* processors, int cnt) {
bsalomonac856c92015-08-27 06:30:17 -070013 for (int i = 0; i < cnt; ++i) {
14 const GrFragmentProcessor* processor = processors[i];
egdanielb6cbc382014-11-13 11:00:34 -080015 fInOut.resetWillUseInputColor();
16 processor->computeInvariantOutput(&fInOut);
joshualitt56995b52014-12-11 15:44:02 -080017 SkDEBUGCODE(fInOut.validate());
egdanielb6cbc382014-11-13 11:00:34 -080018 if (!fInOut.willUseInputColor()) {
bsalomonac856c92015-08-27 06:30:17 -070019 fFirstEffectiveProcessorIndex = i;
egdanielb6cbc382014-11-13 11:00:34 -080020 fInputColorIsUsed = false;
egdaniel95131432014-12-09 11:15:43 -080021 }
egdanielb6cbc382014-11-13 11:00:34 -080022 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) {
bsalomonac856c92015-08-27 06:30:17 -070023 fFirstEffectiveProcessorIndex = i + 1;
egdanielb6cbc382014-11-13 11:00:34 -080024 fInputColor = fInOut.color();
25 fInputColorIsUsed = true;
egdanielb6cbc382014-11-13 11:00:34 -080026 // Since we are clearing all previous color stages we are in a state where we have found
27 // zero stages that don't multiply the inputColor.
28 fInOut.resetNonMulStageFound();
egdanielb6cbc382014-11-13 11:00:34 -080029 }
30 }
31}