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 GrOptDrawState_DEFINED | 8 #ifndef GrOptDrawState_DEFINED |
9 #define GrOptDrawState_DEFINED | 9 #define GrOptDrawState_DEFINED |
10 | 10 |
11 #include "GrDrawState.h" | 11 #include "GrDrawState.h" |
12 #include "GrRODrawState.h" | 12 #include "GrRODrawState.h" |
13 | 13 |
14 /** | 14 /** |
15 * Subclass of GrRODrawState that holds an optimized version of a GrDrawState. L ike it's parent | 15 * Subclass of GrRODrawState that holds an optimized version of a GrDrawState. L ike it's parent |
16 * it is meant to be an immutable class, and simply adds a few helpful data memb ers not in the | 16 * it is meant to be an immutable class, and simply adds a few helpful data memb ers not in the |
17 * base class. | 17 * base class. |
18 */ | 18 */ |
19 class GrOptDrawState : public GrRODrawState { | 19 class GrOptDrawState : public GrRODrawState { |
20 public: | 20 public: |
21 bool operator== (const GrOptDrawState& that) const; | 21 bool operator== (const GrOptDrawState& that) const; |
22 | 22 |
23 bool inputColorIsUsed() const { return fInputColorIsUsed; } | 23 bool inputColorIsUsed() const { return fInputColorIsUsed; } |
24 bool inputCoverageIsUsed() const { return fInputCoverageIsUsed; } | 24 bool inputCoverageIsUsed() const { return fInputCoverageIsUsed; } |
25 | 25 |
26 bool readsDst() const { return fReadsDst; } | |
27 bool readsFragPosition() const { return fReadsFragPosition; } | |
28 bool requiresVertexShader() const { return fRequiresVertexShader; } | |
29 | |
26 private: | 30 private: |
27 /** | 31 /** |
28 * Constructs and optimized drawState out of a GrRODrawState. | 32 * Constructs and optimized drawState out of a GrRODrawState. |
29 */ | 33 */ |
30 GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags, | 34 GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags, |
31 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff); | 35 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff); |
32 | 36 |
33 /* | 37 /* |
34 * Loops through all the color stage effects to check if the stage will igno re color input or | 38 * Loops through all the color stage effects to check if the stage will igno re color input or |
35 * always output a constant color. In the ignore color input case we can ign ore all previous | 39 * always output a constant color. In the ignore color input case we can ign ore all previous |
(...skipping 30 matching lines...) Expand all Loading... | |
66 * DrawState. | 70 * DrawState. |
67 */ | 71 */ |
68 void initializeVAIndexMap(); | 72 void initializeVAIndexMap(); |
69 | 73 |
70 /* | 74 /* |
71 * Loop over the various effect stages and remap any non-fixed function VA's to have the corret | 75 * Loop over the various effect stages and remap any non-fixed function VA's to have the corret |
72 * index based off of fVAIndexMap | 76 * index based off of fVAIndexMap |
73 */ | 77 */ |
74 void remapEffectStagesVAIndices(); | 78 void remapEffectStagesVAIndices(); |
75 | 79 |
80 /** | |
81 * Loop over the effect stages to determine various info like what data they will read and what | |
82 * shaders they require. | |
83 */ | |
84 void getStageStats(); | |
85 | |
76 // These flags are needed to protect the code from creating an unused unifor m color/coverage | 86 // These flags are needed to protect the code from creating an unused unifor m color/coverage |
77 // which will cause shader compiler errors. | 87 // which will cause shader compiler errors. |
78 bool fInputColorIsUsed; | 88 bool fInputColorIsUsed; |
79 bool fInputCoverageIsUsed; | 89 bool fInputCoverageIsUsed; |
80 | 90 |
91 // These flags give general info on the effect stages that are used when bui lding the programs | |
bsalomon
2014/09/05 15:27:55
general info -> aggregated info?
egdaniel
2014/09/08 19:19:49
Done.
| |
92 bool fReadsDst; | |
93 bool fReadsFragPosition; | |
94 bool fRequiresVertexShader; | |
95 | |
81 SkAutoSTArray<4, GrVertexAttrib> fOptVA; | 96 SkAutoSTArray<4, GrVertexAttrib> fOptVA; |
82 SkAutoSTArray<4, int> fVAIndexMap; | 97 SkAutoSTArray<4, int> fVAIndexMap; |
83 | 98 |
84 friend GrOptDrawState* GrDrawState::createOptState() const; | 99 friend GrOptDrawState* GrDrawState::createOptState() const; |
85 typedef GrRODrawState INHERITED; | 100 typedef GrRODrawState INHERITED; |
86 }; | 101 }; |
87 | 102 |
88 #endif | 103 #endif |
OLD | NEW |