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 GrProgramDesc_DEFINED | 8 #ifndef GrProgramDesc_DEFINED |
9 #define GrProgramDesc_DEFINED | 9 #define GrProgramDesc_DEFINED |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 }; | 96 }; |
97 | 97 |
98 struct KeyHeader { | 98 struct KeyHeader { |
99 uint8_t fDstReadKey; // set by GrGLShaderBuilder i
f there | 99 uint8_t fDstReadKey; // set by GrGLShaderBuilder i
f there |
100 // are effects that must read
the dst. | 100 // are effects that must read
the dst. |
101 // Otherwise, 0. | 101 // Otherwise, 0. |
102 uint8_t fFragPosKey; // set by GrGLShaderBuilder i
f there are | 102 uint8_t fFragPosKey; // set by GrGLShaderBuilder i
f there are |
103 // effects that read the frag
ment position. | 103 // effects that read the frag
ment position. |
104 // Otherwise, 0. | 104 // Otherwise, 0. |
105 | 105 |
106 SkBool8 fEmitsPointSize; | |
107 | |
108 ColorInput fColorInput : 8; | 106 ColorInput fColorInput : 8; |
109 ColorInput fCoverageInput : 8; | 107 ColorInput fCoverageInput : 8; |
110 | 108 |
111 PrimaryOutputType fPrimaryOutputType : 8; | 109 PrimaryOutputType fPrimaryOutputType : 8; |
112 SecondaryOutputType fSecondaryOutputType : 8; | 110 SecondaryOutputType fSecondaryOutputType : 8; |
113 | 111 |
114 SkBool8 fHasGeometryProcessor; | 112 SkBool8 fHasGeometryProcessor; |
115 int8_t fColorEffectCnt; | 113 int8_t fColorEffectCnt; |
116 int8_t fCoverageEffectCnt; | 114 int8_t fCoverageEffectCnt; |
117 }; | 115 }; |
(...skipping 11 matching lines...) Expand all Loading... |
129 return this->header().fCoverageEffectCnt; | 127 return this->header().fCoverageEffectCnt; |
130 } | 128 } |
131 | 129 |
132 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } | 130 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } |
133 | 131 |
134 // This should really only be used internally, base classes should return th
eir own headers | 132 // This should really only be used internally, base classes should return th
eir own headers |
135 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO
ffset>(); } | 133 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO
ffset>(); } |
136 | 134 |
137 // A struct to communicate descriptor information to the program descriptor
builder | 135 // A struct to communicate descriptor information to the program descriptor
builder |
138 struct DescInfo { | 136 struct DescInfo { |
| 137 bool operator==(const DescInfo& that) const { |
| 138 return fHasVertexColor == that.fHasVertexColor && |
| 139 fHasVertexCoverage == that.fHasVertexCoverage && |
| 140 fInputColorIsUsed == that.fInputColorIsUsed && |
| 141 fInputCoverageIsUsed == that.fInputCoverageIsUsed && |
| 142 fReadsDst == that.fReadsDst && |
| 143 fReadsFragPosition == that.fReadsFragPosition && |
| 144 fRequiresLocalCoordAttrib == that.fRequiresLocalCoordAttrib &
& |
| 145 fPrimaryOutputType == that.fPrimaryOutputType && |
| 146 fSecondaryOutputType == that.fSecondaryOutputType; |
| 147 |
| 148 } |
| 149 bool operator!=(const DescInfo& that) const { return !(*this == that); }
; |
139 // TODO when GPs control uniform / attribute handling of color / coverag
e, then we can | 150 // TODO when GPs control uniform / attribute handling of color / coverag
e, then we can |
140 // clean this up | 151 // clean this up |
141 bool fHasVertexColor; | 152 bool fHasVertexColor; |
142 bool fHasVertexCoverage; | 153 bool fHasVertexCoverage; |
143 | 154 |
144 // These flags are needed to protect the code from creating an unused un
iform color/coverage | 155 // These flags are needed to protect the code from creating an unused un
iform color/coverage |
145 // which will cause shader compiler errors. | 156 // which will cause shader compiler errors. |
146 bool fInputColorIsUsed; | 157 bool fInputColorIsUsed; |
147 bool fInputCoverageIsUsed; | 158 bool fInputCoverageIsUsed; |
148 | 159 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 kPreAllocSize = kHeaderOffset + kHeaderSize + | 208 kPreAllocSize = kHeaderOffset + kHeaderSize + |
198 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc
essor, | 209 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc
essor, |
199 }; | 210 }; |
200 | 211 |
201 SkSTArray<kPreAllocSize, uint8_t, true> fKey; | 212 SkSTArray<kPreAllocSize, uint8_t, true> fKey; |
202 | 213 |
203 friend class GrGLProgramDescBuilder; | 214 friend class GrGLProgramDescBuilder; |
204 }; | 215 }; |
205 | 216 |
206 #endif | 217 #endif |
OLD | NEW |