Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: src/gpu/GrProcOptInfo.h

Issue 1734163002: Replace fWillReadFragmentPosition with a bitfield (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "GrProcessor.h"
13 14
14 class GrDrawBatch; 15 class GrDrawBatch;
15 class GrFragmentProcessor; 16 class GrFragmentProcessor;
16 class GrPrimitiveProcessor; 17 class GrPrimitiveProcessor;
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 , fFirstEffectiveProcessorIndex(0) 28 , fFirstEffectiveProcessorIndex(0)
29 , fInputColorIsUsed(true) 29 , fInputColorIsUsed(true)
30 , fInputColor(0) 30 , fInputColor(0)
31 , fReadsFragPosition(false) {} 31 , fBuiltInState(GrProcessor::kNone_BuiltInState) {}
32 32
33 void calcWithInitialValues(const GrFragmentProcessor* const *, int cnt, GrCo lor startColor, 33 void calcWithInitialValues(const GrFragmentProcessor* const *, int cnt, GrCo lor startColor,
34 GrColorComponentFlags, bool areCoverageStages, bo ol isLCD = false); 34 GrColorComponentFlags, bool areCoverageStages, bo ol isLCD = false);
35 void initUsingInvariantOutput(GrInitInvariantOutput invOutput); 35 void initUsingInvariantOutput(GrInitInvariantOutput invOutput);
36 void completeCalculations(const GrFragmentProcessor * const processors[], in t cnt); 36 void completeCalculations(const GrFragmentProcessor * const processors[], in t cnt);
37 37
38 bool isSolidWhite() const { return fInOut.isSolidWhite(); } 38 bool isSolidWhite() const { return fInOut.isSolidWhite(); }
39 bool isOpaque() const { return fInOut.isOpaque(); } 39 bool isOpaque() const { return fInOut.isOpaque(); }
40 bool isSingleComponent() const { return fInOut.isSingleComponent(); } 40 bool isSingleComponent() const { return fInOut.isSingleComponent(); }
41 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } 41 bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); }
(...skipping 27 matching lines...) Expand all
69 */ 69 */
70 bool inputColorIsUsed() const { return fInputColorIsUsed; } 70 bool inputColorIsUsed() const { return fInputColorIsUsed; }
71 71
72 /** 72 /**
73 * If input color is used and per-vertex colors are not used, this is the in put color to the 73 * If input color is used and per-vertex colors are not used, this is the in put color to the
74 * first effective processor. 74 * first effective processor.
75 */ 75 */
76 GrColor inputColorToFirstEffectiveProccesor() const { return fInputColor; } 76 GrColor inputColorToFirstEffectiveProccesor() const { return fInputColor; }
77 77
78 /** 78 /**
79 * Returns true if any of the processor preserved by GrProcOptInfo read the frag position. 79 * Returns the set of built-in state used by the processors preserved by GrP rocOptInfo.
80 */ 80 */
81 bool readsFragPosition() const { return fReadsFragPosition; } 81 GrProcessor::BuiltInState builtInState() const { return fBuiltInState; }
82 82
83 private: 83 private:
84 void internalCalc(const GrFragmentProcessor* const[], int cnt, bool initWill ReadFragPosition); 84 void internalCalc(const GrFragmentProcessor* const[], int cnt);
85 85
86 GrInvariantOutput fInOut; 86 GrInvariantOutput fInOut;
87 int fFirstEffectiveProcessorIndex; 87 int fFirstEffectiveProcessorIndex;
88 bool fInputColorIsUsed; 88 bool fInputColorIsUsed;
89 GrColor fInputColor; 89 GrColor fInputColor;
90 bool fReadsFragPosition; 90 GrProcessor::BuiltInState fBuiltInState;
91 }; 91 };
92 92
93 #endif 93 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698