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 #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 | 13 |
14 class GrDrawBatch; | 14 class GrDrawBatch; |
15 class GrFragmentProcessor; | 15 class GrFragmentProcessor; |
16 class GrPrimitiveProcessor; | 16 class GrPrimitiveProcessor; |
17 class GrProcessor; | |
18 | 17 |
19 /** | 18 /** |
20 * GrProcOptInfo gathers invariant data from a set of processor stages.It is use
d to recognize | 19 * GrProcOptInfo gathers invariant data from a set of processor stages.It is use
d to recognize |
21 * optimizations related to eliminating stages and vertex attributes that aren't
necessary for a | 20 * optimizations related to eliminating stages and vertex attributes that aren't
necessary for a |
22 * draw. | 21 * draw. |
23 */ | 22 */ |
24 class GrProcOptInfo { | 23 class GrProcOptInfo { |
25 public: | 24 public: |
26 GrProcOptInfo() | 25 GrProcOptInfo() |
27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) | 26 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) |
28 , fFirstEffectiveProcessorIndex(0) | 27 , fFirstEffectiveProcessorIndex(0) |
29 , fInputColorIsUsed(true) | 28 , fInputColorIsUsed(true) |
30 , fInputColor(0) | 29 , fInputColor(0) {} |
31 , fReadsFragPosition(false) {} | |
32 | 30 |
33 void calcWithInitialValues(const GrFragmentProcessor* const *, int cnt, GrCo
lor startColor, | 31 void calcWithInitialValues(const GrFragmentProcessor* const *, int cnt, GrCo
lor startColor, |
34 GrColorComponentFlags, bool areCoverageStages, bo
ol isLCD = false); | 32 GrColorComponentFlags, bool areCoverageStages, bo
ol isLCD = false); |
35 void initUsingInvariantOutput(GrInitInvariantOutput invOutput); | 33 void initUsingInvariantOutput(GrInitInvariantOutput invOutput); |
36 void completeCalculations(const GrFragmentProcessor * const processors[], in
t cnt); | 34 void completeCalculations(const GrFragmentProcessor * const processors[], in
t cnt); |
37 | 35 |
38 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 36 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
39 bool isOpaque() const { return fInOut.isOpaque(); } | 37 bool isOpaque() const { return fInOut.isOpaque(); } |
40 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 38 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
41 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } | 39 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } |
(...skipping 26 matching lines...) Expand all Loading... |
68 * True if the first effective processor reads its input, false otherwise. | 66 * True if the first effective processor reads its input, false otherwise. |
69 */ | 67 */ |
70 bool inputColorIsUsed() const { return fInputColorIsUsed; } | 68 bool inputColorIsUsed() const { return fInputColorIsUsed; } |
71 | 69 |
72 /** | 70 /** |
73 * If input color is used and per-vertex colors are not used, this is the in
put color to the | 71 * If input color is used and per-vertex colors are not used, this is the in
put color to the |
74 * first effective processor. | 72 * first effective processor. |
75 */ | 73 */ |
76 GrColor inputColorToFirstEffectiveProccesor() const { return fInputColor; } | 74 GrColor inputColorToFirstEffectiveProccesor() const { return fInputColor; } |
77 | 75 |
78 /** | |
79 * Returns true if any of the processor preserved by GrProcOptInfo read the
frag position. | |
80 */ | |
81 bool readsFragPosition() const { return fReadsFragPosition; } | |
82 | |
83 private: | 76 private: |
84 void internalCalc(const GrFragmentProcessor* const[], int cnt, bool initWill
ReadFragPosition); | 77 void internalCalc(const GrFragmentProcessor* const[], int cnt); |
85 | 78 |
86 GrInvariantOutput fInOut; | 79 GrInvariantOutput fInOut; |
87 int fFirstEffectiveProcessorIndex; | 80 int fFirstEffectiveProcessorIndex; |
88 bool fInputColorIsUsed; | 81 bool fInputColorIsUsed; |
89 GrColor fInputColor; | 82 GrColor fInputColor; |
90 bool fReadsFragPosition; | |
91 }; | 83 }; |
92 | 84 |
93 #endif | 85 #endif |
OLD | NEW |