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 GrGLFragmentOnlyProgramBuilder_DEFINED | 8 #ifndef GrGLFragmentOnlyProgramBuilder_DEFINED |
9 #define GrGLFragmentOnlyProgramBuilder_DEFINED | 9 #define GrGLFragmentOnlyProgramBuilder_DEFINED |
10 | 10 |
11 #include "GrGLProgramBuilder.h" | 11 #include "GrGLProgramBuilder.h" |
12 | 12 |
13 class GrGLFragmentOnlyProgramBuilder : public GrGLProgramBuilder { | 13 class GrGLFragmentOnlyProgramBuilder : public GrGLProgramBuilder { |
14 public: | 14 public: |
15 GrGLFragmentOnlyProgramBuilder(GrGpuGL*, const GrGLProgramDesc&); | 15 GrGLFragmentOnlyProgramBuilder(GrGpuGL*, const GrGLProgramDesc&); |
16 | 16 |
17 int addTexCoordSets(int count); | 17 int addTexCoordSets(int count); |
18 | 18 |
19 private: | 19 private: |
20 virtual void emitCodeBeforeEffects(GrGLSLExpr4* color, | 20 virtual void createAndEmitEffects(const GrEffectStage* geometryProcessor, |
21 GrGLSLExpr4* coverage) SK_OVERRIDE {} | 21 const GrEffectStage* colorStages[], |
| 22 const GrEffectStage* coverageStages[], |
| 23 GrGLSLExpr4* inputColor, |
| 24 GrGLSLExpr4* inputCoverage) SK_OVERRIDE; |
22 | 25 |
23 virtual void emitGeometryProcessor(const GrEffectStage* geometryProcessor, | 26 GrGLProgramEffects* onCreateAndEmitEffects(const GrEffectStage* effectStages
[], |
24 GrGLSLExpr4* coverage) SK_OVERRIDE { | 27 int effectCnt, |
25 SkASSERT(NULL == geometryProcessor); | 28 const GrGLProgramDesc::EffectKeyP
rovider&, |
26 } | 29 GrGLSLExpr4* inOutFSColor); |
27 | 30 |
28 virtual GrGLProgramEffects* createAndEmitEffects(const GrEffectStage* effect
Stages[], | 31 virtual void emitEffect(const GrEffectStage& stage, |
29 int effectCnt, | 32 const GrEffectKey& key, |
30 const GrGLProgramDesc::Effe
ctKeyProvider&, | 33 const char* outColor, |
31 GrGLSLExpr4* inOutFSColor)
SK_OVERRIDE; | 34 const char* inColor, |
| 35 int stageIndex) SK_OVERRIDE; |
32 | 36 |
33 virtual void emitCodeAfterEffects() SK_OVERRIDE {} | 37 /** |
| 38 * Helper for emitEffect(). Allocates texture units from the builder for eac
h transform in an |
| 39 * effect. The transforms all use adjacent texture units. They either use tw
o or three of the |
| 40 * coordinates at a given texture unit, depending on if they need perspectiv
e interpolation. |
| 41 * The expressions to access the transformed coords (i.e. 'vec2(gl_TexCoord[
0])') as well as the |
| 42 * types are appended to the TransformedCoordsArray* object, which is in tur
n passed to the |
| 43 * effect's emitCode() function. |
| 44 */ |
| 45 void setupPathTexGen(const GrEffectStage&, GrGLEffect::TransformedCoordsArra
y*); |
| 46 |
| 47 virtual GrGLProgramEffects* getProgramEffects() SK_OVERRIDE { return fProgra
mEffects.get(); } |
| 48 |
| 49 typedef GrGLProgramDesc::EffectKeyProvider EffectKeyProvider; |
| 50 |
| 51 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects; |
34 | 52 |
35 typedef GrGLProgramBuilder INHERITED; | 53 typedef GrGLProgramBuilder INHERITED; |
36 }; | 54 }; |
37 | 55 |
38 #endif | 56 #endif |
OLD | NEW |