Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: src/gpu/GrProcOptInfo.cpp

Issue 746423007: Draft change to start pulling uniform color into GP (Closed) Base URL: https://skia.googlesource.com/skia.git@no_factories
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 fRemoveVertexAttrib = false;
52 fReadsDst = false; 51 fReadsDst = false;
53 fReadsFragPosition = initWillReadFragmentPosition; 52 fReadsFragPosition = initWillReadFragmentPosition;
54 53
55 for (int i = 0; i < stageCount; ++i) { 54 for (int i = 0; i < stageCount; ++i) {
56 const GrFragmentProcessor* processor = stages[i].getProcessor(); 55 const GrFragmentProcessor* processor = stages[i].getProcessor();
57 fInOut.resetWillUseInputColor(); 56 fInOut.resetWillUseInputColor();
58 processor->computeInvariantOutput(&fInOut); 57 processor->computeInvariantOutput(&fInOut);
59 SkDEBUGCODE(fInOut.validate()); 58 SkDEBUGCODE(fInOut.validate());
60 if (!fInOut.willUseInputColor()) { 59 if (!fInOut.willUseInputColor()) {
61 fFirstEffectStageIndex = i; 60 fFirstEffectStageIndex = i;
62 fInputColorIsUsed = false; 61 fInputColorIsUsed = false;
63 // 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
64 fReadsDst = false; 63 fReadsDst = false;
65 fReadsFragPosition = initWillReadFragmentPosition; 64 fReadsFragPosition = initWillReadFragmentPosition;
66 } 65 }
67 if (processor->willReadDstColor()) { 66 if (processor->willReadDstColor()) {
68 fReadsDst = true; 67 fReadsDst = true;
69 } 68 }
70 if (processor->willReadFragmentPosition()) { 69 if (processor->willReadFragmentPosition()) {
71 fReadsFragPosition = true; 70 fReadsFragPosition = true;
72 } 71 }
73 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) { 72 if (kRGBA_GrColorComponentFlags == fInOut.validFlags()) {
74 fFirstEffectStageIndex = i + 1; 73 fFirstEffectStageIndex = i + 1;
75 fInputColor = fInOut.color(); 74 fInputColor = fInOut.color();
76 fInputColorIsUsed = true; 75 fInputColorIsUsed = true;
77 fRemoveVertexAttrib = true;
78 // 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
79 // zero stages that don't multiply the inputColor. 77 // zero stages that don't multiply the inputColor.
80 fInOut.resetNonMulStageFound(); 78 fInOut.resetNonMulStageFound();
81 // 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
82 fReadsDst = false; 80 fReadsDst = false;
83 fReadsFragPosition = initWillReadFragmentPosition; 81 fReadsFragPosition = initWillReadFragmentPosition;
84 } 82 }
85 } 83 }
86 } 84 }
OLDNEW
« no previous file with comments | « src/gpu/GrProcOptInfo.h ('k') | src/gpu/GrProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698