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 #include "gl/GrGLProgram.h" | 8 #include "gl/GrGLProgram.h" |
9 #include "gl/GrGLSLPrettyPrint.h" | 9 #include "gl/GrGLSLPrettyPrint.h" |
10 #include "gl/GrGLUniformHandle.h" | 10 #include "gl/GrGLUniformHandle.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 GrGLSLExpr4 inputCoverage; | 44 GrGLSLExpr4 inputCoverage; |
45 | 45 |
46 if (GrGLProgramDesc::kUniform_ColorInput == header.fColorInput) { | 46 if (GrGLProgramDesc::kUniform_ColorInput == header.fColorInput) { |
47 const char* name; | 47 const char* name; |
48 fUniformHandles.fColorUni = | 48 fUniformHandles.fColorUni = |
49 this->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 49 this->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
50 kVec4f_GrSLType, | 50 kVec4f_GrSLType, |
51 "Color", | 51 "Color", |
52 &name); | 52 &name); |
53 inputColor = GrGLSLExpr4(name); | 53 inputColor = GrGLSLExpr4(name); |
| 54 } else if (GrGLProgramDesc::kAllOnes_ColorInput == header.fColorInput) { |
| 55 inputColor = GrGLSLExpr4(1); |
54 } | 56 } |
55 | 57 |
56 if (GrGLProgramDesc::kUniform_ColorInput == header.fCoverageInput) { | 58 if (GrGLProgramDesc::kUniform_ColorInput == header.fCoverageInput) { |
57 const char* name; | 59 const char* name; |
58 fUniformHandles.fCoverageUni = | 60 fUniformHandles.fCoverageUni = |
59 this->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 61 this->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
60 kVec4f_GrSLType, | 62 kVec4f_GrSLType, |
61 "Coverage", | 63 "Coverage", |
62 &name); | 64 &name); |
63 inputCoverage = GrGLSLExpr4(name); | 65 inputCoverage = GrGLSLExpr4(name); |
64 } else if (GrGLProgramDesc::kSolidWhite_ColorInput == header.fCoverageInput)
{ | 66 } else if (GrGLProgramDesc::kAllOnes_ColorInput == header.fCoverageInput) { |
65 inputCoverage = GrGLSLExpr4(1); | 67 inputCoverage = GrGLSLExpr4(1); |
66 } | 68 } |
67 | 69 |
68 this->emitCodeBeforeEffects(&inputColor, &inputCoverage); | 70 this->emitCodeBeforeEffects(&inputColor, &inputCoverage); |
69 | 71 |
70 /////////////////////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////////////////////// |
71 // emit the per-effect code for both color and coverage effects | 73 // emit the per-effect code for both color and coverage effects |
72 | 74 |
73 GrGLProgramDesc::EffectKeyProvider colorKeyProvider( | 75 GrGLProgramDesc::EffectKeyProvider colorKeyProvider( |
74 &this->desc(), GrGLProgramDesc::EffectKeyProvider::kColor_EffectType); | 76 &this->desc(), GrGLProgramDesc::EffectKeyProvider::kColor_EffectType); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 427 |
426 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, | 428 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, |
427 effectCnt); | 429 effectCnt); |
428 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, | 430 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, |
429 effectStages, | 431 effectStages, |
430 effectCnt, | 432 effectCnt, |
431 keyProvider, | 433 keyProvider, |
432 inOutFSColor); | 434 inOutFSColor); |
433 return pathTexGenEffectsBuilder.finish(); | 435 return pathTexGenEffectsBuilder.finish(); |
434 } | 436 } |
OLD | NEW |