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 GrFragmentStage; | 14 class GrFragmentStage; |
15 class GrFragmentProcessor; | 15 class GrFragmentProcessor; |
16 class GrGeometryProcessor; | 16 class GrPrimitiveProcessor; |
17 class GrProcessor; | 17 class GrProcessor; |
18 | 18 |
19 /** | 19 /** |
20 * 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 |
21 * 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 |
22 * draw. | 22 * draw. |
23 */ | 23 */ |
24 class GrProcOptInfo { | 24 class GrProcOptInfo { |
25 public: | 25 public: |
26 GrProcOptInfo() | 26 GrProcOptInfo() |
27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) | 27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) |
28 , fFirstEffectStageIndex(0) | 28 , fFirstEffectStageIndex(0) |
29 , fInputColorIsUsed(true) | 29 , fInputColorIsUsed(true) |
30 , fInputColor(0) | 30 , fInputColor(0) |
31 , fRemoveVertexAttrib(false) | 31 , fRemoveVertexAttrib(false) |
32 , fReadsDst(false) | 32 , fReadsDst(false) |
33 , fReadsFragPosition(false) {} | 33 , fReadsFragPosition(false) {} |
34 | 34 |
35 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, | 35 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, |
36 GrColorComponentFlags flags, bool areCoverageStag
es, | 36 GrColorComponentFlags flags, bool areCoverageStag
es); |
37 const GrGeometryProcessor* gp = NULL); | 37 |
| 38 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); |
| 39 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, |
| 40 int stagecount); |
38 | 41 |
39 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 42 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
40 bool isOpaque() const { return fInOut.isOpaque(); } | 43 bool isOpaque() const { return fInOut.isOpaque(); } |
41 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 44 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
42 | 45 |
43 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. | 46 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. |
44 // For now this function will correctly tell us if we are using LCD text or
not and should only | 47 // For now this function will correctly tell us if we are using LCD text or
not and should only |
45 // be called when looking at the coverage output. | 48 // be called when looking at the coverage output. |
46 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && | 49 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && |
47 fInOut.isLCDCoverage(); } | 50 fInOut.isLCDCoverage(); } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 * Returns true if any of the stages preserved by GrProcOptInfo read the dst
color. | 85 * Returns true if any of the stages preserved by GrProcOptInfo read the dst
color. |
83 */ | 86 */ |
84 bool readsDst() const { return fReadsDst; } | 87 bool readsDst() const { return fReadsDst; } |
85 | 88 |
86 /** | 89 /** |
87 * Returns true if any of the stages preserved by GrProcOptInfo read the fra
g position. | 90 * Returns true if any of the stages preserved by GrProcOptInfo read the fra
g position. |
88 */ | 91 */ |
89 bool readsFragPosition() const { return fReadsFragPosition; } | 92 bool readsFragPosition() const { return fReadsFragPosition; } |
90 | 93 |
91 private: | 94 private: |
| 95 void internalCalc(const GrFragmentStage*, int stagecount); |
| 96 |
92 GrInvariantOutput fInOut; | 97 GrInvariantOutput fInOut; |
93 int fFirstEffectStageIndex; | 98 int fFirstEffectStageIndex; |
94 bool fInputColorIsUsed; | 99 bool fInputColorIsUsed; |
95 GrColor fInputColor; | 100 GrColor fInputColor; |
96 bool fRemoveVertexAttrib; | 101 bool fRemoveVertexAttrib; |
97 bool fReadsDst; | 102 bool fReadsDst; |
98 bool fReadsFragPosition; | 103 bool fReadsFragPosition; |
99 }; | 104 }; |
100 | 105 |
101 #endif | 106 #endif |
OLD | NEW |