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 GrGeometryProcessor; | 16 class GrGeometryProcessor; |
| 17 class GrProcessor; |
16 | 18 |
17 /** | 19 /** |
18 * 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 |
19 * 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 |
20 * draw. | 22 * draw. |
21 */ | 23 */ |
22 class GrProcOptInfo { | 24 class GrProcOptInfo { |
23 public: | 25 public: |
24 GrProcOptInfo() | 26 GrProcOptInfo() |
25 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) | 27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) |
26 , fFirstEffectStageIndex(0) | 28 , fFirstEffectStageIndex(0) |
27 , fInputColorIsUsed(true) | 29 , fInputColorIsUsed(true) |
28 , fInputColor(0) | 30 , fInputColor(0) |
29 , fRemoveVertexAttrib(false) | 31 , fRemoveVertexAttrib(false) |
30 , fReadsDst(false) {} | 32 , fReadsDst(false) |
| 33 , fReadsFragPosition(false) {} |
31 | 34 |
32 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, | 35 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, |
33 GrColorComponentFlags flags, bool areCoverageStag
es, | 36 GrColorComponentFlags flags, bool areCoverageStag
es, |
34 const GrGeometryProcessor* gp = NULL); | 37 const GrGeometryProcessor* gp = NULL); |
35 | 38 |
36 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 39 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
37 bool isOpaque() const { return fInOut.isOpaque(); } | 40 bool isOpaque() const { return fInOut.isOpaque(); } |
38 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 41 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
39 | 42 |
40 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. | 43 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 * Given the set of optimizations determined by GrProcOptInfo, should the ca
ller remove the | 76 * Given the set of optimizations determined by GrProcOptInfo, should the ca
ller remove the |
74 * color/coverage vertex attribute that was input to the first stage. | 77 * color/coverage vertex attribute that was input to the first stage. |
75 */ | 78 */ |
76 bool removeVertexAttrib() const { return fRemoveVertexAttrib; } | 79 bool removeVertexAttrib() const { return fRemoveVertexAttrib; } |
77 | 80 |
78 /** | 81 /** |
79 * Returns true if any of the stages preserved by GrProcOptInfo read the dst
color. | 82 * Returns true if any of the stages preserved by GrProcOptInfo read the dst
color. |
80 */ | 83 */ |
81 bool readsDst() const { return fReadsDst; } | 84 bool readsDst() const { return fReadsDst; } |
82 | 85 |
| 86 /** |
| 87 * Returns true if any of the stages preserved by GrProcOptInfo read the fra
g position. |
| 88 */ |
| 89 bool readsFragPosition() const { return fReadsFragPosition; } |
| 90 |
83 private: | 91 private: |
84 GrInvariantOutput fInOut; | 92 GrInvariantOutput fInOut; |
85 int fFirstEffectStageIndex; | 93 int fFirstEffectStageIndex; |
86 bool fInputColorIsUsed; | 94 bool fInputColorIsUsed; |
87 GrColor fInputColor; | 95 GrColor fInputColor; |
88 bool fRemoveVertexAttrib; | 96 bool fRemoveVertexAttrib; |
89 bool fReadsDst; | 97 bool fReadsDst; |
| 98 bool fReadsFragPosition; |
90 }; | 99 }; |
91 | 100 |
92 #endif | 101 #endif |
OLD | NEW |