OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrGLProgramDesc_DEFINED | 8 #ifndef GrGLProgramDesc_DEFINED |
9 #define GrGLProgramDesc_DEFINED | 9 #define GrGLProgramDesc_DEFINED |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 uint32_t getChecksum() const { return *this->atOffset<uint32_t, kChecksumOff
set>(); } | 36 uint32_t getChecksum() const { return *this->atOffset<uint32_t, kChecksumOff
set>(); } |
37 | 37 |
38 /** | 38 /** |
39 * Builds a program descriptor from a GrOptDrawState. Whether the primitive
type is points, and | 39 * Builds a program descriptor from a GrOptDrawState. Whether the primitive
type is points, and |
40 * the caps of the GrGpuGL are also inputs. It also outputs the color and co
verage stages | 40 * the caps of the GrGpuGL are also inputs. It also outputs the color and co
verage stages |
41 * referenced by the generated descriptor. Coverage stages from the drawStat
e may be treated as | 41 * referenced by the generated descriptor. Coverage stages from the drawStat
e may be treated as |
42 * color stages in the output. | 42 * color stages in the output. |
43 */ | 43 */ |
44 static bool Build(const GrOptDrawState&, | 44 static bool Build(const GrOptDrawState&, |
45 GrGpu::DrawType, | 45 GrGpu::DrawType, |
46 GrBlendCoeff srcCoeff, | |
47 GrBlendCoeff dstCoeff, | |
48 GrGpuGL*, | 46 GrGpuGL*, |
49 const GrDeviceCoordTexture* dstCopy, | 47 const GrDeviceCoordTexture*, |
50 const GrGeometryStage** geometryProcessor, | |
51 SkTArray<const GrFragmentStage*, true>* colorStages, | |
52 SkTArray<const GrFragmentStage*, true>* coverageStages, | |
53 GrGLProgramDesc*); | 48 GrGLProgramDesc*); |
54 | 49 |
55 bool hasGeometryProcessor() const { | 50 bool hasGeometryProcessor() const { |
56 return SkToBool(this->getHeader().fHasGeometryProcessor); | 51 return SkToBool(this->getHeader().fHasGeometryProcessor); |
57 } | 52 } |
58 | 53 |
59 int numColorEffects() const { | 54 int numColorEffects() const { |
60 return this->getHeader().fColorEffectCnt; | 55 return this->getHeader().fColorEffectCnt; |
61 } | 56 } |
62 | 57 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 156 |
162 /** Used to provide effects' keys to their emitCode() function. */ | 157 /** Used to provide effects' keys to their emitCode() function. */ |
163 class EffectKeyProvider { | 158 class EffectKeyProvider { |
164 public: | 159 public: |
165 enum EffectType { | 160 enum EffectType { |
166 kGeometryProcessor_EffectType, | 161 kGeometryProcessor_EffectType, |
167 kColor_EffectType, | 162 kColor_EffectType, |
168 kCoverage_EffectType, | 163 kCoverage_EffectType, |
169 }; | 164 }; |
170 | 165 |
171 EffectKeyProvider(const GrGLProgramDesc* desc, EffectType type) : fDesc(
desc) { | 166 EffectKeyProvider(const GrGLProgramDesc* desc, EffectType type) |
| 167 : fDesc(desc), fBaseIndex(0) { |
172 switch (type) { | 168 switch (type) { |
173 case kGeometryProcessor_EffectType: | 169 case kGeometryProcessor_EffectType: |
174 // there can be only one | 170 // there can be only one |
175 fBaseIndex = 0; | 171 fBaseIndex = 0; |
176 break; | 172 break; |
177 case kColor_EffectType: | 173 case kColor_EffectType: |
178 fBaseIndex = desc->hasGeometryProcessor() ? 1 : 0; | 174 fBaseIndex = desc->hasGeometryProcessor() ? 1 : 0; |
179 break; | 175 break; |
180 case kCoverage_EffectType: | 176 case kCoverage_EffectType: |
181 fBaseIndex = desc->numColorEffects() + (desc->hasGeometryPro
cessor() ? 1 : 0); | 177 fBaseIndex = desc->numColorEffects() + (desc->hasGeometryPro
cessor() ? 1 : 0); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // visible to GrGLProcessors. Then make public accessors as necessary and re
move friends. | 210 // visible to GrGLProcessors. Then make public accessors as necessary and re
move friends. |
215 friend class GrGLProgram; | 211 friend class GrGLProgram; |
216 friend class GrGLProgramBuilder; | 212 friend class GrGLProgramBuilder; |
217 friend class GrGLLegacyNvprProgramBuilder; | 213 friend class GrGLLegacyNvprProgramBuilder; |
218 friend class GrGLVertexBuilder; | 214 friend class GrGLVertexBuilder; |
219 friend class GrGLFragmentShaderBuilder; | 215 friend class GrGLFragmentShaderBuilder; |
220 friend class GrGLGeometryBuilder; | 216 friend class GrGLGeometryBuilder; |
221 }; | 217 }; |
222 | 218 |
223 #endif | 219 #endif |
OLD | NEW |