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 |
11 #include "GrGLEffect.h" | 11 #include "GrGLEffect.h" |
12 #include "GrDrawState.h" | 12 #include "GrDrawState.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
| 14 #include "GrOptDrawState.h" |
14 | 15 |
15 class GrGpuGL; | 16 class GrGpuGL; |
16 | 17 |
17 #ifdef SK_DEBUG | 18 #ifdef SK_DEBUG |
18 // Optionally compile the experimental GS code. Set to SK_DEBUG so that debug
build bots will | 19 // Optionally compile the experimental GS code. Set to SK_DEBUG so that debug
build bots will |
19 // execute the code. | 20 // execute the code. |
20 #define GR_GL_EXPERIMENTAL_GS 1 | 21 #define GR_GL_EXPERIMENTAL_GS 1 |
21 #else | 22 #else |
22 #define GR_GL_EXPERIMENTAL_GS 0 | 23 #define GR_GL_EXPERIMENTAL_GS 0 |
23 #endif | 24 #endif |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 private: | 104 private: |
104 // Specifies where the initial color comes from before the stages are applie
d. | 105 // Specifies where the initial color comes from before the stages are applie
d. |
105 enum ColorInput { | 106 enum ColorInput { |
106 kAllOnes_ColorInput, | 107 kAllOnes_ColorInput, |
107 kAttribute_ColorInput, | 108 kAttribute_ColorInput, |
108 kUniform_ColorInput, | 109 kUniform_ColorInput, |
109 | 110 |
110 kColorInputCnt | 111 kColorInputCnt |
111 }; | 112 }; |
112 | 113 |
113 enum CoverageOutput { | |
114 // modulate color and coverage, write result as the color output. | |
115 kModulate_CoverageOutput, | |
116 // Writes color*coverage as the primary color output and also writes cov
erage as the | |
117 // secondary output. Only set if dual source blending is supported. | |
118 kSecondaryCoverage_CoverageOutput, | |
119 // Writes color*coverage as the primary color output and also writes cov
erage * (1 - colorA) | |
120 // as the secondary output. Only set if dual source blending is supporte
d. | |
121 kSecondaryCoverageISA_CoverageOutput, | |
122 // Writes color*coverage as the primary color output and also writes cov
erage * | |
123 // (1 - colorRGB) as the secondary output. Only set if dual source blend
ing is supported. | |
124 kSecondaryCoverageISC_CoverageOutput, | |
125 // Combines the coverage, dst, and color as coverage * color + (1 - cove
rage) * dst. This | |
126 // can only be set if fDstReadKey is non-zero. | |
127 kCombineWithDst_CoverageOutput, | |
128 | |
129 kCoverageOutputCnt | |
130 }; | |
131 | |
132 static bool CoverageOutputUsesSecondaryOutput(CoverageOutput co) { | |
133 switch (co) { | |
134 case kSecondaryCoverage_CoverageOutput: // fallthru | |
135 case kSecondaryCoverageISA_CoverageOutput: | |
136 case kSecondaryCoverageISC_CoverageOutput: | |
137 return true; | |
138 default: | |
139 return false; | |
140 } | |
141 } | |
142 | |
143 struct KeyHeader { | 114 struct KeyHeader { |
144 uint8_t fDstReadKey; // set by GrGLShaderBuil
der if there | 115 uint8_t fDstReadKey; // set by GrGLShaderBuil
der if there |
145 // are effects that must
read the dst. | 116 // are effects that must
read the dst. |
146 // Otherwise, 0. | 117 // Otherwise, 0. |
147 uint8_t fFragPosKey; // set by GrGLShaderBuil
der if there are | 118 uint8_t fFragPosKey; // set by GrGLShaderBuil
der if there are |
148 // effects that read the
fragment position. | 119 // effects that read the
fragment position. |
149 // Otherwise, 0. | 120 // Otherwise, 0. |
150 ColorInput fColorInput : 8; | |
151 ColorInput fCoverageInput : 8; | |
152 CoverageOutput fCoverageOutput : 8; | |
153 | 121 |
154 SkBool8 fRequiresVertexShader; | 122 ColorInput fColorInput : 8; |
155 SkBool8 fEmitsPointSize; | 123 ColorInput fCoverageInput : 8; |
| 124 |
| 125 GrOptDrawState::PrimaryOutputType fPrimaryOutputType : 8; |
| 126 GrOptDrawState::SecondaryOutputType fSecondaryOutputType : 8; |
| 127 |
| 128 SkBool8 fRequiresVertexShader; |
| 129 SkBool8 fEmitsPointSize; |
156 | 130 |
157 // To enable experimental geometry shader code (not for use in | 131 // To enable experimental geometry shader code (not for use in |
158 // production) | 132 // production) |
159 #if GR_GL_EXPERIMENTAL_GS | 133 #if GR_GL_EXPERIMENTAL_GS |
160 SkBool8 fExperimentalGS; | 134 SkBool8 fExperimentalGS; |
161 #endif | 135 #endif |
162 | 136 |
163 int8_t fPositionAttributeIndex; | 137 int8_t fPositionAttributeIndex; |
164 int8_t fLocalCoordAttributeIndex; | 138 int8_t fLocalCoordAttributeIndex; |
165 int8_t fColorAttributeIndex; | 139 int8_t fColorAttributeIndex; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 friend class GrGLProgram; | 239 friend class GrGLProgram; |
266 friend class GrGLProgramBuilder; | 240 friend class GrGLProgramBuilder; |
267 friend class GrGLFullProgramBuilder; | 241 friend class GrGLFullProgramBuilder; |
268 friend class GrGLFragmentOnlyProgramBuilder; | 242 friend class GrGLFragmentOnlyProgramBuilder; |
269 friend class GrGLVertexShaderBuilder; | 243 friend class GrGLVertexShaderBuilder; |
270 friend class GrGLFragmentShaderBuilder; | 244 friend class GrGLFragmentShaderBuilder; |
271 friend class GrGLGeometryShaderBuilder; | 245 friend class GrGLGeometryShaderBuilder; |
272 }; | 246 }; |
273 | 247 |
274 #endif | 248 #endif |
OLD | NEW |