OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "gl/GrGLShaderBuilder.h" | 8 #include "gl/GrGLShaderBuilder.h" |
9 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
10 #include "gl/GrGLUniformHandle.h" | 10 #include "gl/GrGLUniformHandle.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 GrGLSLExpr4 inputColor; | 158 GrGLSLExpr4 inputColor; |
159 GrGLSLExpr4 inputCoverage; | 159 GrGLSLExpr4 inputCoverage; |
160 | 160 |
161 if (GrGLProgramDesc::kUniform_ColorInput == header.fColorInput) { | 161 if (GrGLProgramDesc::kUniform_ColorInput == header.fColorInput) { |
162 const char* name; | 162 const char* name; |
163 fOutput.fUniformHandles.fColorUni = | 163 fOutput.fUniformHandles.fColorUni = |
164 this->addUniform(GrGLShaderBuilder::kFragment_Visibility, kVec4f_GrS
LType, "Color", | 164 this->addUniform(GrGLShaderBuilder::kFragment_Visibility, kVec4f_GrS
LType, "Color", |
165 &name); | 165 &name); |
166 inputColor = GrGLSLExpr4(name); | 166 inputColor = GrGLSLExpr4(name); |
| 167 } else if (GrGLProgramDesc::kSolidWhite_ColorInput == header.fColorInput) { |
| 168 inputColor = GrGLSLExpr4(1); |
| 169 } else if (GrGLProgramDesc::kTransBlack_ColorInput == header.fColorInput) { |
| 170 inputColor = GrGLSLExpr4(0); |
167 } | 171 } |
168 | 172 |
169 if (GrGLProgramDesc::kUniform_ColorInput == header.fCoverageInput) { | 173 if (GrGLProgramDesc::kUniform_ColorInput == header.fCoverageInput) { |
170 const char* name; | 174 const char* name; |
171 fOutput.fUniformHandles.fCoverageUni = | 175 fOutput.fUniformHandles.fCoverageUni = |
172 this->addUniform(GrGLShaderBuilder::kFragment_Visibility, kVec4f_GrS
LType, "Coverage", | 176 this->addUniform(GrGLShaderBuilder::kFragment_Visibility, kVec4f_GrS
LType, "Coverage", |
173 &name); | 177 &name); |
174 inputCoverage = GrGLSLExpr4(name); | 178 inputCoverage = GrGLSLExpr4(name); |
175 } else if (GrGLProgramDesc::kSolidWhite_ColorInput == header.fCoverageInput)
{ | 179 } else if (GrGLProgramDesc::kSolidWhite_ColorInput == header.fCoverageInput)
{ |
176 inputCoverage = GrGLSLExpr4(1); | 180 inputCoverage = GrGLSLExpr4(1); |
| 181 } else if (GrGLProgramDesc::kTransBlack_ColorInput == header.fCoverageInput)
{ |
| 182 inputCoverage = GrGLSLExpr4(0); |
177 } | 183 } |
178 | 184 |
179 if (k110_GrGLSLGeneration != fGpu->glslGeneration()) { | 185 if (k110_GrGLSLGeneration != fGpu->glslGeneration()) { |
180 fFSOutputs.push_back().set(kVec4f_GrSLType, | 186 fFSOutputs.push_back().set(kVec4f_GrSLType, |
181 GrGLShaderVar::kOut_TypeModifier, | 187 GrGLShaderVar::kOut_TypeModifier, |
182 declared_color_output_name()); | 188 declared_color_output_name()); |
183 fHasCustomColorOutput = true; | 189 fHasCustomColorOutput = true; |
184 } | 190 } |
185 | 191 |
186 this->emitCodeBeforeEffects(&inputColor, &inputCoverage); | 192 this->emitCodeBeforeEffects(&inputColor, &inputCoverage); |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 | 1099 |
1094 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, | 1100 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, |
1095 effectCnt); | 1101 effectCnt); |
1096 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, | 1102 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, |
1097 effectStages, | 1103 effectStages, |
1098 effectKeys, | 1104 effectKeys, |
1099 effectCnt, | 1105 effectCnt, |
1100 inOutFSColor); | 1106 inOutFSColor); |
1101 return pathTexGenEffectsBuilder.finish(); | 1107 return pathTexGenEffectsBuilder.finish(); |
1102 } | 1108 } |
OLD | NEW |