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 |
(...skipping 10 matching lines...) Expand all Loading... |
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) | |
32 , fReadsDst(false) | 31 , fReadsDst(false) |
33 , fReadsFragPosition(false) {} | 32 , fReadsFragPosition(false) {} |
34 | 33 |
35 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, | 34 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, |
36 GrColorComponentFlags flags, bool areCoverageStag
es); | 35 GrColorComponentFlags flags, bool areCoverageStag
es); |
37 | 36 |
38 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); | 37 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); |
39 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, | 38 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, |
40 int stagecount); | 39 int stagecount); |
41 | 40 |
(...skipping 27 matching lines...) Expand all Loading... |
69 */ | 68 */ |
70 bool inputColorIsUsed() const { return fInputColorIsUsed; } | 69 bool inputColorIsUsed() const { return fInputColorIsUsed; } |
71 | 70 |
72 /** | 71 /** |
73 * If input color is used and per-vertex colors are not used, this is the in
put color to the | 72 * If input color is used and per-vertex colors are not used, this is the in
put color to the |
74 * first effective stage. | 73 * first effective stage. |
75 */ | 74 */ |
76 GrColor inputColorToEffectiveStage() const { return fInputColor; } | 75 GrColor inputColorToEffectiveStage() const { return fInputColor; } |
77 | 76 |
78 /** | 77 /** |
79 * Given the set of optimizations determined by GrProcOptInfo, should the ca
ller remove the | |
80 * color/coverage vertex attribute that was input to the first stage. | |
81 */ | |
82 bool removeVertexAttrib() const { return fRemoveVertexAttrib; } | |
83 | |
84 /** | |
85 * Returns true if any of the stages preserved by GrProcOptInfo read the dst
color. | 78 * Returns true if any of the stages preserved by GrProcOptInfo read the dst
color. |
86 */ | 79 */ |
87 bool readsDst() const { return fReadsDst; } | 80 bool readsDst() const { return fReadsDst; } |
88 | 81 |
89 /** | 82 /** |
90 * Returns true if any of the stages preserved by GrProcOptInfo read the fra
g position. | 83 * Returns true if any of the stages preserved by GrProcOptInfo read the fra
g position. |
91 */ | 84 */ |
92 bool readsFragPosition() const { return fReadsFragPosition; } | 85 bool readsFragPosition() const { return fReadsFragPosition; } |
93 | 86 |
94 private: | 87 private: |
95 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); | 88 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); |
96 | 89 |
97 GrInvariantOutput fInOut; | 90 GrInvariantOutput fInOut; |
98 int fFirstEffectStageIndex; | 91 int fFirstEffectStageIndex; |
99 bool fInputColorIsUsed; | 92 bool fInputColorIsUsed; |
100 GrColor fInputColor; | 93 GrColor fInputColor; |
101 bool fRemoveVertexAttrib; | |
102 bool fReadsDst; | 94 bool fReadsDst; |
103 bool fReadsFragPosition; | 95 bool fReadsFragPosition; |
104 }; | 96 }; |
105 | 97 |
106 #endif | 98 #endif |
OLD | NEW |