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

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

Issue 1307223004: Remove GrStagedProcessor, remove the word Stage as it applies to FPs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix misresolve Created 5 years, 3 months 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/GrPipelineBuilder.cpp ('k') | src/gpu/GrProcOptInfo.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 #ifndef GrProcOptInfo_DEFINED 8 #ifndef GrProcOptInfo_DEFINED
9 #define GrProcOptInfo_DEFINED 9 #define GrProcOptInfo_DEFINED
10 10
11 #include "GrColor.h" 11 #include "GrColor.h"
12 #include "GrInvariantOutput.h" 12 #include "GrInvariantOutput.h"
13 #include "GrStagedProcessor.h"
14 13
15 class GrDrawBatch; 14 class GrDrawBatch;
16 class GrFragmentProcessor; 15 class GrFragmentProcessor;
17 class GrPrimitiveProcessor; 16 class GrPrimitiveProcessor;
18 class GrProcessor; 17 class GrProcessor;
19 18
20 /** 19 /**
21 * GrProcOptInfo gathers invariant data from a set of processor stages.It is use d to recognize 20 * GrProcOptInfo gathers invariant data from a set of processor stages.It is use d to recognize
22 * optimizations related to eliminating stages and vertex attributes that aren't necessary for a 21 * optimizations related to eliminating stages and vertex attributes that aren't necessary for a
23 * draw. 22 * draw.
24 */ 23 */
25 class GrProcOptInfo { 24 class GrProcOptInfo {
26 public: 25 public:
27 GrProcOptInfo() 26 GrProcOptInfo()
28 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) 27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false)
29 , fFirstEffectStageIndex(0) 28 , fFirstEffectiveProcessorIndex(0)
30 , fInputColorIsUsed(true) 29 , fInputColorIsUsed(true)
31 , fInputColor(0) 30 , fInputColor(0)
32 , fReadsFragPosition(false) {} 31 , fReadsFragPosition(false) {}
33 32
34 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s tartColor, 33 void calcWithInitialValues(const GrFragmentProcessor* const *, int cnt, GrCo lor startColor,
35 GrColorComponentFlags flags, bool areCoverageStag es); 34 GrColorComponentFlags, bool areCoverageStages);
36 35
37 void calcColorWithBatch(const GrDrawBatch*, const GrFragmentStage*, int stag ecount); 36 void calcColorWithBatch(const GrDrawBatch*, const GrFragmentProcessor* const [], int cnt);
38 void calcCoverageWithBatch(const GrDrawBatch*, const GrFragmentStage*, int s tagecount); 37 void calcCoverageWithBatch(const GrDrawBatch*, const GrFragmentProcessor* co nst[], int cnt);
39 38
40 // TODO delete these when batch is everywhere 39 // TODO delete these when batch is everywhere
41 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag e*, int stagecount); 40 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentProc essor* const[],
42 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS tage*, 41 int cnt);
43 int stagecount); 42 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentP rocessor* const[],
43 int cnt);
44 44
45 bool isSolidWhite() const { return fInOut.isSolidWhite(); } 45 bool isSolidWhite() const { return fInOut.isSolidWhite(); }
46 bool isOpaque() const { return fInOut.isOpaque(); } 46 bool isOpaque() const { return fInOut.isOpaque(); }
47 bool isSingleComponent() const { return fInOut.isSingleComponent(); } 47 bool isSingleComponent() const { return fInOut.isSingleComponent(); }
48 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } 48 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); }
49 49
50 // TODO: Once texture pixel configs quaries are updated, we no longer need t his function. 50 // TODO: Once texture pixel configs quaries are updated, we no longer need t his function.
51 // For now this function will correctly tell us if we are using LCD text or not and should only 51 // For now this function will correctly tell us if we are using LCD text or not and should only
52 // be called when looking at the coverage output. 52 // be called when looking at the coverage output.
53 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && 53 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() &&
54 fInOut.isLCDCoverage(); } 54 fInOut.isLCDCoverage(); }
55 55
56 GrColor color() const { return fInOut.color(); } 56 GrColor color() const { return fInOut.color(); }
57 57
58 GrColorComponentFlags validFlags() const { 58 GrColorComponentFlags validFlags() const {
59 return static_cast<GrColorComponentFlags>(fInOut.validFlags()); 59 return static_cast<GrColorComponentFlags>(fInOut.validFlags());
60 } 60 }
61 61
62 /** 62 /**
63 * Returns the index of the first effective color stage. If an intermediate stage doesn't read 63 * Returns the index of the first effective color processor. If an intermedi ate processor
64 * its input or has a known output, then we can ignore all earlier stages si nce they will not 64 * doesn't read its input or has a known output, then we can ignore all earl ier processors
65 * affect the final output. Thus the first effective stage index is the inde x to the first stage 65 * since they will not affect the final output. Thus the first effective pro cessors index is
66 * that will have an effect on the final output. 66 * the index to the first processor that will have an effect on the final ou tput.
67 * 67 *
68 * If stages before the firstEffectiveStageIndex are removed, corresponding values from 68 * If processors before the firstEffectiveProcessorIndex() are removed, corr esponding values
69 * inputColorIsUsed(), inputColorToEffectiveStage(), removeVertexAttribs(), and readsDst() must 69 * from inputColorIsUsed(), inputColorToEffectiveProcessor(), removeVertexAt tribs(), and
70 * be used when setting up the draw to ensure correct drawing. 70 * readsDst() must be used when setting up the draw to ensure correct drawin g.
71 */ 71 */
72 int firstEffectiveStageIndex() const { return fFirstEffectStageIndex; } 72 int firstEffectiveProcessorIndex() const { return fFirstEffectiveProcessorIn dex; }
73 73
74 /** 74 /**
75 * True if the first effective stage reads its input, false otherwise. 75 * True if the first effective processor reads its input, false otherwise.
76 */ 76 */
77 bool inputColorIsUsed() const { return fInputColorIsUsed; } 77 bool inputColorIsUsed() const { return fInputColorIsUsed; }
78 78
79 /** 79 /**
80 * If input color is used and per-vertex colors are not used, this is the in put color to the 80 * If input color is used and per-vertex colors are not used, this is the in put color to the
81 * first effective stage. 81 * first effective processor.
82 */ 82 */
83 GrColor inputColorToEffectiveStage() const { return fInputColor; } 83 GrColor inputColorToFirstEffectiveProccesor() const { return fInputColor; }
84 84
85 /** 85 /**
86 * Returns true if any of the stages preserved by GrProcOptInfo read the fra g position. 86 * Returns true if any of the processor preserved by GrProcOptInfo read the frag position.
87 */ 87 */
88 bool readsFragPosition() const { return fReadsFragPosition; } 88 bool readsFragPosition() const { return fReadsFragPosition; }
89 89
90 private: 90 private:
91 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF ragPosition); 91 void internalCalc(const GrFragmentProcessor* const[], int cnt, bool initWill ReadFragPosition);
92 92
93 GrInvariantOutput fInOut; 93 GrInvariantOutput fInOut;
94 int fFirstEffectStageIndex; 94 int fFirstEffectiveProcessorIndex;
95 bool fInputColorIsUsed; 95 bool fInputColorIsUsed;
96 GrColor fInputColor; 96 GrColor fInputColor;
97 bool fReadsFragPosition; 97 bool fReadsFragPosition;
98 }; 98 };
99 99
100 #endif 100 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/GrProcOptInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698