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; | |
16 class GrGeometryProcessor; | 15 class GrGeometryProcessor; |
17 class GrProcessor; | |
18 | 16 |
19 /** | 17 /** |
20 * GrProcOptInfo gathers invariant data from a set of processor stages.It is use
d to recognize | 18 * 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 | 19 * optimizations related to eliminating stages and vertex attributes that aren't
necessary for a |
22 * draw. | 20 * draw. |
23 */ | 21 */ |
24 class GrProcOptInfo { | 22 class GrProcOptInfo { |
25 public: | 23 public: |
26 GrProcOptInfo() | 24 GrProcOptInfo() |
27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) | 25 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) |
28 , fFirstEffectStageIndex(0) | 26 , fFirstEffectStageIndex(0) |
29 , fInputColorIsUsed(true) | 27 , fInputColorIsUsed(true) |
30 , fInputColor(0) | 28 , fInputColor(0) |
31 , fRemoveVertexAttrib(false) | 29 , fRemoveVertexAttrib(false) |
32 , fReadsDst(false) | 30 , fReadsDst(false) {} |
33 , fReadsFragPosition(false) {} | |
34 | 31 |
35 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, | 32 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, |
36 GrColorComponentFlags flags, bool areCoverageStag
es, | 33 GrColorComponentFlags flags, bool areCoverageStag
es, |
37 const GrGeometryProcessor* gp = NULL); | 34 const GrGeometryProcessor* gp = NULL); |
38 | 35 |
39 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 36 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
40 bool isOpaque() const { return fInOut.isOpaque(); } | 37 bool isOpaque() const { return fInOut.isOpaque(); } |
41 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 38 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
42 | 39 |
43 GrColor color() const { return fInOut.color(); } | 40 GrColor color() const { return fInOut.color(); } |
(...skipping 26 matching lines...) Expand all Loading... |
70 * Given the set of optimizations determined by GrProcOptInfo, should the ca
ller remove the | 67 * Given the set of optimizations determined by GrProcOptInfo, should the ca
ller remove the |
71 * color/coverage vertex attribute that was input to the first stage. | 68 * color/coverage vertex attribute that was input to the first stage. |
72 */ | 69 */ |
73 bool removeVertexAttrib() const { return fRemoveVertexAttrib; } | 70 bool removeVertexAttrib() const { return fRemoveVertexAttrib; } |
74 | 71 |
75 /** | 72 /** |
76 * Returns true if any of the stages preserved by GrProcOptInfo read the dst
color. | 73 * Returns true if any of the stages preserved by GrProcOptInfo read the dst
color. |
77 */ | 74 */ |
78 bool readsDst() const { return fReadsDst; } | 75 bool readsDst() const { return fReadsDst; } |
79 | 76 |
80 /** | |
81 * Returns true if any of the stages preserved by GrProcOptInfo read the fra
g position. | |
82 */ | |
83 bool readsFragPosition() const { return fReadsFragPosition; } | |
84 | |
85 private: | 77 private: |
86 GrInvariantOutput fInOut; | 78 GrInvariantOutput fInOut; |
87 int fFirstEffectStageIndex; | 79 int fFirstEffectStageIndex; |
88 bool fInputColorIsUsed; | 80 bool fInputColorIsUsed; |
89 GrColor fInputColor; | 81 GrColor fInputColor; |
90 bool fRemoveVertexAttrib; | 82 bool fRemoveVertexAttrib; |
91 bool fReadsDst; | 83 bool fReadsDst; |
92 bool fReadsFragPosition; | |
93 }; | 84 }; |
94 | 85 |
95 #endif | 86 #endif |
OLD | NEW |