| 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 GrBatch; | |
| 15 class GrFragmentStage; | 14 class GrFragmentStage; |
| 16 class GrFragmentProcessor; | 15 class GrFragmentProcessor; |
| 17 class GrPrimitiveProcessor; | 16 class GrPrimitiveProcessor; |
| 18 class GrProcessor; | 17 class GrProcessor; |
| 19 | 18 |
| 20 /** | 19 /** |
| 21 * 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 |
| 22 * 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 |
| 23 * draw. | 22 * draw. |
| 24 */ | 23 */ |
| 25 class GrProcOptInfo { | 24 class GrProcOptInfo { |
| 26 public: | 25 public: |
| 27 GrProcOptInfo() | 26 GrProcOptInfo() |
| 28 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) | 27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) |
| 29 , fFirstEffectStageIndex(0) | 28 , fFirstEffectStageIndex(0) |
| 30 , fInputColorIsUsed(true) | 29 , fInputColorIsUsed(true) |
| 31 , fInputColor(0) | 30 , fInputColor(0) |
| 32 , fReadsFragPosition(false) {} | 31 , fReadsFragPosition(false) {} |
| 33 | 32 |
| 34 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, | 33 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, |
| 35 GrColorComponentFlags flags, bool areCoverageStag
es); | 34 GrColorComponentFlags flags, bool areCoverageStag
es); |
| 36 | 35 |
| 37 void calcColorWithBatch(const GrBatch*, const GrFragmentStage*, int stagecou
nt); | |
| 38 void calcCoverageWithBatch(const GrBatch*, const GrFragmentStage*, int stage
count); | |
| 39 | |
| 40 // TODO delete these when batch is everywhere | |
| 41 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); | 36 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); |
| 42 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, | 37 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, |
| 43 int stagecount); | 38 int stagecount); |
| 44 | 39 |
| 45 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 40 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
| 46 bool isOpaque() const { return fInOut.isOpaque(); } | 41 bool isOpaque() const { return fInOut.isOpaque(); } |
| 47 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 42 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
| 48 | 43 |
| 49 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. | 44 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. |
| 50 // For now this function will correctly tell us if we are using LCD text or
not and should only | 45 // For now this function will correctly tell us if we are using LCD text or
not and should only |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); | 82 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); |
| 88 | 83 |
| 89 GrInvariantOutput fInOut; | 84 GrInvariantOutput fInOut; |
| 90 int fFirstEffectStageIndex; | 85 int fFirstEffectStageIndex; |
| 91 bool fInputColorIsUsed; | 86 bool fInputColorIsUsed; |
| 92 GrColor fInputColor; | 87 GrColor fInputColor; |
| 93 bool fReadsFragPosition; | 88 bool fReadsFragPosition; |
| 94 }; | 89 }; |
| 95 | 90 |
| 96 #endif | 91 #endif |
| OLD | NEW |