| 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 GrPrimitiveProcessor; | 16 class GrGeometryProcessor; |
| 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 | 37 const GrGeometryProcessor* gp = NULL); |
| 38 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); | |
| 39 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, | |
| 40 int stagecount); | |
| 41 | 38 |
| 42 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 39 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
| 43 bool isOpaque() const { return fInOut.isOpaque(); } | 40 bool isOpaque() const { return fInOut.isOpaque(); } |
| 44 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 41 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
| 45 | 42 |
| 46 // 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. |
| 47 // For now this function will correctly tell us if we are using LCD text or
not and should only | 44 // For now this function will correctly tell us if we are using LCD text or
not and should only |
| 48 // be called when looking at the coverage output. | 45 // be called when looking at the coverage output. |
| 49 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && | 46 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && |
| 50 fInOut.isLCDCoverage(); } | 47 fInOut.isLCDCoverage(); } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 * 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. |
| 86 */ | 83 */ |
| 87 bool readsDst() const { return fReadsDst; } | 84 bool readsDst() const { return fReadsDst; } |
| 88 | 85 |
| 89 /** | 86 /** |
| 90 * Returns true if any of the stages preserved by GrProcOptInfo read the fra
g position. | 87 * Returns true if any of the stages preserved by GrProcOptInfo read the fra
g position. |
| 91 */ | 88 */ |
| 92 bool readsFragPosition() const { return fReadsFragPosition; } | 89 bool readsFragPosition() const { return fReadsFragPosition; } |
| 93 | 90 |
| 94 private: | 91 private: |
| 95 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); | |
| 96 | |
| 97 GrInvariantOutput fInOut; | 92 GrInvariantOutput fInOut; |
| 98 int fFirstEffectStageIndex; | 93 int fFirstEffectStageIndex; |
| 99 bool fInputColorIsUsed; | 94 bool fInputColorIsUsed; |
| 100 GrColor fInputColor; | 95 GrColor fInputColor; |
| 101 bool fRemoveVertexAttrib; | 96 bool fRemoveVertexAttrib; |
| 102 bool fReadsDst; | 97 bool fReadsDst; |
| 103 bool fReadsFragPosition; | 98 bool fReadsFragPosition; |
| 104 }; | 99 }; |
| 105 | 100 |
| 106 #endif | 101 #endif |
| OLD | NEW |