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 #include "SkRefCnt.h" |
13 | 14 |
14 class GrDrawBatch; | 15 class GrDrawBatch; |
15 class GrFragmentProcessor; | 16 class GrFragmentProcessor; |
16 class GrPrimitiveProcessor; | 17 class GrPrimitiveProcessor; |
17 | 18 |
18 /** | 19 /** |
19 * 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 |
20 * 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 |
21 * draw. | 22 * draw. |
22 */ | 23 */ |
23 class GrProcOptInfo { | 24 class GrProcOptInfo { |
24 public: | 25 public: |
25 GrProcOptInfo() | 26 GrProcOptInfo() |
26 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) | 27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) |
27 , fFirstEffectiveProcessorIndex(0) | 28 , fFirstEffectiveProcessorIndex(0) |
28 , fInputColorIsUsed(true) | 29 , fInputColorIsUsed(true) |
29 , fInputColor(0) {} | 30 , fInputColor(0) {} |
30 | 31 |
31 void calcWithInitialValues(const GrFragmentProcessor* const *, int cnt, GrCo
lor startColor, | 32 void calcWithInitialValues(const sk_sp<GrFragmentProcessor>*, int cnt, GrCol
or startColor, |
32 GrColorComponentFlags, bool areCoverageStages, bo
ol isLCD = false); | 33 GrColorComponentFlags, bool areCoverageStages, bo
ol isLCD = false); |
33 void initUsingInvariantOutput(GrInitInvariantOutput invOutput); | 34 void initUsingInvariantOutput(GrInitInvariantOutput invOutput); |
34 void completeCalculations(const GrFragmentProcessor * const processors[], in
t cnt); | 35 void completeCalculations(const sk_sp<GrFragmentProcessor>* processors, int
cnt); |
35 | 36 |
36 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 37 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
37 bool isOpaque() const { return fInOut.isOpaque(); } | 38 bool isOpaque() const { return fInOut.isOpaque(); } |
38 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 39 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
39 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } | 40 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } |
40 | 41 |
41 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. | 42 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. |
42 // For now this function will correctly tell us if we are using LCD text or
not and should only | 43 // For now this function will correctly tell us if we are using LCD text or
not and should only |
43 // be called when looking at the coverage output. | 44 // be called when looking at the coverage output. |
44 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && | 45 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && |
(...skipping 22 matching lines...) Expand all Loading... |
67 */ | 68 */ |
68 bool inputColorIsUsed() const { return fInputColorIsUsed; } | 69 bool inputColorIsUsed() const { return fInputColorIsUsed; } |
69 | 70 |
70 /** | 71 /** |
71 * 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 |
72 * first effective processor. | 73 * first effective processor. |
73 */ | 74 */ |
74 GrColor inputColorToFirstEffectiveProccesor() const { return fInputColor; } | 75 GrColor inputColorToFirstEffectiveProccesor() const { return fInputColor; } |
75 | 76 |
76 private: | 77 private: |
77 void internalCalc(const GrFragmentProcessor* const[], int cnt); | 78 void internalCalc(const sk_sp<GrFragmentProcessor>*, int cnt); |
78 | 79 |
79 GrInvariantOutput fInOut; | 80 GrInvariantOutput fInOut; |
80 int fFirstEffectiveProcessorIndex; | 81 int fFirstEffectiveProcessorIndex; |
81 bool fInputColorIsUsed; | 82 bool fInputColorIsUsed; |
82 GrColor fInputColor; | 83 GrColor fInputColor; |
83 }; | 84 }; |
84 | 85 |
85 #endif | 86 #endif |
OLD | NEW |