| 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 11 matching lines...) Expand all Loading... |
| 22 * optimizations related to eliminating stages and vertex attributes that aren't
necessary for a | 22 * optimizations related to eliminating stages and vertex attributes that aren't
necessary for a |
| 23 * draw. | 23 * draw. |
| 24 */ | 24 */ |
| 25 class GrProcOptInfo { | 25 class GrProcOptInfo { |
| 26 public: | 26 public: |
| 27 GrProcOptInfo() | 27 GrProcOptInfo() |
| 28 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) | 28 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) |
| 29 , fFirstEffectStageIndex(0) | 29 , fFirstEffectStageIndex(0) |
| 30 , fInputColorIsUsed(true) | 30 , fInputColorIsUsed(true) |
| 31 , fInputColor(0) | 31 , fInputColor(0) |
| 32 , fReadsFragPosition(false) {} | 32 , fReadsFragPosition(false) |
| 33 , fNeedsCoverageModulation(false) {} |
| 33 | 34 |
| 34 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, | 35 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, |
| 35 GrColorComponentFlags flags, bool areCoverageStag
es); | 36 GrColorComponentFlags flags, bool areCoverageStag
es); |
| 36 | 37 |
| 37 void calcColorWithBatch(const GrBatch*, const GrFragmentStage*, int stagecou
nt); | 38 void calcColorWithBatch(const GrBatch*, const GrFragmentStage*, int stagecou
nt); |
| 38 void calcCoverageWithBatch(const GrBatch*, const GrFragmentStage*, int stage
count); | 39 void calcCoverageWithBatch(const GrBatch*, const GrFragmentStage*, int stage
count); |
| 39 | 40 |
| 40 // TODO delete these when batch is everywhere | 41 // TODO delete these when batch is everywhere |
| 41 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); | 42 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); |
| 42 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, | 43 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, |
| 43 int stagecount); | 44 int stagecount); |
| 44 | 45 |
| 45 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 46 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
| 46 bool isOpaque() const { return fInOut.isOpaque(); } | 47 bool isOpaque() const { return fInOut.isOpaque(); } |
| 47 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 48 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
| 48 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } | 49 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } |
| 49 | 50 |
| 50 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. | 51 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. |
| 51 // For now this function will correctly tell us if we are using LCD text or
not and should only | 52 // For now this function will correctly tell us if we are using LCD text or
not and should only |
| 52 // be called when looking at the coverage output. | 53 // be called when looking at the coverage output. |
| 53 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && | 54 bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && |
| 54 fInOut.isLCDCoverage(); } | 55 fInOut.isLCDCoverage(); } |
| 55 | 56 |
| 57 bool needsCoverageModulation() const { return fNeedsCoverageModulation; } |
| 58 |
| 59 void setNeedsCoverageModulation(bool modulate) { |
| 60 fNeedsCoverageModulation = true; |
| 61 } |
| 62 |
| 56 GrColor color() const { return fInOut.color(); } | 63 GrColor color() const { return fInOut.color(); } |
| 57 uint8_t validFlags() const { return fInOut.validFlags(); } | 64 uint8_t validFlags() const { return fInOut.validFlags(); } |
| 58 | 65 |
| 59 /** | 66 /** |
| 60 * Returns the index of the first effective color stage. If an intermediate
stage doesn't read | 67 * Returns the index of the first effective color stage. If an intermediate
stage doesn't read |
| 61 * its input or has a known output, then we can ignore all earlier stages si
nce they will not | 68 * its input or has a known output, then we can ignore all earlier stages si
nce they will not |
| 62 * affect the final output. Thus the first effective stage index is the inde
x to the first stage | 69 * affect the final output. Thus the first effective stage index is the inde
x to the first stage |
| 63 * that will have an effect on the final output. | 70 * that will have an effect on the final output. |
| 64 * | 71 * |
| 65 * If stages before the firstEffectiveStageIndex are removed, corresponding
values from | 72 * If stages before the firstEffectiveStageIndex are removed, corresponding
values from |
| (...skipping 19 matching lines...) Expand all Loading... |
| 85 bool readsFragPosition() const { return fReadsFragPosition; } | 92 bool readsFragPosition() const { return fReadsFragPosition; } |
| 86 | 93 |
| 87 private: | 94 private: |
| 88 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); | 95 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); |
| 89 | 96 |
| 90 GrInvariantOutput fInOut; | 97 GrInvariantOutput fInOut; |
| 91 int fFirstEffectStageIndex; | 98 int fFirstEffectStageIndex; |
| 92 bool fInputColorIsUsed; | 99 bool fInputColorIsUsed; |
| 93 GrColor fInputColor; | 100 GrColor fInputColor; |
| 94 bool fReadsFragPosition; | 101 bool fReadsFragPosition; |
| 102 bool fNeedsCoverageModulation; |
| 95 }; | 103 }; |
| 96 | 104 |
| 97 #endif | 105 #endif |
| OLD | NEW |