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; } | 26 bool readsDst() const { return fReadsDst; } |
27 bool readsFragPosition() const { return fReadsFragPosition; } | 27 bool readsFragPosition() const { return fReadsFragPosition; } |
28 bool requiresVertexShader() const { return fRequiresVertexShader; } | |
29 bool requiresLocalCoordAttrib() const { return fRequiresLocalCoordAttrib; } | 28 bool requiresLocalCoordAttrib() const { return fRequiresLocalCoordAttrib; } |
30 | 29 |
31 /////////////////////////////////////////////////////////////////////////// | 30 /////////////////////////////////////////////////////////////////////////// |
32 /// @name Stage Output Types | 31 /// @name Stage Output Types |
33 //// | 32 //// |
34 | 33 |
35 enum PrimaryOutputType { | 34 enum PrimaryOutputType { |
36 // Modulate color and coverage, write result as the color output. | 35 // Modulate color and coverage, write result as the color output. |
37 kModulate_PrimaryOutputType, | 36 kModulate_PrimaryOutputType, |
38 // Combines the coverage, dst, and color as coverage * color + (1 - cove
rage) * dst. This | 37 // Combines the coverage, dst, and color as coverage * color + (1 - cove
rage) * dst. This |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void setOutputStateInfo(const GrDrawTargetCaps&); | 115 void setOutputStateInfo(const GrDrawTargetCaps&); |
117 | 116 |
118 // These flags are needed to protect the code from creating an unused unifor
m color/coverage | 117 // These flags are needed to protect the code from creating an unused unifor
m color/coverage |
119 // which will cause shader compiler errors. | 118 // which will cause shader compiler errors. |
120 bool fInputColorIsUsed; | 119 bool fInputColorIsUsed; |
121 bool fInputCoverageIsUsed; | 120 bool fInputCoverageIsUsed; |
122 | 121 |
123 // These flags give aggregated info on the effect stages that are used when
building programs. | 122 // These flags give aggregated info on the effect stages that are used when
building programs. |
124 bool fReadsDst; | 123 bool fReadsDst; |
125 bool fReadsFragPosition; | 124 bool fReadsFragPosition; |
126 bool fRequiresVertexShader; | |
127 bool fRequiresLocalCoordAttrib; | 125 bool fRequiresLocalCoordAttrib; |
128 | 126 |
129 SkAutoSTArray<4, GrVertexAttrib> fOptVA; | 127 SkAutoSTArray<4, GrVertexAttrib> fOptVA; |
130 | 128 |
131 BlendOptFlags fBlendOptFlags; | 129 BlendOptFlags fBlendOptFlags; |
132 | 130 |
133 // Fragment shader color outputs | 131 // Fragment shader color outputs |
134 PrimaryOutputType fPrimaryOutputType : 8; | 132 PrimaryOutputType fPrimaryOutputType : 8; |
135 SecondaryOutputType fSecondaryOutputType : 8; | 133 SecondaryOutputType fSecondaryOutputType : 8; |
136 | 134 |
137 friend GrOptDrawState* GrDrawState::createOptState(const GrDrawTargetCaps&)
const; | 135 friend GrOptDrawState* GrDrawState::createOptState(const GrDrawTargetCaps&)
const; |
138 typedef GrRODrawState INHERITED; | 136 typedef GrRODrawState INHERITED; |
139 }; | 137 }; |
140 | 138 |
141 #endif | 139 #endif |
OLD | NEW |