| 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; |
| 14 class GrFragmentStage; | 15 class GrFragmentStage; |
| 15 class GrFragmentProcessor; | 16 class GrFragmentProcessor; |
| 16 class GrPrimitiveProcessor; | 17 class GrPrimitiveProcessor; |
| 17 class GrProcessor; | 18 class GrProcessor; |
| 18 | 19 |
| 19 /** | 20 /** |
| 20 * GrProcOptInfo gathers invariant data from a set of processor stages.It is use
d to recognize | 21 * 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 | 22 * optimizations related to eliminating stages and vertex attributes that aren't
necessary for a |
| 22 * draw. | 23 * draw. |
| 23 */ | 24 */ |
| 24 class GrProcOptInfo { | 25 class GrProcOptInfo { |
| 25 public: | 26 public: |
| 26 GrProcOptInfo() | 27 GrProcOptInfo() |
| 27 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) | 28 : fInOut(0, static_cast<GrColorComponentFlags>(0), false) |
| 28 , fFirstEffectStageIndex(0) | 29 , fFirstEffectStageIndex(0) |
| 29 , fInputColorIsUsed(true) | 30 , fInputColorIsUsed(true) |
| 30 , fInputColor(0) | 31 , fInputColor(0) |
| 31 , fReadsFragPosition(false) {} | 32 , fReadsFragPosition(false) {} |
| 32 | 33 |
| 33 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, | 34 void calcWithInitialValues(const GrFragmentStage*, int stageCount, GrColor s
tartColor, |
| 34 GrColorComponentFlags flags, bool areCoverageStag
es); | 35 GrColorComponentFlags flags, bool areCoverageStag
es); |
| 35 | 36 |
| 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 |
| 36 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); | 41 void calcColorWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentStag
e*, int stagecount); |
| 37 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, | 42 void calcCoverageWithPrimProc(const GrPrimitiveProcessor*, const GrFragmentS
tage*, |
| 38 int stagecount); | 43 int stagecount); |
| 39 | 44 |
| 40 bool isSolidWhite() const { return fInOut.isSolidWhite(); } | 45 bool isSolidWhite() const { return fInOut.isSolidWhite(); } |
| 41 bool isOpaque() const { return fInOut.isOpaque(); } | 46 bool isOpaque() const { return fInOut.isOpaque(); } |
| 42 bool isSingleComponent() const { return fInOut.isSingleComponent(); } | 47 bool isSingleComponent() const { return fInOut.isSingleComponent(); } |
| 43 | 48 |
| 44 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. | 49 // TODO: Once texture pixel configs quaries are updated, we no longer need t
his function. |
| 45 // For now this function will correctly tell us if we are using LCD text or
not and should only | 50 // 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... |
| 82 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); | 87 void internalCalc(const GrFragmentStage*, int stagecount, bool initWillReadF
ragPosition); |
| 83 | 88 |
| 84 GrInvariantOutput fInOut; | 89 GrInvariantOutput fInOut; |
| 85 int fFirstEffectStageIndex; | 90 int fFirstEffectStageIndex; |
| 86 bool fInputColorIsUsed; | 91 bool fInputColorIsUsed; |
| 87 GrColor fInputColor; | 92 GrColor fInputColor; |
| 88 bool fReadsFragPosition; | 93 bool fReadsFragPosition; |
| 89 }; | 94 }; |
| 90 | 95 |
| 91 #endif | 96 #endif |
| OLD | NEW |