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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Otherwise, 0. | 104 // Otherwise, 0. |
105 | 105 |
106 SkBool8 fEmitsPointSize; | 106 SkBool8 fEmitsPointSize; |
107 | 107 |
108 ColorInput fColorInput : 8; | 108 ColorInput fColorInput : 8; |
109 ColorInput fCoverageInput : 8; | 109 ColorInput fCoverageInput : 8; |
110 | 110 |
111 PrimaryOutputType fPrimaryOutputType : 8; | 111 PrimaryOutputType fPrimaryOutputType : 8; |
112 SecondaryOutputType fSecondaryOutputType : 8; | 112 SecondaryOutputType fSecondaryOutputType : 8; |
113 | 113 |
114 int8_t fPositionAttributeIndex; | |
115 int8_t fLocalCoordAttributeIndex; | |
116 int8_t fColorAttributeIndex; | |
117 int8_t fCoverageAttributeIndex; | |
118 | |
119 SkBool8 fHasGeometryProcessor; | 114 SkBool8 fHasGeometryProcessor; |
120 int8_t fColorEffectCnt; | 115 int8_t fColorEffectCnt; |
121 int8_t fCoverageEffectCnt; | 116 int8_t fCoverageEffectCnt; |
122 }; | 117 }; |
123 | 118 |
124 | 119 |
125 bool hasGeometryProcessor() const { | 120 bool hasGeometryProcessor() const { |
126 return SkToBool(this->header().fHasGeometryProcessor); | 121 return SkToBool(this->header().fHasGeometryProcessor); |
127 } | 122 } |
128 | 123 |
129 int numColorEffects() const { | 124 int numColorEffects() const { |
130 return this->header().fColorEffectCnt; | 125 return this->header().fColorEffectCnt; |
131 } | 126 } |
132 | 127 |
133 int numCoverageEffects() const { | 128 int numCoverageEffects() const { |
134 return this->header().fCoverageEffectCnt; | 129 return this->header().fCoverageEffectCnt; |
135 } | 130 } |
136 | 131 |
137 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } | 132 int numTotalEffects() const { return this->numColorEffects() + this->numCove
rageEffects(); } |
138 | 133 |
139 // This should really only be used internally, base classes should return th
eir own headers | 134 // This should really only be used internally, base classes should return th
eir own headers |
140 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO
ffset>(); } | 135 const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderO
ffset>(); } |
141 | 136 |
142 // A struct to communicate descriptor information to the program descriptor
builder | 137 // A struct to communicate descriptor information to the program descriptor
builder |
143 struct DescInfo { | 138 struct DescInfo { |
144 int positionAttributeIndex() const { | 139 // TODO when GPs control uniform / attribute handling of color / coverag
e, then we can |
145 return fFixedFunctionVertexAttribIndices[kPosition_GrVertexAttribBin
ding]; | 140 // clean this up |
146 } | 141 bool fHasVertexColor; |
147 int localCoordAttributeIndex() const { | 142 bool fHasVertexCoverage; |
148 return fFixedFunctionVertexAttribIndices[kLocalCoord_GrVertexAttribB
inding]; | |
149 } | |
150 int colorVertexAttributeIndex() const { | |
151 return fFixedFunctionVertexAttribIndices[kColor_GrVertexAttribBindin
g]; | |
152 } | |
153 int coverageVertexAttributeIndex() const { | |
154 return fFixedFunctionVertexAttribIndices[kCoverage_GrVertexAttribBin
ding]; | |
155 } | |
156 bool hasLocalCoordAttribute() const { | |
157 return -1 != fFixedFunctionVertexAttribIndices[kLocalCoord_GrVertexA
ttribBinding]; | |
158 } | |
159 bool hasColorVertexAttribute() const { | |
160 return -1 != fFixedFunctionVertexAttribIndices[kColor_GrVertexAttrib
Binding]; | |
161 } | |
162 bool hasCoverageVertexAttribute() const { | |
163 return -1 != fFixedFunctionVertexAttribIndices[kCoverage_GrVertexAtt
ribBinding]; | |
164 } | |
165 | |
166 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindin
gCnt]; | |
167 | 143 |
168 // These flags are needed to protect the code from creating an unused un
iform color/coverage | 144 // These flags are needed to protect the code from creating an unused un
iform color/coverage |
169 // which will cause shader compiler errors. | 145 // which will cause shader compiler errors. |
170 bool fInputColorIsUsed; | 146 bool fInputColorIsUsed; |
171 bool fInputCoverageIsUsed; | 147 bool fInputCoverageIsUsed; |
172 | 148 |
173 // These flags give aggregated info on the processor stages that are use
d when building | 149 // These flags give aggregated info on the processor stages that are use
d when building |
174 // programs. | 150 // programs. |
175 bool fReadsDst; | 151 bool fReadsDst; |
176 bool fReadsFragPosition; | 152 bool fReadsFragPosition; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 kPreAllocSize = kHeaderOffset + kHeaderSize + | 197 kPreAllocSize = kHeaderOffset + kHeaderSize + |
222 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc
essor, | 198 kMaxPreallocProcessors * sizeof(uint32_t) * kIntsPerProc
essor, |
223 }; | 199 }; |
224 | 200 |
225 SkSTArray<kPreAllocSize, uint8_t, true> fKey; | 201 SkSTArray<kPreAllocSize, uint8_t, true> fKey; |
226 | 202 |
227 friend class GrGLProgramDescBuilder; | 203 friend class GrGLProgramDescBuilder; |
228 }; | 204 }; |
229 | 205 |
230 #endif | 206 #endif |
OLD | NEW |